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.

Wednesday, January 20, 2010

Avoid browser cache of flash files

To certain date time.
<META http-equiv="expires" content="Mon, 19 Jan 2009 11:34:25 GMT">

Pragma (some browser doesn't support ex. IE5)
<META http-equiv="PRAGMA" content="NO-CACHE">

Query String.
Change link string as a http query string with "?".
<embed src="example.swf?12345">

Monday, January 18, 2010

Target other frame using javascript

Change(move) other frame's page from one child frame.

function moveFramePage() {
    parent.other_frame_name.location = "http://target_page.html";
}

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);

Javascript move page

To move page with javascript's "document.href"

function movePage() {
document.href = "http://target.url.com";
}

<a href="#" onclick="movePage"> Clict To Move !! </a>

For firefox (only??),
#(sharp?) in href value is important