incubator-wink-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ngalla...@apache.org
Subject svn commit: r787553 [13/34] - in /incubator/wink/contrib/ibm-jaxrs/tests: ./ fvt/ fvt/demo/ fvt/demo/jaxrs/ fvt/demo/jaxrs/cache/ fvt/demo/jaxrs/cache/server/ fvt/demo/jaxrs/cache/test/ fvt/demo/jaxrs/datasource/ fvt/demo/jaxrs/datasource/server/ fvt/d...
Date Tue, 23 Jun 2009 05:38:19 GMT
Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/mapped/server/Comment.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/mapped/server/Comment.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/mapped/server/Comment.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/mapped/server/Comment.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,58 @@
+/*
+ * 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 jaxrs.tests.exceptions.mapped.server;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement(name = "comment")
+public class Comment {
+
+    private Integer id;
+
+    private String message;
+
+    private String author;
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    @XmlElement(nillable = false)
+    public String getMessage() {
+        return message;
+    }
+
+    public void setMessage(String message) {
+        this.message = message;
+    }
+
+    public String getAuthor() {
+        return author;
+    }
+
+    public void setAuthor(String author) {
+        this.author = author;
+    }
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/mapped/server/CommentError.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/mapped/server/CommentError.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/mapped/server/CommentError.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/mapped/server/CommentError.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,39 @@
+/*
+ * 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 jaxrs.tests.exceptions.mapped.server;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement(name = "commenterror")
+public class CommentError {
+
+    private String errorMessage;
+
+    public String getErrorMessage() {
+        return errorMessage;
+    }
+
+    @XmlElement(name = "message")
+    public void setErrorMessage(String errorMessage) {
+        this.errorMessage = errorMessage;
+    }
+
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/mapped/server/CommentList.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/mapped/server/CommentList.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/mapped/server/CommentList.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/mapped/server/CommentList.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,46 @@
+/*
+ * 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 jaxrs.tests.exceptions.mapped.server;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlRootElement;
+
+import com.sun.xml.internal.txw2.annotation.XmlElement;
+
+@XmlRootElement(name = "comments")
+public class CommentList {
+
+    private List<Comment> comments = new ArrayList<Comment>();
+
+    public CommentList() {
+        /* do nothing */
+    }
+
+    @XmlElement("comment")
+    public List<Comment> getComments() {
+        return comments;
+    }
+
+    public void setMessages(List<Comment> comments) {
+        this.comments = comments;
+    }
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/mapped/server/Guestbook.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/mapped/server/Guestbook.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/mapped/server/Guestbook.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/mapped/server/Guestbook.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,168 @@
+/*
+ * 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 jaxrs.tests.exceptions.mapped.server;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
+import javax.ws.rs.core.Response.Status;
+
+/**
+ * The main JAX-RS resource.
+ */
+@Path("guestbookmapped")
+public class Guestbook {
+
+    private static class MyWebAppException extends WebApplicationException {
+
+        private static final long serialVersionUID = -2022185988670037226L;
+
+        final private Response resp;
+
+        public MyWebAppException(int status) {
+            CommentError error = new CommentError();
+            error.setErrorMessage("Cannot post an invalid message.");
+            resp = Response.status(status).entity(error).build();
+        }
+
+        @Override
+        public Response getResponse() {
+            return resp;
+        }
+    }
+
+    /**
+     * Adds a new message to the database.
+     *
+     * @return HTTP status 200
+     */
+    @POST
+    @Consumes( { "text/xml" })
+    @Produces( { "text/xml" })
+    public Response createMessage(Comment aMessage, @Context UriInfo uriInfo) {
+        if (aMessage == null) {
+            WebApplicationException webAppException = new WebApplicationException(
+                    Status.BAD_REQUEST);
+            throw webAppException;
+        }
+
+        if (aMessage.getMessage() == null && aMessage.getAuthor() == null) {
+            throw new WebApplicationException();
+        }
+
+        if (aMessage.getMessage() == null) {
+            CommentError error = new CommentError();
+            error.setErrorMessage("Missing the message in the comment.");
+            Response malformedCommentResponse = Response.status(
+                    Status.BAD_REQUEST).entity(error).build();
+            WebApplicationException webAppException = new WebApplicationException(
+                    malformedCommentResponse);
+            throw webAppException;
+        }
+
+        if (aMessage.getAuthor() == null) {
+            WebApplicationException webAppException = new WebApplicationException(
+                    499);
+            throw webAppException;
+        }
+
+        if ("".equals(aMessage.getMessage())) {
+            throw new MyWebAppException(498);
+        }
+
+        /*
+         * Set the message id to a server decided message, even if the client
+         * set it.
+         */
+        int id = GuestbookDatabase.getGuestbook().getAndIncrementCounter();
+        aMessage.setId(id);
+
+        GuestbookDatabase.getGuestbook().storeComment(aMessage);
+        try {
+            return Response
+                    .created(
+                            new URI(uriInfo.getAbsolutePath() + "/"
+                                    + aMessage.getId())).entity(aMessage)
+                    .build();
+        } catch (URISyntaxException e) {
+            e.printStackTrace();
+            throw new RuntimeException(e);
+        }
+    }
+
+    @PUT
+    @Path("{id}")
+    @Produces( { "text/xml" })
+    public Response updateMessage(Comment aMessage, @PathParam("id") String msgId)
+            throws GuestbookException {
+        /*
+         * If no message data was sent, then return the null request.
+         */
+        if (aMessage == null) {
+            return Response.status(Status.BAD_REQUEST).build();
+        }
+
+        if (aMessage.getId() == null || !aMessage.getId().equals(msgId)) {
+            throw new GuestbookException("Unexpected ID.");
+        }
+
+        Comment existingComment = GuestbookDatabase.getGuestbook().getComment(
+                Integer.valueOf(msgId));
+        if (existingComment == null) {
+            throw new GuestbookException(
+                    "Cannot find existing comment to update.");
+        }
+        GuestbookDatabase.getGuestbook().storeComment(aMessage);
+        return Response.ok(aMessage).build();
+    }
+
+    @GET
+    @Path("/{id}")
+    @Produces( { "text/xml" })
+    public Response readMessage(@PathParam("id") String msgId) {
+        Comment msg = GuestbookDatabase.getGuestbook().getComment(
+                Integer.valueOf(msgId));
+        if (msg == null) {
+            return Response.status(404).build();
+        }
+
+        return Response.ok(msg).build();
+    }
+
+    @DELETE
+    @Path("{id}")
+    @Produces( { "text/xml" })
+    public Response deleteMessage(@PathParam("id") String msgId) {
+        GuestbookDatabase.getGuestbook().deleteComment(Integer.valueOf(msgId));
+        return Response.noContent().build();
+    }
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/mapped/server/GuestbookApplication.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/mapped/server/GuestbookApplication.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/mapped/server/GuestbookApplication.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/mapped/server/GuestbookApplication.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,44 @@
+/*
+ * 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 jaxrs.tests.exceptions.mapped.server;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.ws.rs.core.Application;
+
+/**
+ * The JAX-RS Application config class.
+ */
+public class GuestbookApplication extends Application {
+
+    @Override
+    public Set<Class<?>> getClasses() {
+        Set<Class<?>> classes = new HashSet<Class<?>>();
+        classes.add(Guestbook.class);
+        classes.add(WebApplicationExceptionMapProvider.class);
+        classes.add(RuntimeExceptionMappingProvider.class);
+        classes.add(NullPointerExceptionMapProvider.class);
+        classes.add(GuestbookErrorExceptionMappingProvider.class);
+        classes.add(GuestbookExceptionMapProvider.class);
+        return classes;
+    }
+
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/mapped/server/GuestbookDatabase.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/mapped/server/GuestbookDatabase.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/mapped/server/GuestbookDatabase.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/mapped/server/GuestbookDatabase.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,74 @@
+/*
+ * 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 jaxrs.tests.exceptions.mapped.server;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * A simple in-memory data store.
+ */
+public class GuestbookDatabase {
+
+    private static GuestbookDatabase guestbook = new GuestbookDatabase();
+
+    private Map<Integer, Comment> comments = Collections
+            .synchronizedMap(new HashMap<Integer, Comment>());
+
+    private int counter = 0;
+
+    private GuestbookDatabase() {
+        /* private singleton constructor */
+    }
+
+    public static GuestbookDatabase getGuestbook() {
+        return guestbook;
+    }
+
+    public Comment getComment(Integer id) {
+        return comments.get(id);
+    }
+
+    public void storeComment(Comment c) {
+        comments.put(c.getId(), c);
+    }
+
+    public Collection<Integer> getCommentKeys() {
+        return comments.keySet();
+    }
+
+    public void deleteComment(Integer id) {
+        if (id == -99999) {
+            throw new GuestbookError("Simulated error");
+        }
+
+        if (comments.remove(id) == null) {
+            throw new NullPointerException(
+                    "The comment did not previously exist.");
+        }
+    }
+
+    public synchronized int getAndIncrementCounter() {
+        ++counter;
+        return counter;
+    }
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/mapped/server/GuestbookDatabaseException.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/mapped/server/GuestbookDatabaseException.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/mapped/server/GuestbookDatabaseException.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/mapped/server/GuestbookDatabaseException.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,41 @@
+/*
+ * 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 jaxrs.tests.exceptions.mapped.server;
+
+public class GuestbookDatabaseException extends Exception {
+
+    private static final long serialVersionUID = 3656497291087821230L;
+
+    public GuestbookDatabaseException() {
+        super();
+    }
+
+    public GuestbookDatabaseException(String message) {
+        super(message);
+    }
+
+    public GuestbookDatabaseException(Throwable cause) {
+        super(cause);
+    }
+
+    public GuestbookDatabaseException(String message, Throwable cause) {
+        super(message, cause);
+    }
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/mapped/server/GuestbookError.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/mapped/server/GuestbookError.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/mapped/server/GuestbookError.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/mapped/server/GuestbookError.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,29 @@
+/*
+ * 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 jaxrs.tests.exceptions.mapped.server;
+
+public class GuestbookError extends Error {
+
+    private static final long serialVersionUID = -1247655313421068853L;
+
+    public GuestbookError(String message) {
+        super(message);
+    }
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/mapped/server/GuestbookErrorExceptionMappingProvider.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/mapped/server/GuestbookErrorExceptionMappingProvider.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/mapped/server/GuestbookErrorExceptionMappingProvider.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/mapped/server/GuestbookErrorExceptionMappingProvider.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,35 @@
+/*
+ * 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 jaxrs.tests.exceptions.mapped.server;
+
+import javax.ws.rs.core.Response;
+import javax.ws.rs.ext.ExceptionMapper;
+import javax.ws.rs.ext.Provider;
+
+@Provider
+public class GuestbookErrorExceptionMappingProvider implements ExceptionMapper<GuestbookError> {
+
+    public Response toResponse(GuestbookError arg0) {
+        CommentError error = new CommentError();
+        error.setErrorMessage(arg0.getMessage());
+        return Response.status(453).entity(error).build();
+    }
+
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/mapped/server/GuestbookException.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/mapped/server/GuestbookException.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/mapped/server/GuestbookException.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/mapped/server/GuestbookException.java Tue Jun 23 05:37:57 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 jaxrs.tests.exceptions.mapped.server;
+
+public class GuestbookException extends Exception {
+
+    private static final long serialVersionUID = -1975560538784455458L;
+
+    public GuestbookException() {
+        super();
+    }
+
+    public GuestbookException(String message) {
+        super(message);
+    }
+
+    public GuestbookException(Throwable cause) {
+        super(cause);
+    }
+
+    public GuestbookException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/mapped/server/GuestbookExceptionMapProvider.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/mapped/server/GuestbookExceptionMapProvider.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/mapped/server/GuestbookExceptionMapProvider.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/mapped/server/GuestbookExceptionMapProvider.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,35 @@
+/*
+ * 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 jaxrs.tests.exceptions.mapped.server;
+
+import javax.ws.rs.core.Response;
+import javax.ws.rs.ext.ExceptionMapper;
+import javax.ws.rs.ext.Provider;
+
+@Provider
+public class GuestbookExceptionMapProvider implements ExceptionMapper<GuestbookException> {
+
+    public Response toResponse(GuestbookException arg0) {
+        CommentError error = new CommentError();
+        error.setErrorMessage(arg0.getMessage());
+        return Response.status(454).entity(error).build();
+    }
+
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/mapped/server/NullPointerExceptionMapProvider.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/mapped/server/NullPointerExceptionMapProvider.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/mapped/server/NullPointerExceptionMapProvider.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/mapped/server/NullPointerExceptionMapProvider.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,35 @@
+/*
+ * 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 jaxrs.tests.exceptions.mapped.server;
+
+import javax.ws.rs.core.Response;
+import javax.ws.rs.ext.ExceptionMapper;
+import javax.ws.rs.ext.Provider;
+
+@Provider
+public class NullPointerExceptionMapProvider implements ExceptionMapper<NullPointerException> {
+
+    public Response toResponse(NullPointerException arg0) {
+        CommentError error = new CommentError();
+        error.setErrorMessage(arg0.getMessage());
+        return Response.status(451).entity(error).build();
+    }
+
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/mapped/server/ObjectFactory.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/mapped/server/ObjectFactory.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/mapped/server/ObjectFactory.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/mapped/server/ObjectFactory.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,39 @@
+/*
+ * 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 jaxrs.tests.exceptions.mapped.server;
+
+import javax.xml.bind.annotation.XmlRegistry;
+
+@XmlRegistry
+public class ObjectFactory {
+
+    public CommentError createCommentError() {
+        return new CommentError();
+    }
+
+    public Comment createComment() {
+        return new Comment();
+    }
+
+    public CommentList createCommentList() {
+        return new CommentList();
+    }
+
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/mapped/server/RuntimeExceptionMappingProvider.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/mapped/server/RuntimeExceptionMappingProvider.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/mapped/server/RuntimeExceptionMappingProvider.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/mapped/server/RuntimeExceptionMappingProvider.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,35 @@
+/*
+ * 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 jaxrs.tests.exceptions.mapped.server;
+
+import javax.ws.rs.core.Response;
+import javax.ws.rs.ext.ExceptionMapper;
+import javax.ws.rs.ext.Provider;
+
+@Provider
+public class RuntimeExceptionMappingProvider implements ExceptionMapper<RuntimeException> {
+
+    public Response toResponse(RuntimeException arg0) {
+        CommentError error = new CommentError();
+        error.setErrorMessage(arg0.getMessage());
+        return Response.status(450).entity(error).build();
+    }
+
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/mapped/server/WEB-INF/web-no-runtime.xml
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/mapped/server/WEB-INF/web-no-runtime.xml?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/mapped/server/WEB-INF/web-no-runtime.xml (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/mapped/server/WEB-INF/web-no-runtime.xml Tue Jun 23 05:37:57 2009
@@ -0,0 +1,34 @@
+<?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.
+  -->
+
+<web-app id="WebApp_ID" version="2.5"
+	xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
+	<servlet>
+		<servlet-name>Guestbook</servlet-name>
+		<servlet-class>jaxrs.tests.exceptions.mapped.server.GuestbookApplication</servlet-class>
+		<load-on-startup>1</load-on-startup>
+	</servlet>
+	<servlet-mapping>
+		<servlet-name>Guestbook</servlet-name>
+		<url-pattern>/*</url-pattern>
+	</servlet-mapping>
+</web-app>
\ No newline at end of file

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/mapped/server/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/mapped/server/WEB-INF/web.xml?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/mapped/server/WEB-INF/web.xml (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/mapped/server/WEB-INF/web.xml Tue Jun 23 05:37:57 2009
@@ -0,0 +1,38 @@
+<?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.
+  -->
+
+<web-app id="WebApp_ID" version="2.5"
+	xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
+	<servlet>
+		<servlet-name>Guestbook</servlet-name>
+		<servlet-class>com.ibm.ws.jaxrs.web.RESTServlet</servlet-class>
+		<init-param>
+			<param-name>javax.ws.rs.Application</param-name>
+			<param-value>jaxrs.tests.exceptions.mapped.server.GuestbookApplication</param-value>
+		</init-param>
+		<load-on-startup>1</load-on-startup>
+	</servlet>
+	<servlet-mapping>
+		<servlet-name>Guestbook</servlet-name>
+		<url-pattern>/*</url-pattern>
+	</servlet-mapping>
+</web-app>
\ No newline at end of file

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/mapped/server/WebApplicationExceptionMapProvider.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/mapped/server/WebApplicationExceptionMapProvider.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/mapped/server/WebApplicationExceptionMapProvider.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/mapped/server/WebApplicationExceptionMapProvider.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,59 @@
+/*
+ * 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 jaxrs.tests.exceptions.mapped.server;
+
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
+import javax.ws.rs.ext.ExceptionMapper;
+import javax.ws.rs.ext.Provider;
+
+@Provider
+public class WebApplicationExceptionMapProvider implements ExceptionMapper<WebApplicationException> {
+
+    @Context
+    private UriInfo uri;
+
+    public Response toResponse(WebApplicationException arg0) {
+        int oldStatus = arg0.getResponse().getStatus();
+        Response.ResponseBuilder builder = Response.fromResponse(
+                arg0.getResponse()).header("ExceptionPage",
+                uri.getAbsolutePath().toASCIIString());
+
+        Object entity = arg0.getResponse().getEntity();
+        if (entity instanceof CommentError) {
+            CommentError error = (CommentError) entity;
+            error.setErrorMessage("WebApplicationExceptionMapProvider:"
+                    + error.getErrorMessage());
+            builder.entity(error);
+        }
+
+        if (oldStatus == 499) {
+            builder.status(497);
+        } else if (oldStatus == Response.Status.BAD_REQUEST.getStatusCode()) {
+            System.out.println("SETTING 496");
+            builder.status(496);
+        }
+
+        return builder.build();
+    }
+
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/mapped/test/ExceptionsMappedProviderTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/mapped/test/ExceptionsMappedProviderTest.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/mapped/test/ExceptionsMappedProviderTest.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/mapped/test/ExceptionsMappedProviderTest.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,256 @@
+/*
+ * 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 jaxrs.tests.exceptions.mapped.test;
+
+import javax.ws.rs.core.Response.Status;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.methods.DeleteMethod;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.apache.commons.httpclient.methods.PostMethod;
+import org.apache.commons.httpclient.methods.PutMethod;
+import org.apache.commons.httpclient.methods.StringRequestEntity;
+
+import framework.defaults.test.FVTTestCase;
+
+public class ExceptionsMappedProviderTest extends FVTTestCase {
+
+    public static junit.framework.Test suite() {
+        return FVTTestCase.getTestSuite(ExceptionsMappedProviderTest.class,
+                "jaxrs.tests.exceptions.mapped.server.GuestbookApplication");
+    }
+
+    public String getBaseURI() {
+        return super.getBaseURI() + "/guestbookmapped";
+    }
+
+    /**
+     * Test the positive workflow where a comment with a message and author is
+     * successfully posted to the Guestbook.
+     *
+     * @throws Exception
+     */
+    public void testRegularWorkflow() throws Exception {
+        HttpClient client = new HttpClient();
+
+        PostMethod postMethod = new PostMethod(getBaseURI());
+        postMethod
+                .setRequestEntity(new StringRequestEntity(
+                        "<comment><message>Hello World!</message><author>Anonymous</author></comment>",
+                        "text/xml", null));
+        client.executeMethod(postMethod);
+        assertEquals(201, postMethod.getStatusCode());
+        String newPostURILocation = postMethod.getResponseHeader("Location")
+                .getValue();
+
+        GetMethod getMethod = new GetMethod(newPostURILocation);
+        client.executeMethod(getMethod);
+        assertEquals(200, getMethod.getStatusCode());
+        assertEquals(
+                "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><comment><author>Anonymous</author><id>1</id><message>Hello World!</message></comment>",
+                getMethod.getResponseBodyAsString());
+    }
+
+    /**
+     * Tests a method that throws an emptily constructed
+     * <code>WebApplicationException</code>.
+     *
+     * @throws Exception
+     */
+    public void testWebApplicationExceptionDefaultMappedProvider()
+            throws Exception {
+        HttpClient client = new HttpClient();
+
+        PostMethod postMethod = new PostMethod(getBaseURI());
+        postMethod.setRequestEntity(new StringRequestEntity(
+                "<comment></comment>", "text/xml", null));
+        client.executeMethod(postMethod);
+        assertEquals(Status.INTERNAL_SERVER_ERROR.getStatusCode(), postMethod
+                .getStatusCode());
+        assertEquals(getBaseURI(), postMethod
+                .getResponseHeader("ExceptionPage").getValue());
+        assertEquals("", postMethod.getResponseBodyAsString());
+    }
+
+    /**
+     * Tests a method that throws a <code>WebApplicationException</code> with an
+     * integer status code.
+     *
+     * @throws Exception
+     */
+    public void testWebApplicationExceptionStatusCodeSetMappedProvider()
+            throws Exception {
+        HttpClient client = new HttpClient();
+        PostMethod postMethod = new PostMethod(getBaseURI());
+        postMethod
+                .setRequestEntity(new StringRequestEntity(
+                        "<comment><message>Suppose to fail with missing author.</message></comment>",
+                        "text/xml", null));
+        client.executeMethod(postMethod);
+        assertEquals(497, postMethod.getStatusCode());
+        assertEquals(getBaseURI(), postMethod
+                .getResponseHeader("ExceptionPage").getValue());
+        assertEquals("", postMethod.getResponseBodyAsString());
+    }
+
+    /**
+     * Tests a method that throws a <code>WebApplicationException</code> with a
+     * Response.Status set.
+     *
+     * @throws Exception
+     */
+    public void testWebApplicationExceptionResponseStatusSetMappedProvider()
+            throws Exception {
+        HttpClient client = new HttpClient();
+        PostMethod postMethod = new PostMethod(getBaseURI());
+        postMethod.setRequestEntity(new StringRequestEntity("", "text/xml",
+                null));
+        client.executeMethod(postMethod);
+        assertEquals(496, postMethod.getStatusCode());
+        assertEquals(getBaseURI(), postMethod
+                .getResponseHeader("ExceptionPage").getValue());
+        assertEquals("", postMethod.getResponseBodyAsString());
+    }
+
+    /**
+     * Tests a method that throws a <code>WebApplicationException</code> with a
+     * Response.
+     *
+     * @throws Exception
+     */
+    public void testWebApplicationExceptionResponseSetMappedProvider()
+            throws Exception {
+        HttpClient client = new HttpClient();
+
+        PostMethod postMethod = new PostMethod(getBaseURI());
+        postMethod.setRequestEntity(new StringRequestEntity(
+                "<comment><author>Anonymous</author></comment>", "text/xml",
+                null));
+        client.executeMethod(postMethod);
+        assertEquals(496, postMethod.getStatusCode());
+        assertEquals(getBaseURI(), postMethod
+                .getResponseHeader("ExceptionPage").getValue());
+        assertEquals(
+                "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><commenterror><message>WebApplicationExceptionMapProvider:Missing the message in the comment.</message></commenterror>",
+                postMethod.getResponseBodyAsString());
+    }
+
+    /**
+     * Tests a method that throws a subclass of
+     * <code>WebApplicationException</code> with a Response.
+     *
+     * @throws Exception
+     */
+    public void testCustomWebApplicationExceptionMappedProvider()
+            throws Exception {
+        HttpClient client = new HttpClient();
+
+        PostMethod postMethod = new PostMethod(getBaseURI());
+        postMethod.setRequestEntity(new StringRequestEntity(
+                "<comment><message></message><author></author></comment>",
+                "text/xml", null));
+        client.executeMethod(postMethod);
+        assertEquals(498, postMethod.getStatusCode());
+        assertEquals(getBaseURI(), postMethod
+                .getResponseHeader("ExceptionPage").getValue());
+        assertEquals(
+                "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><commenterror><message>WebApplicationExceptionMapProvider:Cannot post an invalid message.</message></commenterror>",
+                postMethod.getResponseBodyAsString());
+    }
+
+    /**
+     * Tests a method that throws a runtime exception.
+     *
+     * @throws Exception
+     */
+    public void testRuntimeExceptionMappedProvider() throws Exception {
+        HttpClient client = new HttpClient();
+
+        /*
+         * abcd is an invalid ID so a NumberFormatException will be thrown in
+         * the resource
+         */
+        DeleteMethod postMethod = new DeleteMethod(getBaseURI() + "/abcd");
+        client.executeMethod(postMethod);
+        assertEquals(450, postMethod.getStatusCode());
+        assertEquals(
+                "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><commenterror><message>For input string: &quot;abcd&quot;</message></commenterror>",
+                postMethod.getResponseBodyAsString());
+    }
+
+    /**
+     * Tests a method that throws a NullPointerException inside a called method.
+     *
+     * @throws Exception
+     */
+    public void testNullPointerExceptionMappedProvider() throws Exception {
+        HttpClient client = new HttpClient();
+
+        DeleteMethod postMethod = new DeleteMethod(getBaseURI() + "/10000");
+        client.executeMethod(postMethod);
+        assertEquals(451, postMethod.getStatusCode());
+        assertEquals(
+                "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><commenterror><message>The comment did not previously exist.</message></commenterror>",
+                postMethod.getResponseBodyAsString());
+    }
+
+    /**
+     * Tests a method that throws an error.
+     *
+     * @throws Exception
+     */
+    public void testErrorMappedProvider() throws Exception {
+        HttpClient client = new HttpClient();
+
+        DeleteMethod postMethod = new DeleteMethod(getBaseURI() + "/-99999");
+        client.executeMethod(postMethod);
+        assertEquals(453, postMethod.getStatusCode());
+        assertEquals(
+                "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><commenterror><message>Simulated error</message></commenterror>",
+                postMethod.getResponseBodyAsString());
+    }
+
+    /**
+     * Tests a method that throws a checked exception.
+     *
+     * @throws Exception
+     */
+    public void testCheckExceptionMappedProvider() throws Exception {
+        HttpClient client = new HttpClient();
+
+        PutMethod putMethod = new PutMethod(getBaseURI() + "/-99999");
+        putMethod
+                .setRequestEntity(new StringRequestEntity(
+                        "<comment><id></id><message></message><author></author></comment>",
+                        "text/xml", null));
+        client.executeMethod(putMethod);
+        assertEquals(454, putMethod.getStatusCode());
+        assertEquals(
+                "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><commenterror><message>Unexpected ID.</message></commenterror>",
+                putMethod.getResponseBodyAsString());
+    }
+
+    /*
+     * TODO :
+     * Need way to somehow check that exceptions are properly propagated
+     *
+     * Test precedence chain.
+     */
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/nomapping/buildTest.xml
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/nomapping/buildTest.xml?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/nomapping/buildTest.xml (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/nomapping/buildTest.xml Tue Jun 23 05:37:57 2009
@@ -0,0 +1,24 @@
+<?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.
+  -->
+
+<project name="jaxrs.tests.exceptions.nomapping" default="all">
+	<import file="../../../../buildCommon.xml" />
+</project>

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/nomapping/server/Comment.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/nomapping/server/Comment.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/nomapping/server/Comment.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/nomapping/server/Comment.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,58 @@
+/*
+ * 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 jaxrs.tests.exceptions.nomapping.server;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement(name = "comment")
+public class Comment {
+
+    private Integer id;
+
+    private String message;
+
+    private String author;
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    @XmlElement(nillable = false)
+    public String getMessage() {
+        return message;
+    }
+
+    public void setMessage(String message) {
+        this.message = message;
+    }
+
+    public String getAuthor() {
+        return author;
+    }
+
+    public void setAuthor(String author) {
+        this.author = author;
+    }
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/nomapping/server/CommentError.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/nomapping/server/CommentError.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/nomapping/server/CommentError.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/nomapping/server/CommentError.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,39 @@
+/*
+ * 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 jaxrs.tests.exceptions.nomapping.server;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement(name = "commenterror")
+public class CommentError {
+
+    private String errorMessage;
+
+    public String getErrorMessage() {
+        return errorMessage;
+    }
+
+    @XmlElement(name = "message")
+    public void setErrorMessage(String errorMessage) {
+        this.errorMessage = errorMessage;
+    }
+
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/nomapping/server/CommentList.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/nomapping/server/CommentList.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/nomapping/server/CommentList.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/nomapping/server/CommentList.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,46 @@
+/*
+ * 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 jaxrs.tests.exceptions.nomapping.server;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlRootElement;
+
+import com.sun.xml.internal.txw2.annotation.XmlElement;
+
+@XmlRootElement(name = "comments")
+public class CommentList {
+
+    private List<Comment> comments = new ArrayList<Comment>();
+
+    public CommentList() {
+        /* do nothing */
+    }
+
+    @XmlElement("comment")
+    public List<Comment> getComments() {
+        return comments;
+    }
+
+    public void setMessages(List<Comment> comments) {
+        this.comments = comments;
+    }
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/nomapping/server/Guestbook.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/nomapping/server/Guestbook.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/nomapping/server/Guestbook.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/nomapping/server/Guestbook.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,166 @@
+/*
+ * 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 jaxrs.tests.exceptions.nomapping.server;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
+import javax.ws.rs.core.Response.Status;
+
+/**
+ * The main JAX-RS resource.
+ */
+@Path("guestbooknomap")
+public class Guestbook {
+
+    private static class MyWebAppException extends WebApplicationException {
+
+        private static final long serialVersionUID = -2022185988670037226L;
+
+        final private Response resp;
+
+        public MyWebAppException(int status) {
+            CommentError error = new CommentError();
+            error.setErrorMessage("Cannot post an invalid message.");
+            resp = Response.status(status).entity(error).build();
+        }
+
+        @Override
+        public Response getResponse() {
+            return resp;
+        }
+    }
+
+    /**
+     * Adds a new message to the database.
+     *
+     * @return HTTP status 200
+     */
+    @POST
+    @Consumes( { "text/xml" })
+    @Produces( { "text/xml" })
+    public Response createMessage(Comment aMessage, @Context UriInfo uriInfo) {
+        if (aMessage == null) {
+            WebApplicationException webAppException = new WebApplicationException(
+                    Status.BAD_REQUEST);
+            throw webAppException;
+        }
+
+        if (aMessage.getMessage() == null && aMessage.getAuthor() == null) {
+            throw new WebApplicationException();
+        }
+
+        if (aMessage.getMessage() == null) {
+            CommentError error = new CommentError();
+            error.setErrorMessage("Missing the message in the comment.");
+            Response malformedCommentResponse = Response.status(
+                    Status.BAD_REQUEST).entity(error).build();
+            WebApplicationException webAppException = new WebApplicationException(
+                    malformedCommentResponse);
+            throw webAppException;
+        }
+
+        if (aMessage.getAuthor() == null) {
+            WebApplicationException webAppException = new WebApplicationException(
+                    499);
+            throw webAppException;
+        }
+
+        if ("".equals(aMessage.getMessage())) {
+            throw new MyWebAppException(498);
+        }
+
+        /*
+         * Set the message id to a server decided message, even if the client
+         * set it.
+         */
+        int id = GuestbookDatabase.getGuestbook().getAndIncrementCounter();
+        aMessage.setId(id);
+
+        GuestbookDatabase.getGuestbook().storeComment(aMessage);
+        try {
+            return Response
+                    .created(
+                            new URI(uriInfo.getAbsolutePath() + "/"
+                                    + aMessage.getId())).entity(aMessage)
+                    .build();
+        } catch (URISyntaxException e) {
+            e.printStackTrace();
+            throw new RuntimeException(e);
+        }
+    }
+
+    @PUT
+    @Path("{id}")
+    public Response updateMessage(Comment aMessage, @PathParam("id") String msgId)
+            throws GuestbookException {
+        /*
+         * If no message data was sent, then return the null request.
+         */
+        if (aMessage == null) {
+            return Response.status(Status.BAD_REQUEST).build();
+        }
+
+        if (aMessage.getId() == null || !aMessage.getId().equals(msgId)) {
+            throw new GuestbookException("Unexpected ID.");
+        }
+
+        Comment existingComment = GuestbookDatabase.getGuestbook().getComment(
+                Integer.valueOf(msgId));
+        if (existingComment == null) {
+            throw new GuestbookException(
+                    "Cannot find existing comment to update.");
+        }
+        GuestbookDatabase.getGuestbook().storeComment(aMessage);
+        return Response.ok(aMessage).build();
+    }
+
+    @GET
+    @Path("/{id}")
+    @Produces( { "text/xml" })
+    public Response readMessage(@PathParam("id") String msgId) {
+        Comment msg = GuestbookDatabase.getGuestbook().getComment(
+                Integer.valueOf(msgId));
+        if (msg == null) {
+            return Response.status(404).build();
+        }
+
+        return Response.ok(msg).build();
+    }
+
+    @DELETE
+    @Path("{id}")
+    public Response deleteMessage(@PathParam("id") String msgId) {
+        GuestbookDatabase.getGuestbook().deleteComment(Integer.valueOf(msgId));
+        return Response.noContent().build();
+    }
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/nomapping/server/GuestbookApplication.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/nomapping/server/GuestbookApplication.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/nomapping/server/GuestbookApplication.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/nomapping/server/GuestbookApplication.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,39 @@
+/*
+ * 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 jaxrs.tests.exceptions.nomapping.server;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.ws.rs.core.Application;
+
+/**
+ * The JAX-RS Application config class.
+ */
+public class GuestbookApplication extends Application {
+
+    @Override
+    public Set<Class<?>> getClasses() {
+        Set<Class<?>> classes = new HashSet<Class<?>>();
+        classes.add(Guestbook.class);
+        return classes;
+    }
+
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/nomapping/server/GuestbookDatabase.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/nomapping/server/GuestbookDatabase.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/nomapping/server/GuestbookDatabase.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/nomapping/server/GuestbookDatabase.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,74 @@
+/*
+ * 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 jaxrs.tests.exceptions.nomapping.server;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * A simple in-memory data store.
+ */
+public class GuestbookDatabase {
+
+    private static GuestbookDatabase guestbook = new GuestbookDatabase();
+
+    private Map<Integer, Comment> comments = Collections
+            .synchronizedMap(new HashMap<Integer, Comment>());
+
+    private int counter = 0;
+
+    private GuestbookDatabase() {
+        /* private singleton constructor */
+    }
+
+    public static GuestbookDatabase getGuestbook() {
+        return guestbook;
+    }
+
+    public Comment getComment(Integer id) {
+        return comments.get(id);
+    }
+
+    public void storeComment(Comment c) {
+        comments.put(c.getId(), c);
+    }
+
+    public Collection<Integer> getCommentKeys() {
+        return comments.keySet();
+    }
+
+    public void deleteComment(Integer id) {
+        if (id == -99999) {
+            throw new Error("Simulated error");
+        }
+
+        if (comments.remove(id) == null) {
+            throw new NullPointerException(
+                    "The comment did not previously exist.");
+        }
+    }
+
+    public synchronized int getAndIncrementCounter() {
+        ++counter;
+        return counter;
+    }
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/nomapping/server/GuestbookDatabaseException.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/nomapping/server/GuestbookDatabaseException.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/nomapping/server/GuestbookDatabaseException.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/nomapping/server/GuestbookDatabaseException.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,41 @@
+/*
+ * 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 jaxrs.tests.exceptions.nomapping.server;
+
+public class GuestbookDatabaseException extends Exception {
+
+    private static final long serialVersionUID = 3656497291087821230L;
+
+    public GuestbookDatabaseException() {
+        super();
+    }
+
+    public GuestbookDatabaseException(String message) {
+        super(message);
+    }
+
+    public GuestbookDatabaseException(Throwable cause) {
+        super(cause);
+    }
+
+    public GuestbookDatabaseException(String message, Throwable cause) {
+        super(message, cause);
+    }
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/nomapping/server/GuestbookException.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/nomapping/server/GuestbookException.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/nomapping/server/GuestbookException.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/nomapping/server/GuestbookException.java Tue Jun 23 05:37:57 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 jaxrs.tests.exceptions.nomapping.server;
+
+public class GuestbookException extends Exception {
+
+    private static final long serialVersionUID = -1975560538784455458L;
+
+    public GuestbookException() {
+        super();
+    }
+
+    public GuestbookException(String message) {
+        super(message);
+    }
+
+    public GuestbookException(Throwable cause) {
+        super(cause);
+    }
+
+    public GuestbookException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/nomapping/server/ObjectFactory.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/nomapping/server/ObjectFactory.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/nomapping/server/ObjectFactory.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/nomapping/server/ObjectFactory.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,39 @@
+/*
+ * 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 jaxrs.tests.exceptions.nomapping.server;
+
+import javax.xml.bind.annotation.XmlRegistry;
+
+@XmlRegistry
+public class ObjectFactory {
+
+    public CommentError createCommentError() {
+        return new CommentError();
+    }
+
+    public Comment createComment() {
+        return new Comment();
+    }
+
+    public CommentList createCommentList() {
+        return new CommentList();
+    }
+
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/nomapping/server/WEB-INF/web-no-runtime.xml
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/nomapping/server/WEB-INF/web-no-runtime.xml?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/nomapping/server/WEB-INF/web-no-runtime.xml (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/nomapping/server/WEB-INF/web-no-runtime.xml Tue Jun 23 05:37:57 2009
@@ -0,0 +1,34 @@
+<?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.
+  -->
+
+<web-app id="WebApp_ID" version="2.5"
+	xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
+	<servlet>
+		<servlet-name>Guestbook</servlet-name>
+		<servlet-class>jaxrs.tests.exceptions.nomapping.server.GuestbookApplication</servlet-class>
+		<load-on-startup>1</load-on-startup>
+	</servlet>
+	<servlet-mapping>
+		<servlet-name>Guestbook</servlet-name>
+		<url-pattern>/*</url-pattern>
+	</servlet-mapping>
+</web-app>
\ No newline at end of file

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/nomapping/server/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/nomapping/server/WEB-INF/web.xml?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/nomapping/server/WEB-INF/web.xml (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/exceptions/nomapping/server/WEB-INF/web.xml Tue Jun 23 05:37:57 2009
@@ -0,0 +1,38 @@
+<?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.
+  -->
+
+<web-app id="WebApp_ID" version="2.5"
+	xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
+	<servlet>
+		<servlet-name>Guestbook</servlet-name>
+		<servlet-class>com.ibm.ws.jaxrs.web.RESTServlet</servlet-class>
+		<init-param>
+			<param-name>javax.ws.rs.Application</param-name>
+			<param-value>jaxrs.tests.exceptions.nomapping.server.GuestbookApplication</param-value>
+		</init-param>
+		<load-on-startup>1</load-on-startup>
+	</servlet>
+	<servlet-mapping>
+		<servlet-name>Guestbook</servlet-name>
+		<url-pattern>/*</url-pattern>
+	</servlet-mapping>
+</web-app>
\ No newline at end of file



Mime
View raw message