Recent Notes

Displaying keyword search results 1 - 10
Created by Fang on July 25, 2012 12:52:40    Last update: September 14, 2012 13:37:57
Summarized from official JAX-WS documentation : Sending and Receiving SOAP Headers To send a SOAP header: HelloService helloService = new HelloService(); ... To receive a SOAP header: List<Header> inboundHeaders = bp.getInboundHeaders... Message logging On the client side, set system property: com.sun.xml.ws.transport.http.client.HttpTransport... On the server side, set system property: com.sun.xml.ws.transport.http.HttpAdapter.dump=tru... Propagation of Server-side Stacktrace Propagation of Stack trace is on by default. The whole stacktrace (including nested exceptions) is propagated in the SOAP Fault and the complete exception stacktrace is visible to the client as cause of SOAPFaultException . To turn off stack trace propagation, set this system property on the server: com.sun.xml.ws.fault.SOAPFaultBuilder.disableCaptu... Update: At least on the client side, the property name has been changed to: com.sun.xml.internal.ws.transport.http.client.Http... The messages are dumped to stdout . For...
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 Fang on December 09, 2011 11:50:28    Last update: December 09, 2011 11:51:34
Values of Maven properties are accessed with the construct ${...} . Properties come from 5 different sources: From the environment, for example: ${env.PATH} , ${env.JAVA_HOME} . From the POM, in the form of ${project.x} . For example: ${project.version} , ${project.groupId} . From settings.xml , in the form of ${settings.x} . For example: ${settings.offline} , ${settings.interactiveMode} . From Java system properties, for example: ${java.home} . Defined within the properties element in the POM. For example ( gae.version ): <properties> <gae.version>1.4.2</gae.ve...
Created by Fang on November 10, 2011 09:26:12    Last update: November 10, 2011 09:26:12
Syntax highlighted XML schema for JSF 2.0 Application Configuration Resource File ( faces-config.xml ). Almost 3000 lines! <?xml version="1.0" encoding="UTF-8"?> <xsd:sch...
Created by Fang on January 23, 2011 19:28:35    Last update: October 28, 2011 12:10:07
Maven repositories are a central part of the Maven build system. Maven resolves dependencies through repositories. There are two types of repositories: local and remote . The local repository stores local build artifacts (when you do mvn install ) and caches artifacts from remote repositories. It is usually located on the local file system at $USER_HOME/.m2/repository . Remote repositories are located on the network and accessed by URLs ( http:// or file:// etc). The central Maven repository is: repo1.maven.org . The Java EE repositories are located at: http://download.java.net/maven/2/ and http://download.java.net/maven/1/ . Remote repositories can also be set up on the company intranet within a company's firewall. The central repository is automatically configured after installation. You can add additional repositories in settings.xml , for example: <?xml version="1.0" encoding="UTF-8"?> <setting......
Created by alfa on July 08, 2011 08:58:12    Last update: July 08, 2011 08:58:42
By Java documentation , java.endorsed.dirs is used to provide an Endorsed Standards Override Mechanism . Which means, a user can provide newer versions of certain packages than those provided by the JDK. If there are newer implementations of these packages in the directories specified by java.endorsed.dirs , those implementations will be loaded instead of the default ones that come with the JDK. The packages that can be overriden this way are grouped into Endorsed Standards APIs and Standalone Technologies , and are listed in the Java documentation . Roughly speaking the Endorsed Standards APIs include: javax.rmi.CORBA various org.omg.* packages org.w3c.dom various org.xml.sax.* packages Standalone Technologies include: Java API for XML Processing (JAXP), version 1.4 Java Architecture for XML Binding (JAXB), version 2.0 Java API for...
Created by alfa on June 03, 2011 09:41:03    Last update: June 03, 2011 09:41:03
Dynamic proxy can be used to eliminate the need to stub out unused interface methods. This is an example for a simple SAX content handler for XML parsing. The org.xml.sax.ContentHandler interface requires 11 methods be implemented but we only need three: import java.io.IOException; import java.util.Ar... With a dynamic proxy, we don't need the empty blocks for the unused methods: import java.io.IOException; import java.util.Ar... Equivalently (with anonymous inner class): import java.io.IOException; import java.util.Ar... demo.xml : <breakfast-menu> <food> <name>Belgian W...
Created by alfa on May 27, 2011 11:19:29    Last update: May 31, 2011 07:56:26
This is a utility to convert a string value to one of the primitive type values. It is useful in Java reflection code where the value comes in as a string (e.g., from XML parsing), and the type of the value cannot be decided until runtime. import java.util.*; import java.lang.reflect.*;... Note: This method can be extended to convert string to more complex types by writing a converter for the destination type. For example, to convert string to date: public class DateConverter { public static ... Usage: Date d = (Date) ConvertUtil.convert("10/12/2010", ...
Created by freyo on May 23, 2011 14:30:18    Last update: May 23, 2011 14:31:08
There are two distinct ways to process XPath: with namespace and without namespace. The code is different depending on whether the parser is namespace aware. Code without namespace: import java.io.*; import javax.xml.parsers.*; ... code with namespace: import java.io.*; import java.util.Iterator; ... XML without namespace: <?xml version="1.0" encoding="UTF-8" standalone="n... XML with namespace: <?xml version="1.0" encoding="UTF-8" standalone="n... The same XPath expression works for both XML files when the parser is not namespace aware. When the parser is namespace aware, you have to adjust the XPath accordingly depending on whether the XML has namespace declarations: " /test-license/licensee/name/text() " works for the XML file without namespace, while " /p:test-license/p:licensee/p:name/text() " works for the XML file with namespace.
Created by freyo on April 18, 2011 14:14:29    Last update: April 18, 2011 14:15:48
For XML resources, Android returns an XmlPullParser reference. I tried the RSSReader example from xmlpull.org , it failed both on the Android emulator and with xpp3-1.1.4c . This is an example for XmlPullParser usage. Since the XmlPullParser is event based, a callback mechanism works better. Java code: import java.io.*; import java.net.*; import ... The XML file used: <?xml version="1.0" encoding="UTF-8"?> <catalog...
Previous  1 2 3 Next