diff artifact-database/src/main/java/de/intevation/artifactdatabase/rest/ArtifactResource.java @ 40:af22d4de275c

Log RuntimeExceptions in REST calls to log4j. artifacts/trunk@112 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Wed, 23 Sep 2009 08:27:35 +0000
parents 7a01a464a83b
children 41c225c8bd41
line wrap: on
line diff
--- a/artifact-database/src/main/java/de/intevation/artifactdatabase/rest/ArtifactResource.java	Mon Sep 21 11:56:10 2009 +0000
+++ b/artifact-database/src/main/java/de/intevation/artifactdatabase/rest/ArtifactResource.java	Wed Sep 23 08:27:35 2009 +0000
@@ -1,8 +1,6 @@
 package de.intevation.artifactdatabase.rest;
 
-import org.restlet.resource.Get;  
-import org.restlet.resource.Post;  
-import org.restlet.resource.ServerResource;
+import org.restlet.resource.ResourceException;
 
 import org.restlet.representation.Representation;
 import org.restlet.representation.EmptyRepresentation;
@@ -31,7 +29,7 @@
  * @author Sascha L. Teichmann (sascha.teichmann@intevation)
  */
 public class ArtifactResource
-extends      ServerResource
+extends      BaseResource
 {
     private static Logger logger = Logger.getLogger(ArtifactResource.class);
 
@@ -47,9 +45,9 @@
     public static final String ADVANCE = "advance";
     public static final String FEED    = "feed";
 
-    @Get
-    public Representation represent() {
-
+    protected Representation innerGet()
+    throws                   ResourceException
+    {
         Request request = getRequest();
 
         String identifier = (String)request.getAttributes().get("uuid");
@@ -105,11 +103,7 @@
         return new DomRepresentation(MediaType.APPLICATION_XML, out);
     }
 
-    @Post
-    public Representation representPost() {
-        Request request = getRequest();
-
-        Representation requestRepr = request.getEntity();
+    protected Representation innerPost(Representation requestRepr) {
 
         Document inputDocument = null;
         try {
@@ -135,6 +129,8 @@
             return new EmptyRepresentation();
         }
 
+        Request request = getRequest();
+
         String identifier = (String)request.getAttributes().get("uuid");
 
         ArtifactDatabase db = (ArtifactDatabase)getContext()

http://dive4elements.wald.intevation.org