Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ryanxhl
spring-mvc-mini
提交
9e9a041b
S
spring-mvc-mini
项目概览
Ryanxhl
/
spring-mvc-mini
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
spring-mvc-mini
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
9e9a041b
编写于
6月 23, 2015
作者:
H
hot13399
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
remove Properties.java
上级
3b2064a9
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
94 addition
and
90 deletion
+94
-90
src/main/java/com/spring/mvc/mini/json/RequestStatusJsonParser.java
...ava/com/spring/mvc/mini/json/RequestStatusJsonParser.java
+5
-4
src/main/java/com/spring/mvc/mini/mail/MailSender.java
src/main/java/com/spring/mvc/mini/mail/MailSender.java
+17
-7
src/main/java/com/spring/mvc/mini/svn/SVNHandler.java
src/main/java/com/spring/mvc/mini/svn/SVNHandler.java
+30
-21
src/main/java/com/spring/mvc/mini/validation/ObjectClassDataValidator.java
.../spring/mvc/mini/validation/ObjectClassDataValidator.java
+2
-2
src/main/java/com/spring/mvc/mini/web/ObjectClassFormController.java
...va/com/spring/mvc/mini/web/ObjectClassFormController.java
+10
-7
src/main/java/com/spring/mvc/mini/web/RequestStatusController.java
...java/com/spring/mvc/mini/web/RequestStatusController.java
+2
-2
src/main/java/com/spring/mvc/mini/xml/ObjectClassXMLPaser.java
...ain/java/com/spring/mvc/mini/xml/ObjectClassXMLPaser.java
+19
-25
src/main/webapp/WEB-INF/spring/appServlet/servlet-context.xml
...main/webapp/WEB-INF/spring/appServlet/servlet-context.xml
+5
-18
src/main/webapp/WEB-INF/views/home.jsp
src/main/webapp/WEB-INF/views/home.jsp
+4
-4
未找到文件。
src/main/java/com/spring/mvc/mini/json/RequestStatusJsonParser.java
浏览文件 @
9e9a041b
...
@@ -7,6 +7,7 @@ import java.util.ArrayList;
...
@@ -7,6 +7,7 @@ import java.util.ArrayList;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
...
@@ -20,8 +21,8 @@ public class RequestStatusJsonParser {
...
@@ -20,8 +21,8 @@ public class RequestStatusJsonParser {
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
RequestStatusJsonParser
.
class
);
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
RequestStatusJsonParser
.
class
);
@
Autowired
@
Value
(
"${path.json}"
)
private
Properties
properties
;
private
String
jsonPath
;
public
int
getMaxIntClass
()
{
public
int
getMaxIntClass
()
{
...
@@ -43,7 +44,7 @@ public class RequestStatusJsonParser {
...
@@ -43,7 +44,7 @@ public class RequestStatusJsonParser {
public
void
writeStatus
(
RequestStatusListType
mrslt
)
{
public
void
writeStatus
(
RequestStatusListType
mrslt
)
{
try
{
try
{
new
ObjectMapper
().
writeValue
(
new
File
(
properties
.
getJsonPath
()
),
mrslt
);
new
ObjectMapper
().
writeValue
(
new
File
(
jsonPath
),
mrslt
);
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
LOG
.
error
(
e
.
toString
());
LOG
.
error
(
e
.
toString
());
}
}
...
@@ -55,7 +56,7 @@ public class RequestStatusJsonParser {
...
@@ -55,7 +56,7 @@ public class RequestStatusJsonParser {
RequestStatusListType
type
=
null
;
RequestStatusListType
type
=
null
;
try
{
try
{
type
=
new
ObjectMapper
().
readValue
(
new
File
(
properties
.
getJsonPath
()
),
RequestStatusListType
.
class
);
type
=
new
ObjectMapper
().
readValue
(
new
File
(
jsonPath
),
RequestStatusListType
.
class
);
LOG
.
debug
(
type
.
toString
());
LOG
.
debug
(
type
.
toString
());
...
...
src/main/java/com/spring/mvc/mini/mail/MailSender.java
浏览文件 @
9e9a041b
...
@@ -14,6 +14,7 @@ import javax.mail.internet.MimeMessage;
...
@@ -14,6 +14,7 @@ import javax.mail.internet.MimeMessage;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
com.spring.mvc.mini.properties.Properties
;
import
com.spring.mvc.mini.properties.Properties
;
...
@@ -23,9 +24,18 @@ public class MailSender {
...
@@ -23,9 +24,18 @@ public class MailSender {
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
MailSender
.
class
);
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
MailSender
.
class
);
@Autowired
@Value
(
"${mail.starttls.enable}"
)
private
Properties
properties
;
private
String
starttlsEnable
;
@Value
(
"${mail.auth}"
)
private
String
auth
;
@Value
(
"${mail.host}"
)
private
String
host
;
@Value
(
"${mail.port}"
)
private
String
port
;
public
void
sendMail
(
final
String
username
,
final
String
password
,
String
fromAddress
,
Address
[]
toAddress
,
String
subject
,
String
text
)
throws
Exception
{
public
void
sendMail
(
final
String
username
,
final
String
password
,
String
fromAddress
,
Address
[]
toAddress
,
String
subject
,
String
text
)
throws
Exception
{
Authenticator
au
=
new
javax
.
mail
.
Authenticator
()
{
Authenticator
au
=
new
javax
.
mail
.
Authenticator
()
{
...
@@ -47,10 +57,10 @@ public class MailSender {
...
@@ -47,10 +57,10 @@ public class MailSender {
private
java
.
util
.
Properties
getProperties
()
{
private
java
.
util
.
Properties
getProperties
()
{
java
.
util
.
Properties
props
=
new
java
.
util
.
Properties
();
java
.
util
.
Properties
props
=
new
java
.
util
.
Properties
();
props
.
put
(
"mail.smtp.starttls.enable"
,
properties
.
getStarttlsEnable
()
);
props
.
put
(
"mail.smtp.starttls.enable"
,
starttlsEnable
);
props
.
put
(
"mail.smtp.auth"
,
properties
.
getAuth
()
);
props
.
put
(
"mail.smtp.auth"
,
auth
);
props
.
put
(
"mail.smtp.host"
,
properties
.
getHost
()
);
props
.
put
(
"mail.smtp.host"
,
host
);
props
.
put
(
"mail.smtp.port"
,
p
roperties
.
getPort
()
);
props
.
put
(
"mail.smtp.port"
,
p
ort
);
return
props
;
return
props
;
}
}
...
...
src/main/java/com/spring/mvc/mini/svn/SVNHandler.java
浏览文件 @
9e9a041b
package
com.spring.mvc.mini.svn
;
package
com.spring.mvc.mini.svn
;
import
java.io.ByteArrayOutputStream
;
import
java.io.File
;
import
java.util.Date
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.
Autowired
;
import
org.springframework.beans.factory.annotation.
Value
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
org.tmatesoft.svn.core.SVNDepth
;
import
org.tmatesoft.svn.core.SVNDepth
;
import
org.tmatesoft.svn.core.SVNException
;
import
org.tmatesoft.svn.core.SVNException
;
...
@@ -14,22 +10,35 @@ import org.tmatesoft.svn.core.SVNURL;
...
@@ -14,22 +10,35 @@ import org.tmatesoft.svn.core.SVNURL;
import
org.tmatesoft.svn.core.auth.ISVNAuthenticationManager
;
import
org.tmatesoft.svn.core.auth.ISVNAuthenticationManager
;
import
org.tmatesoft.svn.core.io.SVNRepository
;
import
org.tmatesoft.svn.core.io.SVNRepository
;
import
org.tmatesoft.svn.core.io.SVNRepositoryFactory
;
import
org.tmatesoft.svn.core.io.SVNRepositoryFactory
;
import
org.tmatesoft.svn.core.wc.SVNClientManager
;
import
org.tmatesoft.svn.core.wc.*
;
import
org.tmatesoft.svn.core.wc.SVNCommitClient
;
import
org.tmatesoft.svn.core.wc.SVNDiffClient
;
import
java.io.ByteArrayOutputStream
;
import
org.tmatesoft.svn.core.wc.SVNRevision
;
import
java.io.File
;
import
org.tmatesoft.svn.core.wc.SVNUpdateClient
;
import
java.util.Date
;
import
org.tmatesoft.svn.core.wc.SVNWCUtil
;
import
com.spring.mvc.mini.properties.Properties
;
@Component
@Component
public
class
SVNHandler
{
public
class
SVNHandler
{
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
SVNHandler
.
class
);
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
SVNHandler
.
class
);
@Autowired
@Value
(
"${svn.rep.url}"
)
private
Properties
properties
;
private
String
repURL
;
@Value
(
"${path.rep}"
)
private
String
repPath
;
@Value
(
"${svn.username}"
)
private
String
username
;
@Value
(
"${svn.password}"
)
private
String
password
;
@Value
(
"${path.json}"
)
private
String
jsonPath
;
@Value
(
"${path.xml}"
)
private
String
xmlPath
;
public
void
svnCheckin
()
{
public
void
svnCheckin
()
{
...
@@ -38,10 +47,10 @@ public class SVNHandler {
...
@@ -38,10 +47,10 @@ public class SVNHandler {
SVNClientManager
ourClientManager
=
SVNClientManager
.
newInstance
();
SVNClientManager
ourClientManager
=
SVNClientManager
.
newInstance
();
try
{
try
{
repository
=
SVNRepositoryFactory
.
create
(
SVNURL
.
parseURIDecoded
(
properties
.
getRepURL
()
));
repository
=
SVNRepositoryFactory
.
create
(
SVNURL
.
parseURIDecoded
(
repURL
));
ISVNAuthenticationManager
authManager
=
ISVNAuthenticationManager
authManager
=
SVNWCUtil
.
createDefaultAuthenticationManager
(
properties
.
getUsername
(),
properties
.
getPassword
()
);
SVNWCUtil
.
createDefaultAuthenticationManager
(
username
,
password
);
repository
.
setAuthenticationManager
(
authManager
);
repository
.
setAuthenticationManager
(
authManager
);
LOG
.
info
(
"Repository Root: "
+
repository
.
getRepositoryRoot
(
true
));
LOG
.
info
(
"Repository Root: "
+
repository
.
getRepositoryRoot
(
true
));
...
@@ -54,8 +63,8 @@ public class SVNHandler {
...
@@ -54,8 +63,8 @@ public class SVNHandler {
SVNCommitClient
commitClient
=
ourClientManager
.
getCommitClient
();
SVNCommitClient
commitClient
=
ourClientManager
.
getCommitClient
();
SVNDiffClient
diffClient
=
ourClientManager
.
getDiffClient
();
SVNDiffClient
diffClient
=
ourClientManager
.
getDiffClient
();
File
xmlfile
=
new
File
(
properties
.
getXmlPath
()
);
File
xmlfile
=
new
File
(
xmlPath
);
File
jsonfile
=
new
File
(
properties
.
getJsonPath
()
);
File
jsonfile
=
new
File
(
jsonPath
);
File
[]
xmlfilearray
=
{
xmlfile
};
File
[]
xmlfilearray
=
{
xmlfile
};
File
[]
jsonfilearray
=
{
jsonfile
};
File
[]
jsonfilearray
=
{
jsonfile
};
...
@@ -86,7 +95,7 @@ public class SVNHandler {
...
@@ -86,7 +95,7 @@ public class SVNHandler {
public
void
svnCheckout
()
{
public
void
svnCheckout
()
{
File
svnTempDir
=
new
File
(
properties
.
getRepPath
()
);
File
svnTempDir
=
new
File
(
repPath
);
if
(
svnTempDir
.
exists
())
{
if
(
svnTempDir
.
exists
())
{
return
;
return
;
}
}
...
@@ -95,11 +104,11 @@ public class SVNHandler {
...
@@ -95,11 +104,11 @@ public class SVNHandler {
try
{
try
{
//initiate the reporitory from the url
//initiate the reporitory from the url
repository
=
SVNRepositoryFactory
.
create
(
SVNURL
.
parseURIDecoded
(
properties
.
getRepURL
()
));
repository
=
SVNRepositoryFactory
.
create
(
SVNURL
.
parseURIDecoded
(
repURL
));
//create authentication data
//create authentication data
ISVNAuthenticationManager
authManager
=
ISVNAuthenticationManager
authManager
=
SVNWCUtil
.
createDefaultAuthenticationManager
(
properties
.
getUsername
(),
properties
.
getPassword
()
);
SVNWCUtil
.
createDefaultAuthenticationManager
(
username
,
password
);
repository
.
setAuthenticationManager
(
authManager
);
repository
.
setAuthenticationManager
(
authManager
);
//need to identify latest revision
//need to identify latest revision
...
...
src/main/java/com/spring/mvc/mini/validation/ObjectClassDataValidator.java
浏览文件 @
9e9a041b
...
@@ -12,11 +12,11 @@ import com.spring.mvc.mini.xml.ObjectClassXMLPaser;
...
@@ -12,11 +12,11 @@ import com.spring.mvc.mini.xml.ObjectClassXMLPaser;
public
class
ObjectClassDataValidator
{
public
class
ObjectClassDataValidator
{
@Autowired
@Autowired
private
ObjectClassXMLPaser
o
cxp
;
private
ObjectClassXMLPaser
o
bjectClassXMLPaser
;
public
void
checkData
(
ArrayList
<
ObjectClass
>
objclsListFormIn
)
throws
Exception
{
public
void
checkData
(
ArrayList
<
ObjectClass
>
objclsListFormIn
)
throws
Exception
{
ArrayList
<
ObjectClass
>
objclsListXmlIn
=
o
cxp
.
objectClassMapping
();
ArrayList
<
ObjectClass
>
objclsListXmlIn
=
o
bjectClassXMLPaser
.
objectClassMapping
();
for
(
ObjectClass
objclsItemFormIn:
objclsListFormIn
){
for
(
ObjectClass
objclsItemFormIn:
objclsListFormIn
){
...
...
src/main/java/com/spring/mvc/mini/web/ObjectClassFormController.java
浏览文件 @
9e9a041b
...
@@ -13,6 +13,7 @@ import com.spring.mvc.mini.pojo.*;
...
@@ -13,6 +13,7 @@ import com.spring.mvc.mini.pojo.*;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.mvc.extensions.ajax.AjaxUtils
;
import
org.springframework.mvc.extensions.ajax.AjaxUtils
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.Model
;
import
org.springframework.ui.Model
;
...
@@ -27,7 +28,6 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes;
...
@@ -27,7 +28,6 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import
com.spring.mvc.mini.json.RequestStatusJsonParser
;
import
com.spring.mvc.mini.json.RequestStatusJsonParser
;
import
com.spring.mvc.mini.mail.MailSender
;
import
com.spring.mvc.mini.mail.MailSender
;
import
com.spring.mvc.mini.pojo.RequestStatus
;
import
com.spring.mvc.mini.pojo.RequestStatus
;
import
com.spring.mvc.mini.properties.Properties
;
import
com.spring.mvc.mini.validation.ObjectClassDataValidator
;
import
com.spring.mvc.mini.validation.ObjectClassDataValidator
;
@Controller
@Controller
...
@@ -37,15 +37,18 @@ public class ObjectClassFormController {
...
@@ -37,15 +37,18 @@ public class ObjectClassFormController {
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
ObjectClassFormController
.
class
);
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
ObjectClassFormController
.
class
);
@Value
(
"${mail.to}"
)
private
String
mailto
;
@Value
(
"${web.hostname}"
)
private
String
webHostname
;
@Autowired
@Autowired
private
RequestStatusJsonParser
requestStatusJsonParser
;
private
RequestStatusJsonParser
requestStatusJsonParser
;
@Autowired
@Autowired
private
ObjectClassDataValidator
objectClassDataValidator
;
private
ObjectClassDataValidator
objectClassDataValidator
;
@Autowired
private
Properties
properties
;
@Autowired
@Autowired
private
MailSender
mailSender
;
private
MailSender
mailSender
;
...
@@ -151,7 +154,7 @@ public class ObjectClassFormController {
...
@@ -151,7 +154,7 @@ public class ObjectClassFormController {
StringBuffer
textsb
=
new
StringBuffer
();
StringBuffer
textsb
=
new
StringBuffer
();
textsb
.
append
(
"Hi,\r\n\r\nThese MO CR's shall be approved if no other comments.\r\nIf you have any comment, please comment on this page:\r\n"
);
textsb
.
append
(
"Hi,\r\n\r\nThese MO CR's shall be approved if no other comments.\r\nIf you have any comment, please comment on this page:\r\n"
);
textsb
.
append
(
"http://"
);
textsb
.
append
(
"http://"
);
textsb
.
append
(
properties
.
getWebHostname
()
);
textsb
.
append
(
webHostname
);
textsb
.
append
(
":8080/spring-mvc-mini/requeststatus?mocrid="
);
textsb
.
append
(
":8080/spring-mvc-mini/requeststatus?mocrid="
);
textsb
.
append
(
mocrid
);
textsb
.
append
(
mocrid
);
textsb
.
append
(
"\r\nor mailto:"
);
textsb
.
append
(
"\r\nor mailto:"
);
...
@@ -159,7 +162,7 @@ public class ObjectClassFormController {
...
@@ -159,7 +162,7 @@ public class ObjectClassFormController {
textsb
.
append
(
"\r\n"
);
textsb
.
append
(
"\r\n"
);
textsb
.
append
(
"The request will be committed in 5 days.\r\n\r\nThanks.\r\n"
);
textsb
.
append
(
"The request will be committed in 5 days.\r\n\r\nThanks.\r\n"
);
textsb
.
append
(
"http://"
);
textsb
.
append
(
"http://"
);
textsb
.
append
(
properties
.
getWebHostname
()
);
textsb
.
append
(
webHostname
);
textsb
.
append
(
":8080/spring-mvc-mini/"
);
textsb
.
append
(
":8080/spring-mvc-mini/"
);
return
textsb
.
toString
();
return
textsb
.
toString
();
}
}
...
@@ -198,7 +201,7 @@ public class ObjectClassFormController {
...
@@ -198,7 +201,7 @@ public class ObjectClassFormController {
public
void
commitAndSendMail
(
UserInfo
userinfo
,
String
subject
,
String
text
)
throws
Exception
{
public
void
commitAndSendMail
(
UserInfo
userinfo
,
String
subject
,
String
text
)
throws
Exception
{
Address
[]
toAddress
=
{
new
InternetAddress
(
properties
.
getMailto
()
),
new
InternetAddress
(
userinfo
.
getEmail
())};
Address
[]
toAddress
=
{
new
InternetAddress
(
mailto
),
new
InternetAddress
(
userinfo
.
getEmail
())};
mailSender
.
sendMail
(
userinfo
.
getUsername
(),
userinfo
.
getPassword
(),
userinfo
.
getEmail
(),
toAddress
,
subject
,
text
);
mailSender
.
sendMail
(
userinfo
.
getUsername
(),
userinfo
.
getPassword
(),
userinfo
.
getEmail
(),
toAddress
,
subject
,
text
);
}
}
...
...
src/main/java/com/spring/mvc/mini/web/RequestStatusController.java
浏览文件 @
9e9a041b
...
@@ -34,7 +34,7 @@ public class RequestStatusController {
...
@@ -34,7 +34,7 @@ public class RequestStatusController {
private
RequestStatusJsonParser
requestStatusJsonParser
;
private
RequestStatusJsonParser
requestStatusJsonParser
;
@Autowired
@Autowired
private
MailSender
m
s
;
private
MailSender
m
ailSender
;
@ModelAttribute
@ModelAttribute
public
void
ajaxAttribute
(
WebRequest
request
,
Model
model
)
{
public
void
ajaxAttribute
(
WebRequest
request
,
Model
model
)
{
...
@@ -158,7 +158,7 @@ public class RequestStatusController {
...
@@ -158,7 +158,7 @@ public class RequestStatusController {
Address
[]
toAddress
=
{
new
InternetAddress
(
userinfo
.
getEmail
())};
Address
[]
toAddress
=
{
new
InternetAddress
(
userinfo
.
getEmail
())};
m
s
.
sendMail
(
userinfo
.
getUsername
(),
userinfo
.
getPassword
(),
userinfo
.
getEmail
(),
toAddress
,
subject
,
text
);
m
ailSender
.
sendMail
(
userinfo
.
getUsername
(),
userinfo
.
getPassword
(),
userinfo
.
getEmail
(),
toAddress
,
subject
,
text
);
}
}
}
}
src/main/java/com/spring/mvc/mini/xml/ObjectClassXMLPaser.java
浏览文件 @
9e9a041b
package
com.spring.mvc.mini.xml
;
package
com.spring.mvc.mini.xml
;
import
java.io.File
;
import
com.spring.mvc.mini.pojo.ObjectClass
;
import
java.nio.file.Files
;
import
com.spring.mvc.mini.svn.SVNHandler
;
import
java.nio.file.Path
;
import
org.slf4j.Logger
;
import
java.nio.file.Paths
;
import
org.slf4j.LoggerFactory
;
import
java.util.ArrayList
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
org.w3c.dom.*
;
import
javax.xml.parsers.DocumentBuilder
;
import
javax.xml.parsers.DocumentBuilder
;
import
javax.xml.parsers.DocumentBuilderFactory
;
import
javax.xml.parsers.DocumentBuilderFactory
;
...
@@ -12,28 +15,19 @@ import javax.xml.transform.Transformer;
...
@@ -12,28 +15,19 @@ import javax.xml.transform.Transformer;
import
javax.xml.transform.TransformerFactory
;
import
javax.xml.transform.TransformerFactory
;
import
javax.xml.transform.dom.DOMSource
;
import
javax.xml.transform.dom.DOMSource
;
import
javax.xml.transform.stream.StreamResult
;
import
javax.xml.transform.stream.StreamResult
;
import
java.io.File
;
import
org.slf4j.Logger
;
import
java.nio.file.Files
;
import
org.slf4j.LoggerFactory
;
import
java.nio.file.Path
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
java.nio.file.Paths
;
import
org.springframework.stereotype.Component
;
import
java.util.ArrayList
;
import
org.w3c.dom.Comment
;
import
org.w3c.dom.Document
;
import
org.w3c.dom.Element
;
import
org.w3c.dom.Node
;
import
org.w3c.dom.NodeList
;
import
com.spring.mvc.mini.pojo.ObjectClass
;
import
com.spring.mvc.mini.properties.Properties
;
import
com.spring.mvc.mini.svn.SVNHandler
;
@Component
@Component
public
class
ObjectClassXMLPaser
{
public
class
ObjectClassXMLPaser
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ObjectClassXMLPaser
.
class
);
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ObjectClassXMLPaser
.
class
);
@
Autowired
@
Value
(
"${path.xml}"
)
private
Properties
properties
;
private
String
xmlPath
;
@Autowired
@Autowired
private
SVNHandler
svnHandler
;
private
SVNHandler
svnHandler
;
...
@@ -46,7 +40,7 @@ public class ObjectClassXMLPaser {
...
@@ -46,7 +40,7 @@ public class ObjectClassXMLPaser {
DocumentBuilderFactory
factory
=
DocumentBuilderFactory
.
newInstance
();
DocumentBuilderFactory
factory
=
DocumentBuilderFactory
.
newInstance
();
DocumentBuilder
builder
=
factory
.
newDocumentBuilder
();
DocumentBuilder
builder
=
factory
.
newDocumentBuilder
();
File
objectClassesFile
=
new
File
(
properties
.
getXmlPath
()
);
File
objectClassesFile
=
new
File
(
xmlPath
);
Document
document
=
builder
.
parse
(
objectClassesFile
);
Document
document
=
builder
.
parse
(
objectClassesFile
);
...
@@ -104,7 +98,7 @@ public class ObjectClassXMLPaser {
...
@@ -104,7 +98,7 @@ public class ObjectClassXMLPaser {
DocumentBuilder
builder
=
factory
.
newDocumentBuilder
();
DocumentBuilder
builder
=
factory
.
newDocumentBuilder
();
File
objectClassesFile
=
new
File
(
properties
.
getXmlPath
()
);
File
objectClassesFile
=
new
File
(
xmlPath
);
Document
document
=
builder
.
parse
(
objectClassesFile
);
Document
document
=
builder
.
parse
(
objectClassesFile
);
...
@@ -117,7 +111,7 @@ public class ObjectClassXMLPaser {
...
@@ -117,7 +111,7 @@ public class ObjectClassXMLPaser {
Transformer
transformer
=
transformerFactory
.
newTransformer
();
Transformer
transformer
=
transformerFactory
.
newTransformer
();
DOMSource
source
=
new
DOMSource
(
document
);
DOMSource
source
=
new
DOMSource
(
document
);
StreamResult
result
=
new
StreamResult
(
new
File
(
properties
.
getXmlPath
()
));
StreamResult
result
=
new
StreamResult
(
new
File
(
xmlPath
));
transformer
.
transform
(
source
,
result
);
transformer
.
transform
(
source
,
result
);
...
@@ -142,7 +136,7 @@ public class ObjectClassXMLPaser {
...
@@ -142,7 +136,7 @@ public class ObjectClassXMLPaser {
LOGGER
.
info
(
"Start to checkout"
);
LOGGER
.
info
(
"Start to checkout"
);
svnHandler
.
svnCheckout
();
svnHandler
.
svnCheckout
();
Path
path
=
Paths
.
get
(
properties
.
getXmlPath
()
);
Path
path
=
Paths
.
get
(
xmlPath
);
return
Files
.
readAllBytes
(
path
);
return
Files
.
readAllBytes
(
path
);
...
...
src/main/webapp/WEB-INF/spring/appServlet/servlet-context.xml
浏览文件 @
9e9a041b
...
@@ -7,37 +7,24 @@
...
@@ -7,37 +7,24 @@
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"
>
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"
>
<!-- DispatcherServlet Context: defines this servlet's request-processing infrastructure -->
<context:annotation-config/>
<context:annotation-config/>
<context:component-scan
base-package=
"com.spring.mvc.mini"
/>
<context:component-scan
base-package=
"com.spring.mvc.mini"
/>
<!--<context:property-placeholder location="file:/opt/web/spring-mvc-mini/resources/application.properties"/>-->
<context:property-placeholder
location=
"file:resources/application.properties"
/>
<context:property-placeholder
location=
"file:resources/application.properties"
/>
<!-- Enables the Spring MVC @Controller programming model -->
<annotation-driven
conversion-service=
"conversionService"
>
<annotation-driven
conversion-service=
"conversionService"
>
</annotation-driven>
</annotation-driven>
<beans:bean
id=
"conversionService"
class=
"org.springframework.format.support.FormattingConversionServiceFactoryBean"
>
</beans:bean>
<!-- Handles HTTP GET requests for /resources/** by efficiently serving up static resources in the ${webappRoot}/resources/ directory -->
<resources
mapping=
"/resources/**"
location=
"/resources/"
/>
<resources
mapping=
"/resources/**"
location=
"/resources/"
/>
<!-- Resolves views selected for rendering by @Controllers to .jsp resources in the /WEB-INF/views directory -->
<beans:bean
class=
"org.springframework.web.servlet.view.InternalResourceViewResolver"
>
<beans:bean
class=
"org.springframework.web.servlet.view.InternalResourceViewResolver"
>
<beans:property
name=
"prefix"
value=
"/WEB-INF/views/"
/>
<beans:property
name=
"prefix"
value=
"/WEB-INF/views/"
/>
<beans:property
name=
"suffix"
value=
".jsp"
/>
<beans:property
name=
"suffix"
value=
".jsp"
/>
</beans:bean>
</beans:bean>
<!-- Only needed because we install custom converters to support the examples in the org.springframewok.samples.mvc.convert package -->
<beans:bean
id=
"conversionService"
class=
"org.springframework.format.support.FormattingConversionServiceFactoryBean"
>
</beans:bean>
<!-- Only needed because we require fileupload in the org.springframework.samples.mvc.fileupload package
<beans:bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver" />
-->
<!-- Imports user-defined @Controller beans that process client requests -->
<beans:import
resource=
"controllers.xml"
/>
<beans:import
resource=
"controllers.xml"
/>
<beans:import
resource=
"application-context.xml"
/>
<beans:import
resource=
"application-context.xml"
/>
...
...
src/main/webapp/WEB-INF/views/home.jsp
浏览文件 @
9e9a041b
...
@@ -23,10 +23,10 @@
...
@@ -23,10 +23,10 @@
<li><a
href=
"
<c:url
value=
"/userinfoform"
/>
"
title=
"userinfoform"
>
UserInfoForm
</a></li>
<li><a
href=
"
<c:url
value=
"/userinfoform"
/>
"
title=
"userinfoform"
>
UserInfoForm
</a></li>
<li><a
href=
"
<c:url
value=
"/objectclassform"
/>
"
title=
"objectclassform"
>
ObjectClassForm
</a></li>
<li><a
href=
"
<c:url
value=
"/objectclassform"
/>
"
title=
"objectclassform"
>
ObjectClassForm
</a></li>
<li><a
href=
"
<c:url
value=
"/requeststatus"
/>
"
title=
"requeststatus"
>
RequestStatusForm
</a></li>
<li><a
href=
"
<c:url
value=
"/requeststatus"
/>
"
title=
"requeststatus"
>
RequestStatusForm
</a></li>
<li><a
href=
"
<c:url
value=
"/object
classlist"
/>
"
title=
"objectclasslist
"
>
ObjectClassList
</a></li>
<li><a
href=
"
<c:url
value=
"/object
Classes"
/>
"
title=
"objectClasses
"
>
ObjectClassList
</a></li>
</ul>
</ul>
</div>
</div>
<p>
2015 spring. Tech:
<a
href=
"http://spring.io/guides"
>
Spring MVC
</a>
. Support Contact
<a
href=
"mailto:jerry.1.zhang@spring.com"
>
Jerry Zhang
</a></p>
<p>
?
2015 spring. Tech:
<a
href=
"http://spring.io/guides"
>
Spring MVC
</a>
. Support Contact
<a
href=
"mailto:jerry.1.zhang@spring.com"
>
Jerry Zhang
</a></p>
<script
type=
"text/javascript"
src=
"
<c:url
value=
"/resources/jquery/1.6/jquery.js"
/>
"
></script>
<script
type=
"text/javascript"
src=
"
<c:url
value=
"/resources/jquery/1.6/jquery.js"
/>
"
></script>
<script
type=
"text/javascript"
src=
"
<c:url
value=
"/resources/jqueryform/2.8/jquery.form.js"
/>
"
></script>
<script
type=
"text/javascript"
src=
"
<c:url
value=
"/resources/jqueryform/2.8/jquery.form.js"
/>
"
></script>
<script
type=
"text/javascript"
src=
"
<c:url
value=
"/resources/jqueryui/1.8/jquery.ui.core.js"
/>
"
></script>
<script
type=
"text/javascript"
src=
"
<c:url
value=
"/resources/jqueryui/1.8/jquery.ui.core.js"
/>
"
></script>
...
@@ -78,9 +78,9 @@ $(document).ready(function() {
...
@@ -78,9 +78,9 @@ $(document).ready(function() {
$
(
"
#tabs
"
).
bind
(
"
tabsselect
"
,
function
(
event
,
ui
)
{
$
(
"
#tabs
"
).
bind
(
"
tabsselect
"
,
function
(
event
,
ui
)
{
if
(
"
object
classlist
"
==
ui
.
tab
.
title
){
if
(
"
object
Classes
"
==
ui
.
tab
.
title
){
console
.
log
(
"
iftrue
"
);
console
.
log
(
"
iftrue
"
);
window
.
location
.
replace
(
"
./object
classlist
"
);
window
.
location
.
replace
(
"
./object
Classes
"
);
return
;
return
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录