Displaying keyword search results 1 - 10
Created by Dr. Xi on March 21, 2013 19:47:46 Last update: March 22, 2013 12:30:27
It's normal practice to import types from an external xsd file in WSDL like this:
<wsdl:types> <xsd:schema xmlns:xsd="htt...When you use <dynamic-wsdl> and have Commons XMLSchema on the class path, Spring-WS inlines the xsd in the wsdl. But that doesn't happen when you use <static-wsdl> . You can define a SimpleXsdSchema bean to expose the xsd:
Created by Fang on January 04, 2013 09:02:44 Last update: January 04, 2013 09:02:44
This snippet sets system properties from Maven surefire test plugin. This is useful when you want to set logging (for example, log4j) properties based on Maven project properties. Example that sets system property testlog.dir :
<plugins> <plugin> <groupId>org.apach...Example log4j.xml that uses system property testlog.dir :
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYP...
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 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 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 messages.properties (or messages_en.properties , 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 James on February 02, 2012 16:00:15 Last update: February 02, 2012 16:00:15
Video for Everybody seems to be a generic way to embed video in a web page, even without flash. This code snippet comes from that site.
<!-- first try HTML5 playback: if serving as XML, ...
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 Fang on January 31, 2012 15:40:34 Last update: January 31, 2012 15:41:28
This is a simple Hello World application with Spring 3 MVC. Like the default Apache HTTPd welcome page, it displays " It works! " when successfully deployed. The sole purpose is to show the minimum elements needed to setup Spring 3 MVC. I use Maven since it's so much easier than downloading the dependencies manually. Directory layout:
./src ./src/main ./src/main/webapp ./src/...pom.xml :
<?xml version="1.0" encoding="UTF-8"?> <project...WEB-INF/web.xml :
<?xml version="1.0" encoding="UTF-8"?> <web-app...WEB-INF/applicationContext.xml (empty, but needed):
<?xml version="1.0" encoding="UTF-8"?> <beans x...WEB-INF/spring-servlet.xml :
<?xml version="1.0" encoding="UTF-8"?> <beans x...WEB-INF/jsp/home.jsp :
<!DOCTYPE html> <html> <head> <title>H...Build with:
mvn clean packageThe resulting webapp is target/springmvc.war .
Created by Fang on January 31, 2012 13:57:56 Last update: January 31, 2012 15:04:29
These are the minimum steps to configure Spring MVC in web.xml : Bootstrap Spring MVC by registering ContextLoaderListener :
<listener> <listener-class> org.springfra...Register the DispatcherServlet :
<servlet> <servlet-name>spring</servlet-name> ...Add servlet-mapping :
<servlet-mapping> <servlet-name>spring</servle...Configure DispatcherServlet with WEB-INF/spring-servlet.xml , which configures WebApplicationContext specific to this servlet.
<?xml version="1.0" encoding="UTF-8"?> <beans x...Optionally, use context-param in web.xml to configure the global WebApplicationContext :
<!-- XmlWebApplicationContext is the default, so t...If you omit this section, you have to create file WEB-INF/applicationContext.xml , even if it's empty. This is the full web.xml :
<?xml version="1.0" encoding="UTF-8"?> <web-app...
Created by Fang on January 28, 2012 13:24:09 Last update: January 28, 2012 13:31:22
This is a simple JSP custom tags library with tag body. Just like the JSF counterpart , it splits a string and repeats the body for each word, i.e., with this markup:
<%@ taglib uri="http://custom.tag.com/demo" prefix...output:
<html> <body> <p>Hello Tigger!</p> <p>H...With Maven, this is the directory structure:
./src ./src/main ./src/main/resources ./s...There are three files to write: pom.xml :
<project xmlns="http://maven.apache.org/POM/4.0.0"...src/main/java/tagdemo/IterateTag.java :
package tagdemo; import java.io.IOException...src/main/resources/META-INF/demotag.tld :
<?xml version="1.0" encoding="UTF-8"?> <!DO...Build with:
mvn clean installTo use it as a dependency in other Maven projects:
<dependency> <groupId>tag-demo</groupId> ...