Displaying keyword search results 1 - 10
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="http://www.w3.org/200...Define the service ( src/main/resources/hello.wsdl ):
<?xml version='1.1' encoding='UTF-8'?> <wsdl:de...Create pom.xml :
<project xmlns="http://maven.apache.org/POM/4....Generate jaxb bindings:
$ mvn generate-sourcesCode the web service ( src/main/java/com/example/cxfdemo/HelloPortImpl.java ):
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 packageAfter the webapp is deployed (Tomcat running on port 8080), the web service (WSDL) is available via...
Created by Fang on March 30, 2012 10:07:25 Last update: March 08, 2013 13:41:57
After a user resets a password, I want to force the user to change the password before she gets access to secured content. This is usually done with a servlet filter. But with Spring MVC, you can also use a HandlerInterceptor . According to Spring JavaDoc: HandlerInterceptor is basically similar to a Servlet 2.3 Filter, but in contrast to the latter it just allows custom pre-processing with the option of prohibiting the execution of the handler itself, and custom post-processing. Filters are more powerful, for example they allow for exchanging the request and response objects that are handed down the chain. Note that a filter gets configured in web.xml, a HandlerInterceptor in the application context. As a basic guideline, fine-grained handler-related preprocessing tasks are candidates...
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 March 01, 2013 16:09:00 Last update: March 04, 2013 12:28:23
This is probably the easiest way to create a web service in JAX-WS. There are no external dependencies other than Java EE. Assuming that you build the web service as a webapp (say jaxws-example.war), the pom.xml can be as simple as:
<project xmlns="http://maven.apache.org/POM/4.0.0"...You can implement and deploy the web service in 3 easy steps: Code the service as a POJO (annotate class to expose it as a web service)
package jaxws; import javax.jws.WebMethod; ...Declare the POJO as a servlet in WEB-INF/web.xml :
<?xml version="1.0" encoding="UTF-8"?> <web-app...Build the webapp, and deploy the resulting war:
mvn packageThe only catch is, this only works for a Java EE 5+ compliant container such as WebLogic or JBoss. It does not work for a simple servlet...
Created by freyo on February 06, 2013 21:10:47 Last update: February 06, 2013 21:12:18
I have an old Samung phone to be used as a toy. After restoring back to factory image and power on, I was stuck at the activate service screen. Unfortunately, the four corner magic touch did not work. So I did quite a bit of digging and this is what worked on my Samsung Continuum: Press emergency call button, then at the dialer, press * # 8 3 7 8 6 6 3 3 , press the Home key From the home screen, tap phone icon, Dial * # 2 2 7 4 5 9 2 7 Enter SPC code: ______ displays tap in white box to show virtual keyboard, enter 6 digit code (default: 000000), tap OK Select “Hidden menu Enable”, tap OK From...
java.lang.ClassCastException: org.hibernate.type.StringType cannot be cast to org.hibernate.type.VersionType
Created by Fang on January 14, 2013 14:00:36 Last update: January 14, 2013 14:00:36
Cause: Hibernate reverse engineering generated a column mapping like this:
@Version @Column(name="VERSION", nullable=false...Fix: change the mapping to:
@Column(name="VERSION", length=20) public Strin...
Created by Fang on January 04, 2013 14:16:58 Last update: January 04, 2013 14:16:58
Junit does not support specifying execution order of tests until 4.11. The methods were simply invoked in the order returned by the reflection API. So, the tests are executed in a unspecified but deterministic order, i.e., you have no control over the order of execution, but if you repeat the tests, they are run in the same sequence each time. For version 4.11, you can specify the order with the FixMethodOrder annotation:
import org.junit.runners.MethodSorters; imp...From the release notes : Test execution order By design, JUnit does not specify the execution order of test method invocations. Until now, the methods were simply invoked in the order returned by the reflection API. However, using the JVM order is unwise since the Java platform does not specify...
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 Dr. Xi on October 08, 2012 11:56:29 Last update: October 08, 2012 11:56:29
This example gets the annotation attributes of of a web service client generated by JAX-WS RI. The generated web service client looks like this:
import javax.xml.ws.Service; import javax.xml.w...This is how to get the attributes for annotation @WebServiceClient :
WebServiceClient wsc = MyTestWebService.class.getA...Note that even though name , targetNamespace and wsdlLocation are attributes, you get them using a method call. Also, annotations are available at runtime only when they have RetentionPolicy.RUNTIME .
Created by Dr. Xi on August 15, 2012 12:05:39 Last update: August 15, 2012 12:05:39
Use OpenSSL's s_client command to fetch a page manually:
$ openssl s_client -connect localhost:443 -state -...Sample session for Google:
$ openssl s_client -connect www.google.com:443 -st...Resource: SSL/TLS Strong Encryption: FAQ