Recent Notes

Displaying keyword search results 1 - 8
Created by Dr. Xi on March 22, 2013 12:18:39    Last update: March 22, 2013 12:18:39
This is a step-by-step guide to create a "contract-first" web service with Apache CXF. It's a lot easier than doing the same thing with Spring-WS. The project uses standard Maven directory layout. Define the data types ( src/main/resources/hello.xsd ): <xs:schema xmlns:xs=" Define the service ( src/main/resources/hello.wsdl ): <?xml version='1.1' encoding='UTF-8'?> <wsdl:de... Create pom.xml : <project xmlns=" Generate jaxb bindings: $ mvn generate-sources Code the web service ( src/main/java/com/example/cxfdemo/ ): package com.example.cxfdemo; import javax.j... Declare the CXF servlet in web.xml ( src/main/webapp/WEB-INF/web.xml ): <?xml version="1.0" encoding="UTF-8"?> <web-app... Wire up the web service implementation ( src/main/webapp/WEB-INF/cxf-servlet.xml ): <?xml version="1.0" encoding="UTF-8"?> <beans x... Build the WAR: $ mvn clean package After the webapp is deployed (Tomcat running on port 8080), the web service (WSDL) is available via...
Created by Dr. Xi on March 07, 2013 20:26:23    Last update: March 07, 2013 20:26:23
Create a jax-ws web service with Spring, Apache CXF and Maven. Create the pom.xml : <project xmlns=""... Create the web service interface ( src/main/java/jaxws/ ): package jaxws; import javax.jws.WebService;... Implement the web service ( src/main/java/jaxws/ ): package jaxws; import javax.jws.WebService;... Create src/main/webapp/WEB-INF/cxf-servlet.xml : <?xml version="1.0" encoding="UTF-8"?> <beans x... Register the CXF servlet in src/main/webapp/WEB-INF/web.xml : <?xml version="1.0" encoding="UTF-8"?> <web-app... Build: mvn package The resulting WAR file can be deployed to any servlet container (for example, Tomcat).
Created by Fang on February 23, 2012 14:25:57    Last update: March 01, 2012 13:53:59
Some example snippets for Spring message configuration and usage. To configure a message source in Spring context (basename=messages): <bean id="messageSource" class="org.springf... Locale change interceptor can also be setup with: <?xml version="1.0" encoding="UTF-8"?> <beans x... The messages file should be named (or , etc.) and located on CLASSPATH , for example: WEB-INF/classes . To use a message resource in JSP: <%@ taglib prefix="spring" uri="http://www.springf...
Created by nogeek on December 29, 2011 13:31:44    Last update: December 29, 2011 14:29:13
Tomcat allows you to create multiple server instances for the same installation. The installation directory is identified as CATALINA_HOME , the instance directory is identified as CATALINA_BASE . Here are the steps: Create a base directory for the new instance, for example: /home/nogeek/tomcat1 . Create the subdirectories: mkdir -p /home/nogeek/tomcat/{bin,conf,logs,temp,w... Copy web.xml from the installation directory: cp $CATALINA_HOME/conf/web.xml /home/nogeek/tomcat... Copy from the installation directory: cp $CATALINA_HOME/conf/ /home/no... Create server.xml under tomcat1/conf : <?xml version='1.0' encoding='utf-8'?> <Server ... Create script under tomcat1/bin : # Edit this file to set custom options # Tomcat... Copy and from the installation directory. Add the following two lines to the beginning of each: CATALINA_BASE=/home/nogeek/tomcat1 export CATAL... Create a soft link for in tomcat1/bin : $ ln -s ~/apache-tomcat-7.0.22/bin/ cat...
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 freyo on May 13, 2011 15:45:29    Last update: September 20, 2011 08:08:12
This is an Android app that dumps any binarized xml file as plain text - to the sdcard on the device or emulator. build.xml : <?xml version="1.0" encoding="UTF-8"?> <project... AndroidManifest.xml <?xml version="1.0" encoding="utf-8"?> <man... res/layout/main.xml <?xml version="1.0" encoding="utf-8"?> <Lin... res/values/strings.xml : <?xml version="1.0" encoding="utf-8"?> <res... src/com/android/xmltool/ package; import java.ut... Screenshot Pre-built APK can be downloaded from:
Created by Fang on September 07, 2009 16:39:37    Last update: September 07, 2009 18:43:04
It's easiest to use the archetype plugin to start a new Maven project. I'll use struts 1 as example since it's not in the built-in archetypes for archetype:generate . Generate a simple webapp with archetype:generate : C:\work\maven>mvn archetype:generate -DarchetypeAr... It generates a directory structure like this: struts1app struts1app/pom.xml struts1app/src... with a simple POM: <project xmlns=""... Create settings.xml in $HOME/.m2 , add repository for Java EE dependencies: <?xml version="1.0" encoding="UTF-8"?> <setting... Add Java EE and Struts dependencies in pom.xml . Note that the Java EE dependency has scope provided , meaning that the web app container provides the jars, therefore we don't need to bundle them with our war fie. <project xmlns=""... Create a directory named java under main , create the Struts form and...
Created by Dr. Xi on September 15, 2008 18:32:17    Last update: September 15, 2008 18:43:18
You can use the target attribute of the javac task to specify the target VM version for the generated classes. <target name="compile" depends="init"> <ech... Since Ant 1.7, you can specify default values for source and target by defining the and properties.