Index: src/test/java/com/sun/jersey/samples/helloworld/HelloWorldWebAppTest.java =================================================================== --- src/test/java/com/sun/jersey/samples/helloworld/HelloWorldWebAppTest.java (revision 5164) +++ src/test/java/com/sun/jersey/samples/helloworld/HelloWorldWebAppTest.java (working copy) @@ -44,6 +44,7 @@ import com.sun.jersey.core.header.MediaTypes; import com.sun.jersey.test.framework.JerseyTest; import com.sun.jersey.test.framework.WebAppDescriptor; +import java.util.HashMap; import org.junit.Assert; import org.junit.Test; @@ -55,7 +56,9 @@ public HelloWorldWebAppTest() throws Exception { - super(new WebAppDescriptor.Builder("com.sun.jersey.samples.helloworld.resources") + super(new WebAppDescriptor.Builder( + new HashMap() {{put("javax.ws.rs.Application", "com.sun.jersey.samples.helloworld.resources.MyApplication"); + put("com.sun.jersey.spi.container.ContainerRequestFilters", "com.sun.jersey.api.container.filter.LoggingFilter");}}) .contextPath("helloworld-webapp").build()); } @@ -71,6 +74,13 @@ } @Test + public void testHeader() throws Exception { + WebResource webResource = resource(); + String responseMsg = webResource.path("helloworld/header").header("appKey", "appKeyVal").get(String.class); + Assert.assertEquals("appKeyVal", responseMsg); + } + + @Test public void testApplicationWadl() { WebResource webResource = resource(); String serviceWadl = webResource.path("application.wadl"). Index: src/main/java/com/sun/jersey/samples/helloworld/resources/HelloWorldResource.java =================================================================== --- src/main/java/com/sun/jersey/samples/helloworld/resources/HelloWorldResource.java (revision 5164) +++ src/main/java/com/sun/jersey/samples/helloworld/resources/HelloWorldResource.java (working copy) @@ -41,8 +41,10 @@ package com.sun.jersey.samples.helloworld.resources; import javax.ws.rs.GET; +import javax.ws.rs.HeaderParam; import javax.ws.rs.Produces; import javax.ws.rs.Path; +import javax.ws.rs.core.MediaType; // The Java class will be hosted at the URI path "/helloworld" @Path("/helloworld") @@ -57,4 +59,11 @@ // Return some cliched textual content return "Hello World"; } + + @GET + @Path("header") + @Produces(MediaType.TEXT_PLAIN) + public String getHeader(@HeaderParam("appKey") String appKey) { + return appKey; + } } \ No newline at end of file Index: src/main/webapp/WEB-INF/web.xml =================================================================== --- src/main/webapp/WEB-INF/web.xml (revision 5164) +++ src/main/webapp/WEB-INF/web.xml (working copy) @@ -49,6 +49,10 @@ javax.ws.rs.Application com.sun.jersey.samples.helloworld.resources.MyApplication + + com.sun.jersey.spi.container.ContainerRequestFilters + com.sun.jersey.api.container.filter.LoggingFilter + 1