Displaying keyword search results 91 - 100
Created by Dr. Xi on February 01, 2011 14:36:04 Last update: February 01, 2011 14:37:09
Tomcat JDBC connection pool can be configured with META-INF/context.xml . This is the example given in the Tomcat doc :
<Context> <Resource name="jdbc/EmployeeDB" ...To use the DataSource in your Java code:
Context initCtx = new InitialContext(); DataSou...In contrast to Tomcat documentation, there's no need to declare resource-ref in web.xml . The above example uses Tomcat's standard DataSource resource factory: org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory . If you are using a third party DataSource factory, the configuration may be different. For example, if you are using HA-JDBC , context.xml may look like:
<Context> <!-- ... --> <Resource name="j...
Created by Dr. Xi on November 23, 2010 20:41:28 Last update: January 14, 2011 16:15:20
The servlet API allows servlet filters to be inserted into the processing cycle to form a Filter Chain . How is a chain defined, and what is the ordering of filters in the chain? The servlet filter chain is formed by defining multiple filters for the same servlet or URL pattern in web.xml . The order in which the filters are invoked is the same order as <filter-mapping> s appear in the web.xml file. For example, if this is defined in web.xml :
<!-- Filter mapping --> <filter-mapping> ...then servletFilter2 will be applied before servletFilter . Actually, it's more accurate to imagine these filters as layers or wraps instead of chains. In the above example, servletFilter2 wraps servletFilter .
Created by nogeek on December 31, 2010 12:41:05 Last update: December 31, 2010 12:41:05
The JBoss JARStructure class determines whether a deployment, in the form of a file or a directory, represents a packaged or unpackaged JAR archive. If the deployment is a single file then the filename suffix is checked against the following list. If the deployment is a directory then the same check is performed using the directory name. If a match is found in either case, then the deployment is considered a JAR archive. A top level directory is always considered an unpackaged JAR archive, even when the suffix does not match. .zip - a standard archive .jar - a java archive (defined by the Java SE specification) .ear - an enterprise archive (defined by the Java EE specification) .rar - a resource archive (defined by...
Created by nogeek on December 31, 2010 12:30:37 Last update: December 31, 2010 12:30:37
JBoss deployment descriptors are files containing configuration information for deployments. They are detected using the FileStructure class by matching the file suffix or using a FileMatcher . Default file suffixes include: -beans.xml - contains bean definitions -aop.xml - contains aspect definitions -service.xml - contains mbean definitions -ds.xml - contains JCA datasource definitions These are defined in $JBOSS_HOME/server/default/conf/bootstrap/deployers.xml :
<!-- File Structure --> <bean name="FileStr...
Created by nogeek on November 11, 2010 00:26:08 Last update: November 11, 2010 00:29:43
This one is even more weird: it worked on Windows but failed on Linux, using default tools JDK1.6.0_20 on both. The exception thrown was:
java.lang.RuntimeException: Invalid conversion fro...And the stack trace:
java.lang.RuntimeException: Invalid conversion fro...This was the XSL used:
<?xml version="1.0" encoding="ISO-8859-1"?> <xs...The problem was , DateUtil.java had two getDate methods, one taking long parameter, the other taking a String parameter. And Java's XSLT get confused about which one to use:
import java.util.Date; import java.text.SimpleD...
Created by nogeek on November 04, 2010 20:00:15 Last update: November 05, 2010 14:38:43
Following are some bugs in the Xalan jar shipped with JBoss 5.1.0 GA and JBoss 6.0. The Xalan jar file is located in jboss-5.1.0.GA/lib/endorsed ( %JBOSS_HOME%/common/lib for JBoss 6.0). Test xml:
<?xml version="1.0" encoding="ISO-8859-1"?> ...Test xsl:
<?xml version="1.0" encoding="ISO-8859-1"?> <xs...XSLT Java code:
import org.w3c.dom.*; import javax.xml.parsers....DateUtil.java
import java.util.Date; public class DateUti...XSLT output:
Transformer Factory class: class org.apache.xalan....Apparently, the output is wrong. The string "A test event" should not have been displayed.
Created by nogeek on November 04, 2010 20:55:31 Last update: November 05, 2010 14:36:09
Following part 1 , change to stylesheet to:
<?xml version="1.0" encoding="ISO-8859-1"?> <xs...The XSLT output becomes:
java Xslt test.xml test.xsl Transformer Fac...Parameter is not passed! The Xalan version that comes with JDK 1.6 processed this correctly:
Created by nogeek on November 04, 2010 20:08:02 Last update: November 04, 2010 20:45:25
Use the <xsl:with-param> and <xsl:param> tags to apply parameters to XSL stylesheets:
<?xml version="1.0" encoding="ISO-8859-1"?> <xs...
Created by nogeek on November 04, 2010 20:24:32 Last update: November 04, 2010 20:24:55
XSLT by default writes namespace declarations in the output. Most of the time it's spurious, sometimes outright wrong. Take this XML:
<?xml version="1.0" encoding="ISO-8859-1"?> <ev...And this XSL:
<?xml version="1.0" encoding="ISO-8859-1"?> <xs...where DateUtil.java is:
import java.util.Date; public class DateUti...The output is (with JDK1.6):
Title: <br xmlns:java="http://xml.apache.org/x...The namespace declaration went to the <br> element, not the timestamp where it belongs. To remove the namespace info, add exclude-result-prefixes to the XSL:
<?xml version="1.0" encoding="ISO-8859-1"?> <xs...
Created by Fang on August 10, 2010 21:37:36 Last update: October 25, 2010 20:18:47
The tags <fmt:formatNumber> Format a numeric value as number , currency or percentage - controlled by the type attribute (defaults to number if type is missing). Syntax:
<fmt:formatNumber value="numericValue" [type="...Attributes: Name Dynamic? Type Description value true String or Number Numeric value to be formatted. type true String Specifies whether the value is to be formatted as number, currency, or percentage. pattern true String Custom formatting pattern, must follow the pattern syntax specified by the class java.text.DecimalFormat . currencyCode true String ISO 4217 currency code. Applied only when formatting currencies (i.e. if type is equal to "currency"); ignored otherwise. currencySymbol true String Currency symbol. Applied only when formatting currencies (i.e. if type is equal to "currency"); ignored otherwise. It is used only when currencyCode is...