Doorgaan naar hoofdcontent

Posts

Posts uit juni, 2015 tonen

UTF codepoints in Java

So, we needed to do some UTF-8 code matchings. And someone grabbed the proper UTF-8 document and was talking code points. And then you notice that java 7 has no nice way to determine code points... *really*, it's only been 7 versions and it's still not well. At least, a snippet to show the proper code point:     public static String printCharacters(final String s) {         for (final int codepoint : codePoints(s)) {             // we need Character.toChars and new String since we cannot call back to the specific character from the string from the iterator.              System.out.println(new String(Character.toChars(codepoint)) + "is of type: "+ typeToString(Character.getType(codepoint));         }     }     /** java 7 doesn't have a nice support for determining code points. Java 8 does... */     publ...

Spring-ws and spring-mvc combined

Sometimes we want to use both spring-ws and spring-mvc in one application. However, these are two different stacks. To use them combined is a bit of a hassle, and... lest I forget, this post. The following needs to be set in the applicationcontext: <!-- To nicely support webservices from httprequests, we use the WebServiceMessageReceiverHandlerAdapter (which needs a messagefactory) --> <!-- Because we declare this, the dispatcherservlet automatically uses it... instead of the normal mvc adapter! --> <!-- To ensure that the normal mvc adapter is also loaded, we need to define it (the SimpleControllerHandlerAdapter) as well. --> <!-- Requires a message factory so we declare one --> <bean class="org.springframework.ws.transport.http.WebServiceMessageReceiverHandlerAdapter">   <property name="messageFactory" ref="messageFactory" /> </bean> <bean id="messageFactory" class="org.springframework.ws....