Modified: cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/JAXRSUtilsTest.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/JAXRSUtilsTest.java?rev=833112&r1=833111&r2=833112&view=diff==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/JAXRSUtilsTest.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/JAXRSUtilsTest.java Thu Nov 5 18:22:51 2009
@@ -95,14 +95,14 @@
sf.create();
List<ClassResourceInfo> resources = ((JAXRSServiceImpl)sf.getService()).getClassResourceInfos();
MultivaluedMap<String, String> map = new MetadataMap<String, String>();
- ClassResourceInfo bStore = JAXRSUtils.selectResourceClass(resources, "/bookstore", map);
+ ClassResourceInfo bStore = JAXRSUtils.selectResourceClass(resources, "/bookstore", map, null);
assertEquals(bStore.getResourceClass(), org.apache.cxf.jaxrs.resources.BookStore.class);
- bStore = JAXRSUtils.selectResourceClass(resources, "/bookstore/", map);
+ bStore = JAXRSUtils.selectResourceClass(resources, "/bookstore/", map, null);
assertEquals(bStore.getResourceClass(),
org.apache.cxf.jaxrs.resources.BookStore.class);
- bStore = JAXRSUtils.selectResourceClass(resources, "/bookstore/bar", map);
+ bStore = JAXRSUtils.selectResourceClass(resources, "/bookstore/bar", map, null);
assertEquals(bStore.getResourceClass(),
org.apache.cxf.jaxrs.resources.BookStoreNoSubResource.class);
}
@@ -115,18 +115,18 @@
sf.create();
List<ClassResourceInfo> resources = ((JAXRSServiceImpl)sf.getService()).getClassResourceInfos();
MultivaluedMap<String, String> map = new MetadataMap<String, String>();
- ClassResourceInfo bStore = JAXRSUtils.selectResourceClass(resources, "/1", map);
+ ClassResourceInfo bStore = JAXRSUtils.selectResourceClass(resources, "/1", map, null);
assertEquals(bStore.getResourceClass(), org.apache.cxf.jaxrs.resources.TestResourceTemplate1.class);
- bStore = JAXRSUtils.selectResourceClass(resources, "/1/", map);
+ bStore = JAXRSUtils.selectResourceClass(resources, "/1/", map, null);
assertEquals(bStore.getResourceClass(),
org.apache.cxf.jaxrs.resources.TestResourceTemplate1.class);
- bStore = JAXRSUtils.selectResourceClass(resources, "/1/foo", map);
+ bStore = JAXRSUtils.selectResourceClass(resources, "/1/foo", map, null);
assertEquals(bStore.getResourceClass(),
org.apache.cxf.jaxrs.resources.TestResourceTemplate2.class);
- bStore = JAXRSUtils.selectResourceClass(resources, "/1/foo/bar", map);
+ bStore = JAXRSUtils.selectResourceClass(resources, "/1/foo/bar", map, null);
assertEquals(bStore.getResourceClass(),
org.apache.cxf.jaxrs.resources.TestResourceTemplate2.class);
}
@@ -139,10 +139,10 @@
sf.create();
List<ClassResourceInfo> resources = ((JAXRSServiceImpl)sf.getService()).getClassResourceInfos();
MultivaluedMap<String, String> map = new MetadataMap<String, String>();
- ClassResourceInfo bStore = JAXRSUtils.selectResourceClass(resources, "/", map);
+ ClassResourceInfo bStore = JAXRSUtils.selectResourceClass(resources, "/", map, null);
assertEquals(bStore.getResourceClass(), org.apache.cxf.jaxrs.resources.TestResourceTemplate3.class);
- bStore = JAXRSUtils.selectResourceClass(resources, "/test", map);
+ bStore = JAXRSUtils.selectResourceClass(resources, "/test", map, null);
assertEquals(bStore.getResourceClass(),
org.apache.cxf.jaxrs.resources.TestResourceTemplate4.class);
@@ -971,24 +971,25 @@
md.bind(ori2, Customer.class.getMethod("getItPlain", new Class[]{}));
cri.setMethodDispatcher(md);
- OperationResourceInfo ori = JAXRSUtils.findTargetMethod(cri, "/", "GET",
- new MetadataMap<String, String>(), "*/*", getTypes("text/plain"));
+ OperationResourceInfo ori = JAXRSUtils.findTargetMethod(cri, null, "GET",
+ new MetadataMap<String, String>(), "*/*", getTypes("text/plain"), true);
assertSame(ori, ori2);
- ori = JAXRSUtils.findTargetMethod(cri, "/", "GET", new MetadataMap<String, String>(),
- "*/*", getTypes("text/xml"));
+ ori = JAXRSUtils.findTargetMethod(cri, null, "GET", new MetadataMap<String, String>(),
+ "*/*", getTypes("text/xml"), true);
assertSame(ori, ori1);
- ori = JAXRSUtils.findTargetMethod(cri, "/", "GET", new MetadataMap<String, String>(),
+ ori = JAXRSUtils.findTargetMethod(cri, null, "GET", new MetadataMap<String, String>(),
"*/*",
- JAXRSUtils.sortMediaTypes(getTypes("*,text/plain,text/xml")));
+ JAXRSUtils.sortMediaTypes(getTypes("*,text/plain,text/xml")), true);
assertSame(ori, ori2);
- ori = JAXRSUtils.findTargetMethod(cri, "/", "GET", new MetadataMap<String, String>(),
+ ori = JAXRSUtils.findTargetMethod(cri, null, "GET", new MetadataMap<String, String>(),
"*/*",
- JAXRSUtils.sortMediaTypes(getTypes("*,text/plain, text/xml,x/y")));
+ JAXRSUtils.sortMediaTypes(getTypes("*,text/plain, text/xml,x/y")),
+ true);
assertSame(ori, ori2);
}
@@ -1350,12 +1351,12 @@
String requestContentType,
List<MediaType> acceptContentTypes) {
- ClassResourceInfo resource = JAXRSUtils.selectResourceClass(resources, path, values);
+ ClassResourceInfo resource = JAXRSUtils.selectResourceClass(resources, path, values,
+ new MessageImpl());
if (resource != null) {
- String subResourcePath = values.getFirst(URITemplate.FINAL_MATCH_GROUP);
- OperationResourceInfo ori = JAXRSUtils.findTargetMethod(resource, subResourcePath, httpMethod,
- values, requestContentType, acceptContentTypes);
+ OperationResourceInfo ori = JAXRSUtils.findTargetMethod(resource, null, httpMethod,
+ values, requestContentType, acceptContentTypes, true);
if (ori != null) {
return ori;
}
Modified: cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java?rev=833112&r1=833111&r2=833112&view=diff==============================================================================
--- cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java (original)
+++ cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java Thu Nov 5 18:22:51 2009
@@ -86,6 +86,7 @@
public static final String PARTIAL_RESPONSE = AbstractMultiplexDestination.class.getName()
+ ".partial.response";
public static final String RESPONSE_COMMITED = "http.response.done";
+ public static final String REQUEST_REDIRECTED = "http.request.redirected";
private static final Logger LOG = LogUtils.getL7dLogger(AbstractHTTPDestination.class);
@@ -447,6 +448,9 @@
protected OutputStream flushHeaders(Message outMessage) throws IOException {
+ if (isResponseRedirected(outMessage)) {
+ return null;
+ }
updateResponseHeaders(outMessage);
Object responseObj = outMessage.get(HTTP_RESPONSE);
OutputStream responseStream = null;
@@ -498,6 +502,10 @@
return responseStream;
}
+ private boolean isResponseRedirected(Message outMessage) {
+ return Boolean.TRUE.equals(outMessage.get(REQUEST_REDIRECTED));
+ }
+
/**
* Backchannel conduit.
*/
Modified: cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/AbstractHTTPServlet.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/AbstractHTTPServlet.java?rev=833112&r1=833111&r2=833112&view=diff==============================================================================
--- cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/AbstractHTTPServlet.java (original)
+++ cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/AbstractHTTPServlet.java Thu Nov 5 18:22:51 2009
@@ -19,16 +19,25 @@
package org.apache.cxf.transport.servlet;
import java.io.IOException;
+import java.io.InputStream;
import java.util.Arrays;
+import java.util.LinkedList;
import java.util.List;
+import javax.servlet.RequestDispatcher;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletContext;
import javax.servlet.ServletException;
+import javax.servlet.ServletOutputStream;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletRequestWrapper;
import javax.servlet.http.HttpServletResponse;
+import org.apache.cxf.helpers.IOUtils;
+
public abstract class AbstractHTTPServlet extends HttpServlet {
@@ -39,39 +48,75 @@
private static final List<String> KNOWN_HTTP_VERBS =
Arrays.asList(new String[]{"POST", "GET", "PUT", "DELETE", "HEAD", "OPTIONS", "TRACE"});
+ private static final String STATIC_RESOURCES_PARAMETER = "static-resources-list";
+
+ private static final String REDIRECTS_PARAMETER = "redirects-list";
+ private static final String REDIRECT_SERVLET_NAME_PARAMETER = "redirect-servlet-name";
+ private static final String REDIRECT_SERVLET_PATH_PARAMETER = "redirect-servlet-path";
+
+ private List<String> staticResourcesList;
+ private List<String> redirectList;
+ private String dispatcherServletPath;
+ private String dispatcherServletName;
+
+ public void init(ServletConfig servletConfig) throws ServletException {
+ super.init(servletConfig);
+
+ staticResourcesList = parseListSequence(servletConfig.getInitParameter(STATIC_RESOURCES_PARAMETER));
+
+ redirectList = parseListSequence(servletConfig.getInitParameter(REDIRECTS_PARAMETER));
+ dispatcherServletName = servletConfig.getInitParameter(REDIRECT_SERVLET_NAME_PARAMETER);
+ dispatcherServletPath = servletConfig.getInitParameter(REDIRECT_SERVLET_PATH_PARAMETER);
+ }
+
+ private static List<String> parseListSequence(String values) {
+ if (values != null) {
+ List<String> list = new LinkedList<String>();
+ String[] pathValues = values.split(" ");
+ for (String value : pathValues) {
+ String theValue = value.trim();
+ if (theValue.length() > 0) {
+ list.add(theValue);
+ }
+ }
+ return list;
+ } else {
+ return null;
+ }
+ }
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException {
- invoke(request, response);
+ handleRequest(request, response);
}
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException {
- invoke(request, response);
+ handleRequest(request, response);
}
@Override
protected void doDelete(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
- invoke(request, response);
+ handleRequest(request, response);
}
@Override
protected void doPut(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
- invoke(request, response);
+ handleRequest(request, response);
}
@Override
protected void doHead(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
- invoke(request, response);
+ handleRequest(request, response);
}
@Override
protected void doOptions(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
- invoke(request, response);
+ handleRequest(request, response);
}
/**
@@ -100,11 +145,105 @@
if (KNOWN_HTTP_VERBS.contains(method)) {
super.service(request, response);
} else {
- invoke(request, response);
+ handleRequest(request, response);
+ }
+ }
+
+ protected void handleRequest(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException {
+ if (staticResourcesList != null
+ && matchPath(staticResourcesList, request.getPathInfo())) {
+ serveStaticContent(request, response, request.getPathInfo());
+ return;
}
+ if (redirectList != null
+ && matchPath(redirectList, request.getPathInfo())) {
+ redirect(request, response, request.getPathInfo());
+ return;
+ }
+ invoke(request, response);
+ }
+
+ private static boolean matchPath(List<String> values, String pathInfo) {
+ for (String value : values) {
+ if (pathInfo.matches(value)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ protected void serveStaticContent(HttpServletRequest request,
+ HttpServletResponse response,
+ String pathInfo) throws ServletException {
+ InputStream is = super.getServletContext().getResourceAsStream(pathInfo);
+ if (is == null) {
+ throw new ServletException("Static resource " + pathInfo + " is not available");
+ }
+ try {
+ ServletOutputStream os = response.getOutputStream();
+ IOUtils.copy(is, os);
+ os.flush();
+ } catch (IOException ex) {
+ throw new ServletException("Static resource " + pathInfo
+ + " can not be written to the output stream");
+ }
+
+ }
+
+ protected void redirect(HttpServletRequest request, HttpServletResponse response, String pathInfo)
+ throws ServletException {
+
+ String theServletPath = dispatcherServletPath == null ? "/" : dispatcherServletPath;
+
+ ServletContext sc = super.getServletContext();
+ RequestDispatcher rd = dispatcherServletName != null
+ ? sc.getNamedDispatcher(dispatcherServletName)
+ : sc.getRequestDispatcher(theServletPath + pathInfo);
+ if (rd == null) {
+ throw new ServletException("No RequestDispatcher can be created for path " + pathInfo);
+ }
+ try {
+ HttpServletRequestFilter servletRequest =
+ new HttpServletRequestFilter(request, pathInfo, theServletPath);
+ rd.forward(servletRequest, response);
+ } catch (Throwable ex) {
+ throw new ServletException("RequestDispatcher for path " + pathInfo + " has failed");
+ }
}
protected abstract void invoke(HttpServletRequest request, HttpServletResponse response)
throws ServletException;
+
+ private static class HttpServletRequestFilter extends HttpServletRequestWrapper {
+
+ private String pathInfo;
+ private String servletPath;
+
+ public HttpServletRequestFilter(HttpServletRequest request,
+ String pathInfo,
+ String servletPath) {
+ super(request);
+ this.pathInfo = pathInfo;
+ this.servletPath = servletPath;
+ }
+
+ @Override
+ public String getServletPath() {
+ return servletPath;
+ }
+
+ @Override
+ public String getPathInfo() {
+ return pathInfo;
+ }
+
+ @Override
+ public String getRequestURI() {
+ String query = super.getQueryString();
+ return query != null ? pathInfo + "?" + query : pathInfo;
+ }
+
+ }
}
Modified: cxf/trunk/systests/jaxrs/pom.xml
URL:
http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/pom.xml?rev=833112&r1=833111&r2=833112&view=diff==============================================================================
--- cxf/trunk/systests/jaxrs/pom.xml (original)
+++ cxf/trunk/systests/jaxrs/pom.xml Thu Nov 5 18:22:51 2009
@@ -65,6 +65,21 @@
</profiles>
<dependencies>
<dependency>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant</artifactId>
+ <version>1.7.0</version>
+ </dependency>
+ <dependency>
+ <groupId>jetty</groupId>
+ <artifactId>jsp-api</artifactId>
+ <version>2.1-6.0.2</version>
+ </dependency>
+ <dependency>
+ <groupId>jetty</groupId>
+ <artifactId>jsp</artifactId>
+ <version>2.1-6.0.2</version>
+ </dependency>
+ <dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-servlet_2.5_spec</artifactId>
</dependency>
Modified: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookServer.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookServer.java?rev=833112&r1=833111&r2=833112&view=diff==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookServer.java (original)
+++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookServer.java Thu Nov 5 18:22:51 2009
@@ -44,10 +44,14 @@
providers.add(p);
providers.add(new GenericHandlerWriter());
+ providers.add(new FaultyRequestHandler());
sf.setProviders(providers);
- List<Interceptor> ints = new ArrayList<Interceptor>();
- ints.add(new CustomOutInterceptor());
- sf.setOutInterceptors(ints);
+ List<Interceptor> outInts = new ArrayList<Interceptor>();
+ outInts.add(new CustomOutInterceptor());
+ sf.setOutInterceptors(outInts);
+ List<Interceptor> outFaultInts = new ArrayList<Interceptor>();
+ outFaultInts.add(new CustomOutFaultInterceptor());
+ sf.setOutFaultInterceptors(outFaultInts);
sf.setResourceProvider(BookStore.class,
new SingletonResourceProvider(new BookStore(), true));
sf.setAddress("
http://localhost:9080/");
Added: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookServerRequestDispatch.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookServerRequestDispatch.java?rev=833112&view=auto==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookServerRequestDispatch.java (added)
+++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookServerRequestDispatch.java Thu Nov 5 18:22:51 2009
@@ -0,0 +1,89 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.systest.jaxrs;
+
+import java.net.URISyntaxException;
+
+import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
+import org.mortbay.jetty.Connector;
+import org.mortbay.jetty.Handler;
+import org.mortbay.jetty.handler.DefaultHandler;
+import org.mortbay.jetty.handler.HandlerCollection;
+import org.mortbay.jetty.nio.SelectChannelConnector;
+import org.mortbay.jetty.webapp.WebAppContext;
+
+
+public class BookServerRequestDispatch extends AbstractBusTestServerBase {
+
+ private org.mortbay.jetty.Server server;
+
+ protected void run() {
+ System.out.println("Starting Server");
+
+ server = new org.mortbay.jetty.Server();
+
+ SelectChannelConnector connector = new SelectChannelConnector();
+ connector.setPort(9080);
+ server.setConnectors(new Connector[] {connector});
+
+ WebAppContext webappcontext = new WebAppContext();
+ String contextPath = null;
+ try {
+ contextPath = getClass().getResource("/jaxrs_dispatch").toURI().getPath();
+ } catch (URISyntaxException e1) {
+ e1.printStackTrace();
+ }
+ webappcontext.setContextPath("/");
+
+ webappcontext.setWar(contextPath);
+
+ HandlerCollection handlers = new HandlerCollection();
+ handlers.setHandlers(new Handler[] {webappcontext, new DefaultHandler()});
+
+ server.setHandler(handlers);
+ try {
+ server.start();
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ public void tearDown() throws Exception {
+ super.tearDown();
+ if (server != null) {
+ server.stop();
+ server.destroy();
+ server = null;
+ }
+ }
+
+ public static void main(String args[]) {
+ try {
+ BookServerRequestDispatch s = new BookServerRequestDispatch();
+ s.start();
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ System.exit(-1);
+ } finally {
+ System.out.println("done!");
+ }
+ }
+
+}
Propchange: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookServerRequestDispatch.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookServerRequestDispatch.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java?rev=833112&r1=833111&r2=833112&view=diff==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java (original)
+++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java Thu Nov 5 18:22:51 2009
@@ -33,6 +33,7 @@
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
+import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.DefaultValue;
@@ -116,6 +117,14 @@
}
@GET
+ @Path("propogateexception3")
+ public Book propogateException3() throws BookNotFoundFault {
+ PhaseInterceptorChain.getCurrentMessage().getExchange()
+ .put("org.apache.cxf.systest.for-out-fault-interceptor", Boolean.TRUE);
+ throw new BookNotFoundFault("Book Exception");
+ }
+
+ @GET
@Path("books/check/{id}")
@Produces("text/plain")
public boolean checkBook(@PathParam("id") Long id) {
@@ -447,6 +456,15 @@
}
@POST
+ @Path("/books/customstatus")
+ @Produces("text/xml")
+ @Consumes("text/xml")
+ public Response addBookCustomFailure(Book book, @Context HttpServletResponse response) {
+ response.setStatus(333);
+ return null;
+ }
+
+ @POST
@Path("/booksinfo")
@Produces("text/xml")
@Consumes("application/xml")
Added: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreDispatch.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreDispatch.java?rev=833112&view=auto==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreDispatch.java (added)
+++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreDispatch.java Thu Nov 5 18:22:51 2009
@@ -0,0 +1,56 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.systest.jaxrs;
+
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+
+@Path("/")
+public class BookStoreDispatch {
+
+ private Map<Long, Book> books = new HashMap<Long, Book>();
+ private Long mainId = 123L;
+
+ public BookStoreDispatch() {
+ init();
+ }
+
+ @GET
+ @Path("/books/html/{bookid}")
+ @Produces("text/html")
+ public Book getBookHtml() {
+ return books.get(123L);
+ }
+
+ final void init() {
+ Book book = new Book();
+ book.setId(mainId);
+ book.setName("CXF in Action");
+ books.put(book.getId(), book);
+ }
+
+}
+
+
Propchange: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreDispatch.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreDispatch.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/CustomOutFaultInterceptor.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/CustomOutFaultInterceptor.java?rev=833112&view=auto==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/CustomOutFaultInterceptor.java (added)
+++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/CustomOutFaultInterceptor.java Thu Nov 5 18:22:51 2009
@@ -0,0 +1,73 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.systest.jaxrs;
+
+import java.io.IOException;
+
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.phase.AbstractPhaseInterceptor;
+import org.apache.cxf.phase.Phase;
+import org.apache.cxf.transport.http.AbstractHTTPDestination;
+
+public class CustomOutFaultInterceptor extends AbstractPhaseInterceptor<Message> {
+ private boolean handleMessageCalled;
+ public CustomOutFaultInterceptor() {
+ this(Phase.PRE_STREAM);
+ }
+
+ public CustomOutFaultInterceptor(String s) {
+ super(Phase.MARSHAL);
+
+ }
+
+ public void handleMessage(Message message) throws Fault {
+ if (message.getExchange().get("org.apache.cxf.systest.for-out-fault-interceptor") == null) {
+ return;
+ }
+ handleMessageCalled = true;
+ Exception ex = message.getContent(Exception.class);
+ if (ex == null) {
+ throw new RuntimeException("Exception is expected");
+ }
+ Fault fault = (Fault)ex;
+ if (fault == null) {
+ throw new RuntimeException("Fault is expected");
+ }
+ // deal with the actual exception : fault.getCause()
+ HttpServletResponse response = (HttpServletResponse)message.getExchange()
+ .getInMessage().get(AbstractHTTPDestination.HTTP_RESPONSE);
+ response.setStatus(500);
+ try {
+ response.getOutputStream().write("<nobook/>".getBytes());
+ response.getOutputStream().flush();
+ message.getInterceptorChain().abort();
+ } catch (IOException ioex) {
+ throw new RuntimeException("Error writing the response");
+ }
+
+ }
+
+ protected boolean handleMessageCalled() {
+ return handleMessageCalled;
+ }
+
+}
Propchange: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/CustomOutFaultInterceptor.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/CustomOutFaultInterceptor.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/FaultyRequestHandler.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/FaultyRequestHandler.java?rev=833112&view=auto==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/FaultyRequestHandler.java (added)
+++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/FaultyRequestHandler.java Thu Nov 5 18:22:51 2009
@@ -0,0 +1,42 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.systest.jaxrs;
+
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
+
+import org.apache.cxf.jaxrs.ext.RequestHandler;
+import org.apache.cxf.jaxrs.model.ClassResourceInfo;
+import org.apache.cxf.message.Message;
+
+public class FaultyRequestHandler implements RequestHandler {
+
+ @Context
+ private UriInfo uriInfo;
+
+ public Response handleRequest(Message m, ClassResourceInfo resourceClass) {
+ if (uriInfo.getPath().endsWith("/propogateexception4")) {
+ m.getExchange().put("org.apache.cxf.systest.for-out-fault-interceptor", Boolean.TRUE);
+ throw new RuntimeException();
+ }
+ return null;
+ }
+
+}
Propchange: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/FaultyRequestHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/FaultyRequestHandler.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java?rev=833112&r1=833111&r2=833112&view=diff==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java (original)
+++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java Thu Nov 5 18:22:51 2009
@@ -76,6 +76,20 @@
}
@Test
+ public void testPropogateException3() throws Exception {
+ String data = "<nobook/>";
+ getAndCompare("
http://localhost:9080/bookstore/propogateexception3",
+ data, "application/xml", 500);
+ }
+
+ @Test
+ public void testPropogateException4() throws Exception {
+ String data = "<nobook/>";
+ getAndCompare("
http://localhost:9080/bookstore/propogateexception4",
+ data, "application/xml", 500);
+ }
+
+ @Test
public void testWebApplicationException() throws Exception {
getAndCompare("
http://localhost:9080/bookstore/webappexception",
"This is a WebApplicationException",
@@ -288,8 +302,8 @@
@Test
public void testNoMessageWriterFound() throws Exception {
- String msg1 = ".No message body writer found for response class : GregorianCalendar.";
- String msg2 = ".No message body writer found for response class : Calendar.";
+ String msg1 = "No message body writer has been found for response class GregorianCalendar.";
+ String msg2 = "No message body writer has been found for response class Calendar.";
getAndCompareStrings("
http://localhost:9080/bookstore/timetable",
new String[]{msg1, msg2}, "*/*", 500);
@@ -585,6 +599,21 @@
}
@Test
+ public void testAddBookNoBody() throws Exception {
+ PostMethod post = new PostMethod("
http://localhost:9080/bookstore/books");
+ post.setRequestHeader("Content-Type", "application/xml");
+ HttpClient httpclient = new HttpClient();
+
+ try {
+ int result = httpclient.executeMethod(post);
+ assertEquals(400, result);
+ } finally {
+ // Release current connection to the connection pool once you are done
+ post.releaseConnection();
+ }
+ }
+
+ @Test
public void testAddBook() throws Exception {
doAddBook("
http://localhost:9080/bookstore/books");
}
@@ -615,6 +644,27 @@
}
}
+
+ @Test
+ public void testAddBookCustomFailureStatus() throws Exception {
+ String endpointAddress = "
http://localhost:9080/bookstore/books/customstatus";
+
+ File input = new File(getClass().getResource("resources/update_book.txt").toURI());
+ PostMethod put = new PostMethod(endpointAddress);
+ RequestEntity entity = new FileRequestEntity(input, "text/xml; charset=ISO-8859-1");
+ put.setRequestEntity(entity);
+ HttpClient httpclient = new HttpClient();
+
+ try {
+ int result = httpclient.executeMethod(put);
+ assertEquals(333, result);
+ } finally {
+ // Release current connection to the connection pool once you are
+ // done
+ put.releaseConnection();
+ }
+ }
+
@Test
public void testUpdateBook() throws Exception {
String endpointAddress = "
http://localhost:9080/bookstore/books";
Modified: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java?rev=833112&r1=833111&r2=833112&view=diff==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java (original)
+++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java Thu Nov 5 18:22:51 2009
@@ -355,6 +355,22 @@
assertEquals("java.jpg", cd2.getParameter("filename"));
}
+ @Test
+ public void testMultipartRequestNoBody() throws Exception {
+ PostMethod post = new PostMethod("
http://localhost:9085/bookstore/books/image");
+ String ct = "multipart/mixed";
+ post.setRequestHeader("Content-Type", ct);
+ HttpClient httpclient = new HttpClient();
+
+ try {
+ int result = httpclient.executeMethod(post);
+ assertEquals(400, result);
+ } finally {
+ // Release current connection to the connection pool once you are done
+ post.releaseConnection();
+ }
+ }
+
private void doAddBook(String address, String resourceName, int status) throws Exception {
doAddBook("multipart/related", address, resourceName, status);
}
Added: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSRequestDispatcherTest.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSRequestDispatcherTest.java?rev=833112&view=auto==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSRequestDispatcherTest.java (added)
+++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSRequestDispatcherTest.java Thu Nov 5 18:22:51 2009
@@ -0,0 +1,97 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.systest.jaxrs;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.cxf.jaxrs.client.WebClient;
+import org.apache.cxf.jaxrs.ext.xml.XMLSource;
+import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
+
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class JAXRSRequestDispatcherTest extends AbstractBusClientServerTestBase {
+
+ @BeforeClass
+ public static void startServers() throws Exception {
+ assertTrue("server did not launch correctly",
+ launchServer(BookServerRequestDispatch.class));
+ }
+
+ @Test
+ public void testGetBookHTML() throws Exception {
+ String endpointAddress =
+ "
http://localhost:9080/the/bookstore1/books/html/123";
+ WebClient client = WebClient.create(endpointAddress);
+ client.accept("text/html");
+ WebClient.getConfig(client).getHttpConduit().getClient().setReceiveTimeout(100000000);
+ XMLSource source = client.accept("text/html").get(XMLSource.class);
+ Map<String, String> namespaces = new HashMap<String, String>();
+ namespaces.put("xhtml", "
http://www.w3.org/1999/xhtml");
+ namespaces.put("books", "
http://www.w3.org/books");
+ String value = source.getValue("xhtml:html/xhtml:body/xhtml:ul/books:bookTag", namespaces);
+ assertEquals("CXF Rocks", value);
+ }
+
+ @Test
+ @Ignore("JSP pages need to be precompiled by Maven build")
+ public void testGetBookJSPRequestScope() throws Exception {
+ String endpointAddress =
+ "
http://localhost:9080/the/bookstore2/books/html/123";
+ WebClient client = WebClient.create(endpointAddress);
+ client.accept("text/html");
+ WebClient.getConfig(client).getHttpConduit().getClient().setReceiveTimeout(100000000);
+ String data = client.accept("text/html").get(String.class);
+ assertTrue(data.contains("<h1>Request Book 123</h1>"));
+ assertTrue(data.contains("<books:bookName>CXF in Action</books:bookName>"));
+
+ }
+
+ @Test
+ @Ignore("JSP pages need to be precompiled by Maven build")
+ public void testGetBookJSPSessionScope() throws Exception {
+ String endpointAddress =
+ "
http://localhost:9080/the/bookstore3/books/html/456";
+ WebClient client = WebClient.create(endpointAddress);
+ client.accept("text/html");
+ WebClient.getConfig(client).getHttpConduit().getClient().setReceiveTimeout(100000000);
+ String data = client.accept("text/html").get(String.class);
+ assertTrue(data.contains("<h1>Session Book 456</h1>"));
+ assertTrue(data.contains("<books:bookName>CXF in Action</books:bookName>"));
+ }
+
+ @Test
+ public void testGetBookHTMLFromDefaultServlet() throws Exception {
+ String endpointAddress =
+ "
http://localhost:9080/the/bookstore4/books/html/123";
+ WebClient client = WebClient.create(endpointAddress);
+ client.accept("text/html");
+ WebClient.getConfig(client).getHttpConduit().getClient().setReceiveTimeout(100000000);
+ XMLSource source = client.accept("text/html").get(XMLSource.class);
+ Map<String, String> namespaces = new HashMap<String, String>();
+ namespaces.put("xhtml", "
http://www.w3.org/1999/xhtml");
+ namespaces.put("books", "
http://www.w3.org/books");
+ String value = source.getValue("xhtml:html/xhtml:body/xhtml:ul/books:bookTag", namespaces);
+ assertEquals("CXF Rocks", value);
+ }
+}
Propchange: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSRequestDispatcherTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSRequestDispatcherTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_dispatch/WEB-INF/beans.xml
URL:
http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_dispatch/WEB-INF/beans.xml?rev=833112&view=auto==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_dispatch/WEB-INF/beans.xml (added)
+++ cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_dispatch/WEB-INF/beans.xml Thu Nov 5 18:22:51 2009
@@ -0,0 +1,103 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+
http://www.apache.org/licenses/LICENSE-2.0+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<!-- START SNIPPET: beans -->
+<!--beans xmlns="
http://www.springframework.org/schema/beans"
+ xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:simple="
http://cxf.apache.org/simple"
+ xsi:schemaLocation="
+
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd+
http://cxf.apache.org/simple http://cxf.apache.org/schemas/simple.xsd"-->
+<beans xmlns="
http://www.springframework.org/schema/beans"
+ xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:util="
http://www.springframework.org/schema/util"
+ xmlns:jaxrs="
http://cxf.apache.org/jaxrs"
+ xmlns:cxf="
http://cxf.apache.org/core"
+ xsi:schemaLocation="
+
http://www.springframework.org/schema/beans
+
http://www.springframework.org/schema/beans/spring-beans.xsd+
http://www.springframework.org/schema/util
+
http://www.springframework.org/schema/util/spring-util-2.0.xsd+
http://cxf.apache.org/jaxrs+
http://cxf.apache.org/schemas/jaxrs.xsd+
http://cxf.apache.org/core+
http://cxf.apache.org/schemas/core.xsd">
+
+ <import resource="classpath:META-INF/cxf/cxf.xml" />
+ <import resource="classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml" />
+ <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
+
+ <bean class="org.apache.cxf.systest.jaxrs.BookStoreDispatch" id="serviceBean"/>
+
+ <bean id="dispatchProvider1" class="org.apache.cxf.jaxrs.provider.RequestDispatcherProvider">
+ <property name="resourcePath" value="/book.html"/>
+ </bean>
+
+ <bean id="dispatchProvider2" class="org.apache.cxf.jaxrs.provider.RequestDispatcherProvider">
+ <property name="resourcePath" value="/bookRequestScope.jsp"/>
+ </bean>
+
+ <bean id="dispatchProvider3" class="org.apache.cxf.jaxrs.provider.RequestDispatcherProvider">
+ <property name="resourcePath" value="/bookSessionScope.jsp"/>
+ <property name="scope" value="session"/>
+ </bean>
+
+ <bean id="dispatchProvider4" class="org.apache.cxf.jaxrs.provider.RequestDispatcherProvider">
+ <property name="resourcePath" value="/book.html"/>
+ <property name="dispatcherName" value="default"/>
+ </bean>
+
+ <jaxrs:server id="bookservice1" address="/bookstore1">
+ <jaxrs:serviceBeans>
+ <ref bean="serviceBean"/>
+ </jaxrs:serviceBeans>
+ <jaxrs:providers>
+ <ref bean="dispatchProvider1"/>
+ </jaxrs:providers>
+ </jaxrs:server>
+
+ <jaxrs:server id="bookservice2" address="/bookstore2">
+ <jaxrs:serviceBeans>
+ <ref bean="serviceBean"/>
+ </jaxrs:serviceBeans>
+ <jaxrs:providers>
+ <ref bean="dispatchProvider2"/>
+ </jaxrs:providers>
+ </jaxrs:server>
+
+ <jaxrs:server id="bookservice3" address="/bookstore3">
+ <jaxrs:serviceBeans>
+ <ref bean="serviceBean"/>
+ </jaxrs:serviceBeans>
+ <jaxrs:providers>
+ <ref bean="dispatchProvider3"/>
+ </jaxrs:providers>
+ </jaxrs:server>
+
+ <jaxrs:server id="bookservice4" address="/bookstore4">
+ <jaxrs:serviceBeans>
+ <ref bean="serviceBean"/>
+ </jaxrs:serviceBeans>
+ <jaxrs:providers>
+ <ref bean="dispatchProvider4"/>
+ </jaxrs:providers>
+ </jaxrs:server>
+
+</beans>
+<!-- END SNIPPET: beans -->
Propchange: cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_dispatch/WEB-INF/beans.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_dispatch/WEB-INF/beans.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_dispatch/WEB-INF/beans.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_dispatch/WEB-INF/web.xml
URL:
http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_dispatch/WEB-INF/web.xml?rev=833112&view=auto==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_dispatch/WEB-INF/web.xml (added)
+++ cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_dispatch/WEB-INF/web.xml Thu Nov 5 18:22:51 2009
@@ -0,0 +1,99 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<!DOCTYPE web-app
+ PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
+ "
http://java.sun.com/dtd/web-app_2_3.dtd">
+
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+
http://www.apache.org/licenses/LICENSE-2.0+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<!-- START SNIPPET: webxml -->
+<web-app>
+ <context-param>
+ <param-name>contextConfigLocation</param-name>
+ <param-value>WEB-INF/beans.xml</param-value>
+ </context-param>
+
+ <listener>
+ <listener-class>
+ org.springframework.web.context.ContextLoaderListener
+ </listener-class>
+ </listener>
+
+ <servlet>
+ <servlet-name>CXFServlet</servlet-name>
+ <display-name>CXF Servlet</display-name>
+ <servlet-class>
+ org.apache.cxf.transport.servlet.CXFServlet
+ </servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>CXFServlet</servlet-name>
+ <url-pattern>/the/*</url-pattern>
+ </servlet-mapping>
+
+ <servlet>
+ <servlet-name>RedirectCXFServlet</servlet-name>
+ <display-name>Redirect CXF Servlet</display-name>
+ <servlet-class>
+ org.apache.cxf.transport.servlet.CXFServlet
+ </servlet-class>
+ <init-param>
+ <param-name>redirects-list</param-name>
+ <param-value>/(\w)+.html</param-value>
+ </init-param>
+ <!--
+ <init-param>
+ <param-name>reditect-servlet-name</param-name>
+ <param-value>DefaultCXFServlet</param-value>
+ </init-param>
+ -->
+ <init-param>
+ <param-name>redirect-servlet-path</param-name>
+ <param-value>/static</param-value>
+ </init-param>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>RedirectCXFServlet</servlet-name>
+ <url-pattern>/*</url-pattern>
+ </servlet-mapping>
+
+ <servlet>
+ <servlet-name>DefaultCXFServlet</servlet-name>
+ <display-name>Default CXF Servlet</display-name>
+ <servlet-class>
+ org.apache.cxf.transport.servlet.CXFServlet
+ </servlet-class>
+ <init-param>
+ <param-name>static-resources-list</param-name>
+ <param-value>/(\w)+.html</param-value>
+ </init-param>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>DefaultCXFServlet</servlet-name>
+ <url-pattern>/static/*</url-pattern>
+ </servlet-mapping>
+
+</web-app>
+<!-- END SNIPPET: webxml -->
\ No newline at end of file
Propchange: cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_dispatch/WEB-INF/web.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_dispatch/WEB-INF/web.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_dispatch/WEB-INF/web.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_dispatch/book.html
URL:
http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_dispatch/book.html?rev=833112&view=auto==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_dispatch/book.html (added)
+++ cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_dispatch/book.html Thu Nov 5 18:22:51 2009
@@ -0,0 +1,28 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+
http://www.apache.org/licenses/LICENSE-2.0+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<html xmlns="
http://www.w3.org/1999/xhtml"
+ xmlns:books="
http://www.w3.org/books">
+<head> <title>Testing XML Example</title> </head>
+<body>
+ <h1>Book</h1>
+ <ul>
+ <books:bookTag>CXF Rocks</books:bookTag>
+ </ul>
+</body>
+</html>
Propchange: cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_dispatch/book.html
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_dispatch/book.html
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_dispatch/book.html
------------------------------------------------------------------------------
svn:mime-type = text/html
Added: cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_dispatch/bookRequestScope.jsp
URL:
http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_dispatch/bookRequestScope.jsp?rev=833112&view=auto==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_dispatch/bookRequestScope.jsp (added)
+++ cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_dispatch/bookRequestScope.jsp Thu Nov 5 18:22:51 2009
@@ -0,0 +1,30 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+
http://www.apache.org/licenses/LICENSE-2.0+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<html xmlns="
http://www.w3.org/1999/xhtml"
+ xmlns:books="
http://www.w3.org/books">
+<head> <title>Testing XML Example</title> </head>
+<%@ page language="java" import="org.apache.cxf.systest.jaxrs.*" %>
+<jsp:useBean id="book" scope="request" class="org.apache.cxf.systest.jaxrs.Book" />
+<body>
+ <h1>Request Book <%= request.getParameter("bookid") %></h1>
+ <ul>
+ <books:bookName><%= book.getName() %></books:bookName>
+ </ul>
+</body>
+</html>
Added: cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_dispatch/bookSessionScope.jsp
URL:
http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_dispatch/bookSessionScope.jsp?rev=833112&view=auto==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_dispatch/bookSessionScope.jsp (added)
+++ cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_dispatch/bookSessionScope.jsp Thu Nov 5 18:22:51 2009
@@ -0,0 +1,30 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+
http://www.apache.org/licenses/LICENSE-2.0+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<html xmlns="
http://www.w3.org/1999/xhtml"
+ xmlns:books="
http://www.w3.org/books">
+<head> <title>Testing XML Example</title> </head>
+<%@ page language="java" import="org.apache.cxf.systest.jaxrs.*" %>
+<jsp:useBean id="book" scope="session" class="org.apache.cxf.systest.jaxrs.Book" />
+<body>
+ <h1>Session Book <%= request.getParameter("bookid") %></h1>
+ <ul>
+ <books:bookName><%= book.getName() %></books:bookName>
+ </ul>
+</body>
+</html>