You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wink.apache.org by bl...@apache.org on 2009/08/07 05:10:46 UTC

svn commit: r801869 [10/21] - in /incubator/wink/trunk: wink-integration-test/ wink-integration-test/wink-server-integration-test-support/ wink-integration-test/wink-server-integration-test-support/src/main/java/org/apache/wink/test/integration/ wink-i...

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/contextresolver/DepartmentDatabase.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/contextresolver/DepartmentDatabase.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/contextresolver/DepartmentDatabase.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/contextresolver/DepartmentDatabase.java Fri Aug  7 03:10:22 2009
@@ -0,0 +1,50 @@
+/*
+ * 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.wink.itest.contextresolver;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+public class DepartmentDatabase {
+
+    private static Map<String, Department> departmentDB = new HashMap<String, Department>();
+
+    public static Collection<Department> getDepartments() {
+        return departmentDB.values();
+    }
+
+    public static void addDepartment(Department department) {
+        departmentDB.put(department.getDepartmentId(), department);
+    }
+
+    public static Department getDepartment(String departmentId) {
+        return departmentDB.get(departmentId);
+    }
+
+    public static Department removeDepartment(String departmentId) {
+        return departmentDB.remove(departmentId);
+    }
+
+    public static void clearEntries() {
+        departmentDB.clear();
+    }
+
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/contextresolver/DepartmentListWrapper.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/contextresolver/DepartmentListWrapper.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/contextresolver/DepartmentListWrapper.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/contextresolver/DepartmentListWrapper.java Fri Aug  7 03:10:22 2009
@@ -0,0 +1,50 @@
+/*
+ * 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.wink.itest.contextresolver;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement
+public class DepartmentListWrapper {
+
+    @XmlElement
+    private List<Department> departmentList = new LinkedList<Department>();
+
+    public List<Department> getDepartmentList() {
+        return departmentList;
+    }
+
+    public String toString() {
+        StringBuffer sb = new StringBuffer();
+        for (Department dept : departmentList) {
+            sb.append("ID: " + dept.getDepartmentId());
+            sb.append("\n");
+            sb.append("NAME: " + dept.getDepartmentName());
+            sb.append("\n");
+        }
+
+        return sb.toString();
+    }
+
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/contextresolver/Departments.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/contextresolver/Departments.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/contextresolver/Departments.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/contextresolver/Departments.java Fri Aug  7 03:10:22 2009
@@ -0,0 +1,100 @@
+/*
+ * 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.wink.itest.contextresolver;
+
+import java.util.Iterator;
+import java.util.List;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.HEAD;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.Request;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.ResponseBuilder;
+
+@Path(value = "/departments")
+public class Departments {
+
+    @GET
+    @Produces(value = "text/xml")
+    public DepartmentListWrapper getDepartments() {
+        Iterator<Department> dptIter = DepartmentDatabase.getDepartments().iterator();
+        DepartmentListWrapper wrapper = new DepartmentListWrapper();
+        List<Department> dptList = wrapper.getDepartmentList();
+        while (dptIter.hasNext()) {
+            dptList.add(dptIter.next());
+        }
+        return wrapper;
+    }
+
+    @GET
+    @Path(value = "/{departmentId}")
+    @Produces(value = {"text/xml"})
+    public Response getDepartment(@PathParam(value = "departmentId") String departmentId,
+                                  @QueryParam(value = "type") String type,
+                                  @Context Request req) {
+        Department dept = DepartmentDatabase.getDepartment(departmentId);
+        return Response.ok(dept).build();
+    }
+
+    @DELETE
+    @Path(value = "/{departmentId}")
+    public Response deleteDepartment(@PathParam(value = "departmentId") String departmentId) {
+        Department dept = DepartmentDatabase.removeDepartment(departmentId);
+        if (dept == null) {
+            return Response.status(404).build();
+        }
+        return Response.status(204).build();
+    }
+
+    @POST
+    @Consumes(value = "text/xml")
+    public void addDepartment(Department department) {
+        DepartmentDatabase.addDepartment(department);
+    }
+
+    @HEAD
+    @Produces(value = "text/xml")
+    @Path(value = "/{departmentId}")
+    public Response exists(@PathParam(value = "departmentId") String departmentId) {
+        Department dpt = DepartmentDatabase.getDepartment(departmentId);
+        Response resp = null;
+        if (dpt != null) {
+            ResponseBuilder rb = Response.ok();
+            rb.entity(dpt);
+            resp = rb.build();
+            resp.getMetadata().add("resolved-id", departmentId);
+        } else {
+            ResponseBuilder rb = Response.noContent();
+            rb.entity(null);
+            resp = rb.build();
+            resp.getMetadata().add("unresolved-id", departmentId);
+        }
+        return resp;
+    }
+
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/contextresolver/ObjectFactory.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/contextresolver/ObjectFactory.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/contextresolver/ObjectFactory.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/contextresolver/ObjectFactory.java Fri Aug  7 03:10:22 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 org.apache.wink.itest.contextresolver;
+
+import javax.xml.bind.annotation.XmlRegistry;
+
+@XmlRegistry
+public class ObjectFactory {
+
+    public ObjectFactory() {
+
+    }
+
+    public Department createDepartment() {
+        return new Department();
+    }
+
+    public DepartmentListWrapper createDepartmentListWrapper() {
+        return new DepartmentListWrapper();
+    }
+
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/contextresolver/User.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/contextresolver/User.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/contextresolver/User.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/contextresolver/User.java Fri Aug  7 03:10:22 2009
@@ -0,0 +1,34 @@
+/*
+ * 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.wink.itest.contextresolver;
+
+public class User {
+
+    private String userName;
+
+    public String getUserName() {
+        return userName;
+    }
+
+    public void setUserName(String userName) {
+        this.userName = userName;
+    }
+
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/contextresolver/UserAccount.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/contextresolver/UserAccount.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/contextresolver/UserAccount.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/contextresolver/UserAccount.java Fri Aug  7 03:10:22 2009
@@ -0,0 +1,55 @@
+/*
+ * 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.wink.itest.contextresolver;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.xml.bind.JAXBElement;
+import javax.xml.namespace.QName;
+
+@Path(value = "/user")
+public class UserAccount {
+
+    private static Map<String, User> users = new HashMap<String, User>();
+
+    @POST
+    @Consumes(value = "text/xml")
+    public void createUser(JAXBElement<User> element) {
+        User user = element.getValue();
+        users.put(user.getUserName(), user);
+    }
+
+    @GET
+    @Path(value = "/{userName}")
+    @Produces(value = "text/xml")
+    public JAXBElement<User> getUser(@PathParam(value = "userName") String userName) {
+        User user = users.get(userName);
+        return new JAXBElement<User>(new QName("http://jaxb.context.tests", "user"), User.class,
+                                     user);
+    }
+
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/contextresolver/UserContextProvider.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/contextresolver/UserContextProvider.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/contextresolver/UserContextProvider.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/contextresolver/UserContextProvider.java Fri Aug  7 03:10:22 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.wink.itest.contextresolver;
+
+import javax.ws.rs.ext.ContextResolver;
+import javax.ws.rs.ext.Provider;
+import javax.xml.bind.JAXBContext;
+
+import org.apache.wink.itest.contextresolver.jaxb.ObjectFactory;
+
+@Provider
+public class UserContextProvider implements ContextResolver<JAXBContext> {
+
+    public JAXBContext getContext(Class<?> clazz) {
+        if (clazz == User.class) {
+            try {
+                return JAXBContext.newInstance(ObjectFactory.class);
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+        return null;
+    }
+
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/contextresolver/jaxb/ObjectFactory.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/contextresolver/jaxb/ObjectFactory.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/contextresolver/jaxb/ObjectFactory.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/contextresolver/jaxb/ObjectFactory.java Fri Aug  7 03:10:22 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 org.apache.wink.itest.contextresolver.jaxb;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRegistry;
+
+import org.apache.wink.itest.contextresolver.User;
+
+@XmlRegistry
+public class ObjectFactory {
+
+    @XmlElement(name = "user", namespace = "http://jaxb.context.tests")
+    public User createUser() {
+        return new User();
+    }
+
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/mapped/Comment.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/mapped/Comment.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/mapped/Comment.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/mapped/Comment.java Fri Aug  7 03:10:22 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.wink.itest.exceptionmappers.mapped;
+
+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;
+    }
+
+    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/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/mapped/CommentError.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/mapped/CommentError.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/mapped/CommentError.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/mapped/CommentError.java Fri Aug  7 03:10:22 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 org.apache.wink.itest.exceptionmappers.mapped;
+
+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/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/mapped/CommentList.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/mapped/CommentList.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/mapped/CommentList.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/mapped/CommentList.java Fri Aug  7 03:10:22 2009
@@ -0,0 +1,45 @@
+/*
+ * 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.wink.itest.exceptionmappers.mapped;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement(name = "comments")
+public class CommentList {
+
+    private List<Comment> comments = new ArrayList<Comment>();
+
+    public CommentList() {
+        /* do nothing */
+    }
+
+    @XmlElement(name = "comment")
+    public List<Comment> getComments() {
+        return comments;
+    }
+
+    public void setMessages(List<Comment> comments) {
+        this.comments = comments;
+    }
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/mapped/Guestbook.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/mapped/Guestbook.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/mapped/Guestbook.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/mapped/Guestbook.java Fri Aug  7 03:10:22 2009
@@ -0,0 +1,167 @@
+/*
+ * 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.wink.itest.exceptionmappers.mapped;
+
+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).type("text/xml").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).type("text/xml").build();
+            WebApplicationException webAppException =
+                new WebApplicationException(malformedCommentResponse);
+            throw webAppException;
+        }
+
+        if ("throwemptywebappexception".equals(aMessage.getMessage())) {
+            throw new WebApplicationException(Response.status(481)
+                .header("throwemptyentitywebappexception", "Some message").build());
+        }
+
+        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/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/mapped/GuestbookApplication.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/mapped/GuestbookApplication.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/mapped/GuestbookApplication.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/mapped/GuestbookApplication.java Fri Aug  7 03:10:22 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 org.apache.wink.itest.exceptionmappers.mapped;
+
+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/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/mapped/GuestbookDatabase.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/mapped/GuestbookDatabase.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/mapped/GuestbookDatabase.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/mapped/GuestbookDatabase.java Fri Aug  7 03:10:22 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 org.apache.wink.itest.exceptionmappers.mapped;
+
+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/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/mapped/GuestbookDatabaseException.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/mapped/GuestbookDatabaseException.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/mapped/GuestbookDatabaseException.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/mapped/GuestbookDatabaseException.java Fri Aug  7 03:10:22 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 org.apache.wink.itest.exceptionmappers.mapped;
+
+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/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/mapped/GuestbookError.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/mapped/GuestbookError.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/mapped/GuestbookError.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/mapped/GuestbookError.java Fri Aug  7 03:10:22 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 org.apache.wink.itest.exceptionmappers.mapped;
+
+public class GuestbookError extends Error {
+
+    private static final long serialVersionUID = -1247655313421068853L;
+
+    public GuestbookError(String message) {
+        super(message);
+    }
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/mapped/GuestbookErrorExceptionMappingProvider.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/mapped/GuestbookErrorExceptionMappingProvider.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/mapped/GuestbookErrorExceptionMappingProvider.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/mapped/GuestbookErrorExceptionMappingProvider.java Fri Aug  7 03:10:22 2009
@@ -0,0 +1,36 @@
+/*
+ * 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.wink.itest.exceptionmappers.mapped;
+
+import javax.ws.rs.core.MediaType;
+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).type(MediaType.APPLICATION_XML_TYPE).build();
+    }
+
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/mapped/GuestbookException.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/mapped/GuestbookException.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/mapped/GuestbookException.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/mapped/GuestbookException.java Fri Aug  7 03:10:22 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.wink.itest.exceptionmappers.mapped;
+
+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/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/mapped/GuestbookExceptionMapProvider.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/mapped/GuestbookExceptionMapProvider.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/mapped/GuestbookExceptionMapProvider.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/mapped/GuestbookExceptionMapProvider.java Fri Aug  7 03:10:22 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 org.apache.wink.itest.exceptionmappers.mapped;
+
+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).type("application/xml").build();
+    }
+
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/mapped/NullPointerExceptionMapProvider.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/mapped/NullPointerExceptionMapProvider.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/mapped/NullPointerExceptionMapProvider.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/mapped/NullPointerExceptionMapProvider.java Fri Aug  7 03:10:22 2009
@@ -0,0 +1,36 @@
+/*
+ * 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.wink.itest.exceptionmappers.mapped;
+
+import javax.ws.rs.core.MediaType;
+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).type(MediaType.APPLICATION_XML_TYPE).build();
+    }
+
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/mapped/ObjectFactory.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/mapped/ObjectFactory.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/mapped/ObjectFactory.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/mapped/ObjectFactory.java Fri Aug  7 03:10:22 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 org.apache.wink.itest.exceptionmappers.mapped;
+
+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/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/mapped/RuntimeExceptionMappingProvider.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/mapped/RuntimeExceptionMappingProvider.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/mapped/RuntimeExceptionMappingProvider.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/mapped/RuntimeExceptionMappingProvider.java Fri Aug  7 03:10:22 2009
@@ -0,0 +1,36 @@
+/*
+ * 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.wink.itest.exceptionmappers.mapped;
+
+import javax.ws.rs.core.MediaType;
+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).type(MediaType.APPLICATION_XML_TYPE).build();
+    }
+
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/mapped/WebApplicationExceptionMapProvider.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/mapped/WebApplicationExceptionMapProvider.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/mapped/WebApplicationExceptionMapProvider.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/mapped/WebApplicationExceptionMapProvider.java Fri Aug  7 03:10:22 2009
@@ -0,0 +1,57 @@
+/*
+ * 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.wink.itest.exceptionmappers.mapped;
+
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+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());
+
+        if (oldStatus == 499) {
+            builder.status(497);
+        } else if (oldStatus == Response.Status.BAD_REQUEST.getStatusCode()) {
+            System.out.println("SETTING 496");
+            builder.status(496);
+        } else if (oldStatus == 481) {
+            builder.status(491);
+            CommentError error = new CommentError();
+            error.setErrorMessage("WebApplicationExceptionMapProvider set message");
+            builder.entity(error).type(MediaType.APPLICATION_XML_TYPE);
+        }
+
+        return builder.build();
+    }
+
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/nomapper/Comment.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/nomapper/Comment.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/nomapper/Comment.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/nomapper/Comment.java Fri Aug  7 03:10:22 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 org.apache.wink.itest.exceptionmappers.nomapper;
+
+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/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/nomapper/CommentError.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/nomapper/CommentError.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/nomapper/CommentError.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/nomapper/CommentError.java Fri Aug  7 03:10:22 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 org.apache.wink.itest.exceptionmappers.nomapper;
+
+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/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/nomapper/CommentList.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/nomapper/CommentList.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/nomapper/CommentList.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/nomapper/CommentList.java Fri Aug  7 03:10:22 2009
@@ -0,0 +1,45 @@
+/*
+ * 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.wink.itest.exceptionmappers.nomapper;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement(name = "comments")
+public class CommentList {
+
+    private List<Comment> comments = new ArrayList<Comment>();
+
+    public CommentList() {
+        /* do nothing */
+    }
+
+    @XmlElement(name = "comment")
+    public List<Comment> getComments() {
+        return comments;
+    }
+
+    public void setMessages(List<Comment> comments) {
+        this.comments = comments;
+    }
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/nomapper/Guestbook.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/nomapper/Guestbook.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/nomapper/Guestbook.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/nomapper/Guestbook.java Fri Aug  7 03:10:22 2009
@@ -0,0 +1,161 @@
+/*
+ * 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.wink.itest.exceptionmappers.nomapper;
+
+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.MediaType;
+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).type("text/xml").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).type("text/xml").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).type(MediaType.TEXT_XML).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/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/nomapper/GuestbookApplication.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/nomapper/GuestbookApplication.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/nomapper/GuestbookApplication.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/nomapper/GuestbookApplication.java Fri Aug  7 03:10:22 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 org.apache.wink.itest.exceptionmappers.nomapper;
+
+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/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/nomapper/GuestbookDatabase.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/nomapper/GuestbookDatabase.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/nomapper/GuestbookDatabase.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/nomapper/GuestbookDatabase.java Fri Aug  7 03:10:22 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 org.apache.wink.itest.exceptionmappers.nomapper;
+
+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/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/nomapper/GuestbookDatabaseException.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/nomapper/GuestbookDatabaseException.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/nomapper/GuestbookDatabaseException.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/nomapper/GuestbookDatabaseException.java Fri Aug  7 03:10:22 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 org.apache.wink.itest.exceptionmappers.nomapper;
+
+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/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/nomapper/GuestbookException.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/nomapper/GuestbookException.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/nomapper/GuestbookException.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/nomapper/GuestbookException.java Fri Aug  7 03:10:22 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.wink.itest.exceptionmappers.nomapper;
+
+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/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/nomapper/ObjectFactory.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/nomapper/ObjectFactory.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/nomapper/ObjectFactory.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/nomapper/ObjectFactory.java Fri Aug  7 03:10:22 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 org.apache.wink.itest.exceptionmappers.nomapper;
+
+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/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/nullconditions/Application.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/nullconditions/Application.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/nullconditions/Application.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/nullconditions/Application.java Fri Aug  7 03:10:22 2009
@@ -0,0 +1,38 @@
+/*
+ * 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.wink.itest.exceptionmappers.nullconditions;
+
+import java.util.HashSet;
+import java.util.Set;
+
+public class Application extends javax.ws.rs.core.Application {
+
+    @Override
+    public Set<Class<?>> getClasses() {
+        Set<Class<?>> clazzes = new HashSet<Class<?>>();
+        clazzes.add(GuestbookNullExceptionMapper.class);
+        clazzes.add(GuestbookResource.class);
+        clazzes.add(GuestbookThrowExceptionMapper.class);
+        clazzes.add(GuestbookRuntimeExceptionMapper.class);
+        clazzes.add(GuestbookThrowableMapper.class);
+        return clazzes;
+    }
+
+}

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/nullconditions/GuestbookException.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/nullconditions/GuestbookException.java?rev=801869&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/nullconditions/GuestbookException.java (added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/exceptionmappers/nullconditions/GuestbookException.java Fri Aug  7 03:10:22 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 org.apache.wink.itest.exceptionmappers.nullconditions;
+
+public class GuestbookException extends Exception {
+
+    private static final long serialVersionUID = -6902290168001222679L;
+
+    public GuestbookException() {
+        super();
+    }
+
+    public GuestbookException(String message) {
+        super(message);
+    }
+
+    public GuestbookException(Throwable cause) {
+        super(cause);
+    }
+
+    public GuestbookException(String message, Throwable cause) {
+        super(message, cause);
+    }
+}