Tomcat: Session Timeout
Thursday, August 5th, 2010In the Web.xml
<web-app>
<session-config>
<session-timeout>60</session-timeout>
</session-config>
...
</web-app>
In the Web.xml
<web-app>
<session-config>
<session-timeout>60</session-timeout>
</session-config>
...
</web-app>
<delete> <fileset dir="WEB-INF/lib" includes="**/some*.jar" excludes="**/some-other*.jar" /> </delete>
<copy todir="../new/dir">
<fileset dir="src_dir"/>
</copy>
<copy todir="../dest/dir">
<fileset dir="src_dir">
<exclude name="**/*.java"/>
</fileset>
</copy>
<copy todir="../dest/dir">
<fileset dir="src_dir" excludes="**/*.java"/>
</copy>
<!-- =========================================================== -->
<!-- Set handler Collection Structure -->
<!-- =========================================================== -->
<Set name="handler">
<New id="Handlers" class="org.eclipse.jetty.server.handler.HandlerCollection">
<Set name="handlers">
<Array type="org.eclipse.jetty.server.Handler">
<Item>
<New id="akuiContext" class="org.eclipse.jetty.webapp.WebAppContext">
<Set name="contextPath">/mywebapp</Set>
<Set name="resourceBase">/path/to/single/mywebapp</Set>
</New>
</Item>
</Array>
</Set>
</New>
</Set>
#format: -agentlib:jdwp=name1[=value1],name2[=value2]... java -agentlib:jdwp=transport=dt_socket,server=y,address=8000,suspend=n start.jar
help: prints a brief message on how to use it and exits the VM.
server: (”n” or “y”) If “y,” listen for a debugger application to attach; otherwise, attach to the debugger application at the specified address.
address: transport address for the connection. If server=n, attempt to attach to a debugger application at this address. If server=y, listen for a connection at this address.
timeout: If server=y, this specifies the timeout, in milliseconds, to wait for the debugger to attach. If server=n, this specifies the timeout, in milliseconds, to use when attaching to the debugger.
suspend: If “y,” JVM suspends the execution until a debugger connects to the debuggee JVM.
More info: Techrepublic and Source: StackOverflow
mvn -Dmaven.test.skip=true package
<repository> <id>jboss-repository-group</id> <name>jboss-repository-group</name> <url>https://repository.jboss.org/nexus/content/groups/public/</url> <layout>default</layout> </repository>
Note: the “http://repository.jboss.org/maven2/” is deprecated. Use the above one (Announcement, Getting Started Doc ).
Parsing CSV is not as simple at it seems. Not hard, but cumbersome.
Here is a simple Lib that does the job: Open CSV (download)
CSVReader reader = new CSVReader(new FileReader(ADDRESS_FILE));
String [] nextLine;
while ((nextLine = reader.readNext()) != null) {
System.out.println("Name: [" + nextLine[0] + "]\nAddress: [" + nextLine[1] + "]\nEmail: [" + nextLine[2] + "]");
}
Yes, File.renameTo is used to move file.
// File (or directory) to be moved
File file = new File("filename");
// Destination directory
File dir = new File("directoryname");
// Move file to new directory
boolean success = file.renameTo(new File(dir, file.getName()));
if (!success) {
// File was not successfully moved
}
BILINEAR or BICUBIC hint, the quality of the scaled instance may not be as smooth as you might like…. To combat this issue, you can use a multi-step approach when downscaling by more than two times; this helps prevent the information loss issue and produces a much higher quality result that is visually quite close to that produced by Image.SCALE_AREA_AVERAGING.”class EmpSortByName implements Comparator{
public int compare(Employee o1, Employee o2) {
return o1.getName().compareTo(o2.getName());
}
}
....
List employees = ...;
Collections.sort(employees , new EmpSortByName());
java.lang.Comparable: int compareTo(Object o1)
This method compares this object with o1 object. Returned int value has the following meanings.
java.lang.Comparator: int compare(Object o1, Objecto2)
This method compares o1 and o2 objects. Returned int value has the following meanings.
By default, apache commons BeanUtils does not support string value to their targeted Enum. You can write a converter for each enum, but this quickly become unmanageable.
Here is a quick fix to automatically convert the string value to the targeted enum.
BeanUtilsBean beanUtilsBean = new BeanUtilsBean(new ConvertUtilsBean(){
@Override
public Object convert(String value, Class clazz) {
if (clazz.isEnum()){
return Enum.valueOf(clazz, value);
}else{
return super.convert(value, clazz);
}
}
});
Now, you can call beanUtilsBean.populate(bean,map) even for enum values.