You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ace.apache.org by ja...@apache.org on 2016/01/29 16:40:00 UTC

svn commit: r1727600 [2/2] - in /ace/trunk: build/ build/resources/deps/ build/resources/src/ cnf/localrepo/ cnf/localrepo/com.sun.jersey.client/ cnf/localrepo/com.sun.jersey.core/ cnf/localrepo/com.sun.jersey.jersey-core/ cnf/localrepo/slf4j.api/ cnf/...

Added: ace/trunk/org.apache.ace.client.rest.itest/src/org/apache/ace/client/rest/util/WebResponse.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.client.rest.itest/src/org/apache/ace/client/rest/util/WebResponse.java?rev=1727600&view=auto
==============================================================================
--- ace/trunk/org.apache.ace.client.rest.itest/src/org/apache/ace/client/rest/util/WebResponse.java (added)
+++ ace/trunk/org.apache.ace.client.rest.itest/src/org/apache/ace/client/rest/util/WebResponse.java Fri Jan 29 15:39:59 2016
@@ -0,0 +1,65 @@
+/*
+ * 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.ace.client.rest.util;
+
+import java.net.URI;
+
+/**
+ * 
+ */
+public class WebResponse {
+    private static URI createURI(String newLocation) {
+        if (!newLocation.endsWith("/")) {
+            newLocation = newLocation.concat("/");
+        }
+        return URI.create(newLocation);
+    }
+    private final int m_status;
+    private final URI m_location;
+
+    private final String m_content;
+
+    public WebResponse(String newLocation, int rc, String content) {
+        this(createURI(newLocation), rc, content);
+    }
+
+    public WebResponse(URI location, int status, String content) {
+        m_location = location;
+        m_status = status;
+        m_content = content;
+    }
+
+    public String getContent() {
+        return m_content;
+    }
+
+    public URI getLocation() {
+        return m_location;
+    }
+
+    public int getStatus() {
+        return m_status;
+    }
+
+    @Override
+    public String toString() {
+        return String.format("%s: %d [%s]", getLocation(), getStatus(), getContent());
+    }
+}

Propchange: ace/trunk/org.apache.ace.client.rest.itest/src/org/apache/ace/client/rest/util/WebResponse.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: ace/trunk/org.apache.ace.client.rest/src/org/apache/ace/client/rest/RESTClientServlet.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.client.rest/src/org/apache/ace/client/rest/RESTClientServlet.java?rev=1727600&r1=1727599&r2=1727600&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.client.rest/src/org/apache/ace/client/rest/RESTClientServlet.java (original)
+++ ace/trunk/org.apache.ace.client.rest/src/org/apache/ace/client/rest/RESTClientServlet.java Fri Jan 29 15:39:59 2016
@@ -261,6 +261,7 @@ public class RESTClientServlet extends H
     protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
     	HttpSession session = getSession(req);
         String[] pathElements = getPathElements(req);
+        
         if (pathElements == null || pathElements.length < 1 || !WORK_FOLDER.equals(pathElements[0])) {
             resp.sendError(HttpServletResponse.SC_NOT_FOUND);
             return;