Mercurial > dive4elements > framework
annotate artifact-database/src/main/java/de/intevation/artifactdatabase/rest/UserResource.java @ 221:f75f83af19e0
Made the 'attribute' document of an ArtifactCollection accessible with getter and setter methods.
artifacts/trunk@1564 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Thu, 24 Mar 2011 18:42:43 +0000 |
parents | f92ad0e40df2 |
children | b77465617071 |
rev | line source |
---|---|
137
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 /* |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 * Copyright (c) 2011 by Intevation GmbH |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
3 * |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
4 * This program is free software under the LGPL (>=v2.1) |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
5 * Read the file LGPL.txt coming with the software for details |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
6 * or visit http://www.gnu.org/licenses/ if it does not exist. |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
7 */ |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
8 package de.intevation.artifactdatabase.rest; |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
9 |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 import de.intevation.artifacts.ArtifactDatabase; |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
11 import de.intevation.artifacts.ArtifactDatabaseException; |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
12 |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
13 import de.intevation.artifacts.common.ArtifactNamespaceContext; |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
14 import de.intevation.artifacts.common.utils.XMLUtils; |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
16 import java.io.IOException; |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
18 import org.apache.log4j.Logger; |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
19 |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
20 import org.restlet.data.MediaType; |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
21 import org.restlet.data.Status; |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
22 import org.restlet.ext.xml.DomRepresentation; |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
23 import org.restlet.representation.EmptyRepresentation; |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
24 import org.restlet.representation.Representation; |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
25 import org.restlet.Request; |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
26 import org.restlet.Response; |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
27 |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
28 import org.w3c.dom.Document; |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
29 |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
30 /** |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
31 * A resource that handles actions to a specific user. |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
32 * |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
33 * @author <a href="mailto:ingo.weinzierl@intevation">Ingo Weinzierl</a> |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 */ |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
35 public class UserResource |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
36 extends BaseResource |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
37 { |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
38 /** The logger that is used in this class.*/ |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
39 private static Logger logger = Logger.getLogger(UserResource.class); |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
40 |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
41 /** server URL where to reach the resource.*/ |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
42 public static final String PATH = "/user/{uuid}"; |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
43 |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
44 /** |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
45 * XPath to figure out the type of action (feed, advance) via the |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
46 * incoming POST request. |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
47 */ |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
48 public static final String XPATH_ACTION = "/art:action/art:type/@name"; |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
49 |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
50 /** Error message if no action was given.*/ |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
51 public static final String NO_ACTION_MSG = "no action given"; |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
52 |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
53 /** Error message if a unknown action was given.*/ |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
54 public static final String NO_SUCH_ACTION_MSG = "no such action"; |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
55 |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
56 /** Action name for deleting users.*/ |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
57 public static final String ACTION_DELETE = "delete"; |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
58 |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
59 |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
60 @Override |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
61 protected Representation innerPost(Representation requestRepr) { |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
62 Document inputDocument = null; |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
63 |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
64 try { |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
65 DomRepresentation input = new DomRepresentation(requestRepr); |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
66 input.setNamespaceAware(true); |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
67 inputDocument = input.getDocument(); |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
68 } |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
69 catch (IOException ioe) { |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
70 logger.error(ioe.getMessage()); |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
71 Response response = getResponse(); |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
72 response.setStatus(Status.CLIENT_ERROR_BAD_REQUEST, ioe); |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
73 return new EmptyRepresentation(); |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
74 } |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
75 |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
76 String action = XMLUtils.xpathString( |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
77 inputDocument, |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
78 XPATH_ACTION, |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
79 ArtifactNamespaceContext.INSTANCE); |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
80 |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
81 if (action == null || action.length() == 0) { |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
82 Response response = getResponse(); |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
83 response.setStatus( |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
84 Status.CLIENT_ERROR_BAD_REQUEST, NO_ACTION_MSG); |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
85 return new EmptyRepresentation(); |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
86 } |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
87 |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
88 Request request = getRequest(); |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
89 |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
90 String identifier = (String)request.getAttributes().get("uuid"); |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
91 |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
92 ArtifactDatabase db = getArtifactDatabase(); |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
93 |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
94 return dispatch(identifier, action, inputDocument, db); |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
95 } |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
96 |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
97 /** |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
98 * Method to figure out which POST action (feed or advance) was |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
99 * triggered and perform this operation on the artifact specified |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
100 * by 'identifier' and found in the artifact database 'db' |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
101 * @param identifier The identifier of the artifact. |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
102 * @param action The action to be performed. |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
103 * @param source The input document to further parameterize the |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
104 * operation. |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
105 * @param db The artifact database where to find the artifact. |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
106 * @return The representation produced by the performed action. |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
107 */ |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
108 protected Representation dispatch( |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
109 String identifier, |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
110 String action, |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
111 Document source, |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
112 ArtifactDatabase db) |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
113 { |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
114 Document out = null; |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
115 |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
116 logger.info("Action: " + action + " | User: " + identifier); |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
117 |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
118 try { |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
119 if (action.equals(ACTION_DELETE)) { |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
120 out = db.deleteUser(identifier, getCallMeta()); |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
121 } |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
122 else { |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
123 throw new ArtifactDatabaseException(NO_SUCH_ACTION_MSG); |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
124 } |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
125 } |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
126 catch (ArtifactDatabaseException adbe) { |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
127 logger.warn(adbe.getLocalizedMessage(), adbe); |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
128 Response response = getResponse(); |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
129 response.setStatus( |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
130 Status.CLIENT_ERROR_BAD_REQUEST, adbe.getMessage()); |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
131 return new EmptyRepresentation(); |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
132 } |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
133 |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
134 return new DomRepresentation(MediaType.APPLICATION_XML, out); |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
135 } |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
136 } |
f92ad0e40df2
Added a resource that handles user specific actions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
137 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |