Showing posts with label Tomcat. Show all posts
Showing posts with label Tomcat. Show all posts

Wednesday, March 10, 2010

Tomcat Get Method Request

Tomcat process all get-method-request as if it's query-string is encoded in "iso-latin-1".

To change it add attribute
useBodyEncodingForURI="true" in the Connector element of server.xml.

Monday, February 1, 2010

web.xml wildcard

web.xml wildcard.

if you have a file "/dir1/dir2/page.html" and
write web.xml servlet mapping like
<servlet-mapping>
<servlet-name>any_servlet</servlet-name>
<url-pattern>/dir1/dir2/*</url-pattern>
</servlet-mapping>

request to page.html always end with Http 404 not found.

Monday, January 18, 2010

Tomcat start context value

Using Context Element inside server.xml or Context file.

<Context path="/path" docBase="localPath" ...... >
<parameter name="resource_name" value="resource_path">
</Context>

Using web.xml
<env-entry>
<env-entry-name>paramName</env-entry-name>
<env-entry-type>java.lang.String(or any type)</env-entry-type>
<env-entry-value>paramValue</env-entry-value>
</env-entry>
Calling in java source code.
Context initCtx = new InitialContext();
String paramValue = (String) initCtx.lookup(paramName);