Recent Notes

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-sources Code 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 package After the webapp is deployed (Tomcat running on port 8080), the web service (WSDL) is available via...
Created by Fang on January 04, 2013 08:00:37    Last update: January 04, 2013 08:00:37
This is a Maven POM that prints out some built-in project properties: <project xmlns="http://maven.apache.org/PO... Output: $ mvn validate [INFO] Scanning for projects.....
Created by zhidao on August 09, 2012 14:44:08    Last update: August 09, 2012 14:44:08
Create a directory src/jaxws alongside src/main and create a bindings file bindingx.xml with the <serializable> customization: <jaxb:bindings xmlns:jaxb="http://java.sun.... Reference : JAX-WS wsimport Maven plugin documentation
Created by Fang on March 05, 2012 20:11:56    Last update: March 05, 2012 20:11:56
This is a bare bones Maven project to get started with Java JSR 303 bean validation. Directory structure: ./pom.xml ./src ./src/main ./src/main/jav... pom.xml : <project xmlns="http://maven.apache.org/POM/4.0.0"... which includes dependencies on JUnit, Java bean validation API and the Hibernate validator reference implementation.
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 package The resulting webapp is target/springmvc.war .
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 install To use it as a dependency in other Maven projects: <dependency> <groupId>tag-demo</groupId> ...
Created by nogeek on December 29, 2011 13:31:44    Last update: December 29, 2011 14:29:13
Tomcat allows you to create multiple server instances for the same installation. The installation directory is identified as CATALINA_HOME , the instance directory is identified as CATALINA_BASE . Here are the steps: Create a base directory for the new instance, for example: /home/nogeek/tomcat1 . Create the subdirectories: mkdir -p /home/nogeek/tomcat/{bin,conf,logs,temp,w... Copy web.xml from the installation directory: cp $CATALINA_HOME/conf/web.xml /home/nogeek/tomcat... Copy logging.properties from the installation directory: cp $CATALINA_HOME/conf/logging.properties /home/no... Create server.xml under tomcat1/conf : <?xml version='1.0' encoding='utf-8'?> <Server ... Create script setenv.sh under tomcat1/bin : # Edit this file to set custom options # Tomcat... Copy startup.sh and shutdown.sh from the installation directory. Add the following two lines to the beginning of each: CATALINA_BASE=/home/nogeek/tomcat1 export CATAL... Create a soft link for catalina.sh in tomcat1/bin : $ ln -s ~/apache-tomcat-7.0.22/bin/catalina.sh cat...
Created by Fang on September 07, 2009 20:44:15    Last update: November 03, 2011 14:43:19
Step 1: Repackage a web app as EAR A Java EE application is a multimodule Maven project. At the very least you'll need to package a WAR and an EAR. To get started, I'll simply re-package the simple webapp as an EAR. Create a directory named javaee-app Copy the webapp from here to javaee-app . Rename struts1app to webapp . Create pom.xml under javaee-app : <project> <modelVersion>4.0.0</modelVersion>... Create a directory named ear under javaee-app . Create pom.xml under ear : <project> <modelVersion>4.0.0</modelVersion>... Modify pom.xml in the webapp directory so that it looks like this: <project> <modelVersion>4.0.0</modelVersion> ... Build with " mvn package " in the javaee-app directory. You can see that ear-1.0.ear is successfully generated in javaee-app/ear/target . Maven successfully resolves dependencies between the sub-projects....
Created by Fang on October 30, 2011 20:35:17    Last update: October 30, 2011 20:37:03
This note lists some of the different behaviors I found using different JSF implementations. In the simple JSF facelet example, I used Sun's reference implementation version 2.0.0-RC: <dependency> <groupId>javax.faces</gro... With this version, the DOCTYPE declaration is dropped when the page is rendered. It doesn't matter what DOCTYPE you declare in your templates, the facelet engine simply drops it. The problem with this is, your page is always displayed in quirks mode , despite your intentions to require standards compliant mode. The DOCTYPE problem is fixed in release 2.0.2-FCS . Change the dependency in pom.xml to: <dependency> <groupId>javax.faces</gro... and test again, you'll find that DOCTYPE is faithfully passed over to the browser (view source at browser). You can delete the DOCTYPE declaration in the xhtml template...
Created by freyo on September 07, 2011 16:46:14    Last update: September 07, 2011 19:23:00
The Android unit test framework is based on JUnit 3 , not JUnit 4. Test cases have to extend junit.framework.TestCase or a subclass (such as android.test.InstrumentationTestCase ). Tests are identified by public methods whose name starts with test , not methods annotated with @Test (as in JUnit 4). An Android test suite is packaged as an APK, just like the application being tested. To create a test package, first you need to identify the application package it is testing. Google suggests to put the test package source in a directory named tests/ alongside the src/ directory of the main application. At runtime, Android instrumentation loads both the test package and the application under test into the same process. Therefore, the tests can invoke methods on...
Previous  1 2 3 Next