Notes by Fang
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 Fang on July 25, 2012 12:59:47
Last update: July 25, 2012 12:59:47
Example code:
import javax.xml.ws.BindingProvider;
import jav...
Wierdly, even though the response context ( ctx ) itself is a Map, you cannot iterate through the keys. This:
for (String key: ctx.keySet()) {
logger.inf...
fails:
WARN : InternalError - Handler execution resulted ...
Created by Fang on March 16, 2012 12:35:26
Last update: March 16, 2012 12:35:26
To programmatically resolve a spring message:
// import org.springframework.web.servlet.support....
Created by Fang on March 15, 2012 10:24:35
Last update: March 15, 2012 10:24:35
Suppose that I have an email field annotated with:
@NotEmpty(message="Please enter email address")
...
Bean validation will trigger two errors when no email address is entered:
the email field is empty
an empty email field is not a valid email address
Displaying both errors to the user with <form:errors> would be redundant and confusing:
<%@ taglib uri="http://www.springframework.org/tag...
This is how to display the first error only:
<spring:bind path="emailAddress">
<c:if test="$...
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 Fang on March 01, 2012 13:52:14
Last update: March 01, 2012 13:52:14
Step 1: define the message code:
code.with.arg=arg1: {0}, arg2: {1}, arg3: {2}
Step 2: use it in the JSP with comma separated arguments:
<%@ taglib uri="http://www.springframework.org/tag...
If the argument itself contains a comma:
<%@ taglib uri="http://www.springframework.org/tag...
Created by Fang on February 08, 2012 21:21:01
Last update: February 08, 2012 21:21:17
Just a reminder that I got this error when I set the Java system property javax.net.ssl.trustStore to a non-existing file (typo). The full error message when running Maven was:
[ERROR] java.lang.RuntimeException: Unexpected e...
Created by Fang on February 08, 2012 21:15:00
Last update: February 08, 2012 21:15:00
This was the error message:
[ERROR] sun.security.validator.ValidatorExceptio...
The certificate was actually signed by Verisign, but somehow failed to pass Java cert validation.
To resolve the problem:
Download the cert from the server (with RetrieveSSLCert , for example)
Import the certificate into the keystore:
$ keytool -import -trustcacerts -alias myserver -f...
Define MAVEN_OPTS :
$ export MAVEN_OPTS='-Djavax.net.ssl.trustStore=/h...
The quotes must exist for the value of MAVEN_OPTS , and the path must be absolute ( ~/etc/mavenKeyStore.jks does not work).
Created by Fang on January 04, 2012 11:44:15
Last update: January 04, 2012 11:44:15
With this markup:
<h:outputText value="#{msg.name}:"/>
<h:inputTe...
the validation message looks like this:
j_id1283414979_4c7f5b98:name: size must be between...
Add label attribute to get rid of the ugly field name:
<h:outputText value="#{msg.name}:"/>
<h:inputTe...
Created by Fang on January 04, 2012 11:14:46
Last update: January 04, 2012 11:14:46
Assume that your messages are defined in MessageResources.properties , this is how you load and use the messages:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Stric...
In MessageResources.properties :
pageTitle = JSF Resource Bundle Example
page.he...