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 Dr. Xi on March 21, 2013 20:29:14 Last update: March 22, 2013 08:58:08
Spring-WS documentation says you can use a Jaxb object as parameter or return type, provided that it is annotated with javax.xml.bind.annotation.XmlRootElement , or is an instance of javax.xml.bind.JAXBElement . But that's a lot easier said than done! For example, if sayHelloResponse is defined as:
<xs:element name="sayHelloResponse" type="tns:sayH...then the JAXB generated class is not annotated with XmlRootElement , therefore, unusable for Spring-WS. You have to define the type as:
<xs:element name="sayHelloResponse"> <xs:compl...in order to generate a type annotated with XmlRootElement . But that is not always possible. Alternatively, you can use the Maven plugin maven-jaxb2-plugin with the jaxb2-basics-annotate plugin (yes, plugin inside plugin) to inject the XmlRootElement annotation into the generated JAXB class. This is the pom:
<project xmlns="http://maven.apache.org/POM/4.0.0"...and the binding file:
<?xml version="1.0" encoding="UTF-8" standalone="y......
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="http://maven.apache.org/POM/4.0.0"...Create the web service interface ( src/main/java/jaxws/JaxwsHello.java ):
package jaxws; import javax.jws.WebService;...Implement the web service ( src/main/java/jaxws/JaxwsHelloImpl.java ):
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 packageThe resulting WAR file can be deployed to any servlet container (for example, Tomcat).
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 venky on March 05, 2012 13:36:41 Last update: March 05, 2012 13:36:41
Thanks Dr.Xi, I was having a tough time changing the deployment context path of my web-app using the so-called context.xml file under /META-INF, it dint work (tomcat documentation at http://tomcat.apache.org/tomcat-6.0-doc/config/context.html , seemed pretty sure it would :() But I have one question, as changing server.xml is too instrusive for every web-app you build, is there any other way of pushing this configuration to one of the application specific files ? thanks, Venky
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 10, 2010 00:19:30 Last update: January 31, 2012 16:28:42
Maven is a powerful yet complex tool. When I started learning Maven, the first obstacle was, of course, its complexity. The second, was the lack of documentation that can get me off the ground quickly. This tutorial is an attempt to create a pragmatic guide that aims to get you familiar with Maven in the quickest way possible. The main theme is to get you on some hands on experience to start out and lead you through the creation of a simple Java EE project as quickly as possible. Instead of trying to give you a good read, I try to get you on the journey right away. The topics are roughly ordered by the logical sequence but you can jump around in any way...
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...