This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@InitBinder | |
public void initBinder(WebDataBinder binder) { | |
//下面是自定义一个日期转换的PropertyEditor | |
//SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); | |
//dateFormat.setLenient(false); | |
//binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, false)); | |
//定义UpdateTemplate转换的PropertyEditor | |
binder.registerCustomEditor(UpdateTemplate.class, new PropertyEditorSupport() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 找出一个XML文件下的info元素的param属性,并解码base64重新保存到另外一个文件中 | |
*/ | |
def root = new XmlParser().parse(new File("a.xml")) | |
root.actions.action.infos.info.each{ | |
if(it.'@param'){ | |
it.'@param' = new String(it.'@param'.decodeBase64()) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private String coverToXml(FilesInfoBean info) { | |
StringWriter writer = new StringWriter(); | |
try { | |
JAXBContext context = JAXBContext.newInstance(info.getClass()); | |
Marshaller marshaller = context.createMarshaller(); | |
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); //格式化 | |
marshaller.marshal(info, writer); | |
} catch (JAXBException e) { | |
e.printStackTrace(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.kingsoft.wpsess.update.controller; | |
import org.junit.Before; | |
import org.junit.Test; | |
import org.junit.runner.RunWith; | |
import org.mockito.Mock; | |
import org.mockito.runners.MockitoJUnitRunner; | |
import com.kingsoft.wpsess.update.service.UpdateService; | |
import org.springframework.http.MediaType; | |
import org.springframework.test.web.servlet.MockMvc; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apply plugin: 'war' | |
apply plugin: 'jetty' | |
repositories { | |
mavenCentral() | |
maven { url "http://repo.spring.io/libs-milestone" } | |
maven { url "https://repository.jboss.org/nexus/content/repositories/releases" } | |
} | |
dependencies { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TortoiseProc /command:update /path:"D:/myprj/src*D:/myprj/resource |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TortoiseProc /command:commit /path:"D:/workspace/myprj/src/com/abc/common" /closeonend:0 | |
TortoiseProc /command:commit /path:"D:/workspace/myprj/resources/css" /closeonend:0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<#-- | |
* 结合bootstrap的样式,有错误的时候高亮显示字段 | |
* config是表单绑定的模型对象,targetVersion是它的一个属性 | |
--> | |
<@spring.bind "config.targetVersion"/> | |
<#assign error> | |
<#if spring.status.errorMessages?has_content>error</#if> | |
</#assign> | |
<div class="control-group ${error}"> | |
<label class="control-label" for="inputTargetVersion">升级后版本</label> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- H2的混合模式 --> | |
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> | |
<property name="driverClassName" value="org.h2.Driver" /> | |
<!--<property name="url" value="jdbc:h2:~/databases/mydb" />--> | |
<property name="url" value="jdbc:h2:file://D:\h2\mydb;AUTO_SERVER=TRUE;USER=SA;" /> | |
</bean> | |
<!-- H2的内存模式 --> | |
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String json = Resources.toString(Resources.getResource("com/mycompany/test/fixture/config_fixture.json"), Charsets.UTF_8); |