Notes by Dr. Xi
Displaying keyword search results 1 - 10
Created by Dr. Xi on April 19, 2012 10:10:08
Last update: April 19, 2012 10:11:06
The default servlet for Tomcat is declared in $CATALINA_HOME/conf/web.xml :
<servlet>
<servlet-name>default</servle...
Therefore, static content is rendered by the default configuration unless you override it with your own definitions.
If you want to allow directory listing, just change the listing parameter to true :
<init-param>
<param-name>listings</para...
Change the welcome-file-list to display a default page in lieu of a directory listing:
<welcome-file-list>
<welcome-file>home.xhtml</...
Welcome pages are defined at the Web application level.
Created by Dr. Xi on March 08, 2012 12:13:57
Last update: March 08, 2012 12:13:57
This example creates an instance of XMLGregorianCalendar and converts it to java.util.Date :
import java.util.Date;
import javax.xml.datatyp...
Created by Dr. Xi on March 08, 2012 09:39:22
Last update: March 08, 2012 09:39:22
Actually there is an easy solution: change the name of the war file at deployment!
Sample ant task:
<target name="deploy" depends="package">
<c...
Created by Dr. Xi on February 01, 2012 12:55:28
Last update: February 01, 2012 12:55:28
You can define environment variables in the Tomcat context.xml file like this:
<?xml version="1.0" encoding="UTF-8"?>
<Context...
which is equivalent to the following in web.xml :
<env-entry>
<env-entry-name>varName</env-entr...
In Java code, the variable can be looked up like this:
// import javax.naming.Context;
// import javax...
Created by Dr. Xi on January 20, 2012 15:05:14
Last update: January 20, 2012 15:06:15
Tomcat documentation states:
If the web application is packaged as a WAR then /META-INF/context.xml will be copied to $CATALINA_BASE/conf/ [enginename] / [hostname] / and renamed to match the application's context path .
For a Maven project, put context.xml in src/main/webapp/META-INF/ .
Created by Dr. Xi on January 17, 2012 11:58:16
Last update: January 17, 2012 11:58:16
Steps to configure JavaMail resource for Tomcat 6 & 7:
Install JavaMail jar: download the JavaMail API , unzip the archive and copy mail.jar to $CATALINA_HOME/lib .
Add JavaMail resource to $CATALINA_BASE/conf/context.xml :
<?xml version="1.0"?>
<Context>
.
...
Add resource-ref for the JavaMail resource to your webapp WEB-INF/web.xml :
<?xml version="1.0" encoding="UTF-8"?>
<web-app...
Use the JavaMail resource in your webapp:
// import javax.naming.*;
// import javax.mail....
Created by Dr. Xi on February 12, 2010 22:52:27
Last update: November 08, 2011 19:48:09
For Tomcat 6, there's no default manager username and password. You do have to set it up yourself, though it's pretty straightforward. The Tomcat manager webapp is restricted to users with a role named manager . So you'll need to create a user and assign the manager role to it.
Edit $CATALINA_BASE/conf/tomcat-users.xml to read:
<?xml version='1.0' encoding='utf-8'?>
<!--
...
For tomcat 7:
<tomcat-users>
<role rolename="manager"/>
...
Created by Dr. Xi on August 11, 2007 14:36:11
Last update: June 21, 2011 15:19:41
When transforming XML into HTML with XSLT, doesn't seem to work, but   does the trick.
Frequently used entities:
Name Character Entity Reference Numeric Reference
quot " " $#34;
amp & & $#38;
apos ' ' $#39;
lt < < $#60;
gt > > $#62;
nbsp non-breaking space $#160;
copy © © $#169;
reg ® ® $#174;
The full list is available here:
http://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references
Created by Dr. Xi on May 03, 2011 14:27:15
Last update: May 03, 2011 14:28:06
The XML schema for a contact might look like this:
<?xml version="1.0" encoding="UTF-8"?>
<schema ...
With XML digital signatures , a Signature element is inserted inside the contact element after the contact file is signed. Like this:
<?xml version="1.0" encoding="UTF-8" standalone="n...
which no longer validates with the original schema.
The schema should be updated to (with the addition of digital signature namespace, schema import and Signature ref ):
<?xml version="1.0" encoding="UTF-8"?>
<schema ...
Created by Dr. Xi on April 26, 2011 20:12:01
Last update: April 28, 2011 15:28:12
An XML schema is a definition of XML files, in XML. It plays the same role as old-time DTDs. Overall, an XML schema file looks like this:
<schema attributeFormDefault = (qualified | u... The attribute meanings: targetNamespace : The name space targeted by the current schema definition. It can be any URI. id and version : For user convenience, the W3C spec defines no semantics for them. xml:lang : Natural language identifier defined by RFC 3306 . attributeFormDefault and elementFormDefault : Set default values for the form attribute for attribute and element declarations. blockDefault and finalDefault : Set default values for the block and final attributes for attribute and element declarations. The W3C defined some built-in datatypes . Examples of primitive datatypes are: string ,...