ace-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1368929 - /ace/sandbox/marrs/org.apache.ace.client.rest/src/org/apache/ace/client/rest/RESTClientServlet.java
Date Fri, 03 Aug 2012 13:02:59 GMT
Author: marrs
Date: Fri Aug  3 13:02:59 2012
New Revision: 1368929

URL: http://svn.apache.org/viewvc?rev=1368929&view=rev
Log:
ACE-288 Fixed some redirects. Does not use relative redirects anymore to circumvent this issue.

Modified:
    ace/sandbox/marrs/org.apache.ace.client.rest/src/org/apache/ace/client/rest/RESTClientServlet.java

Modified: ace/sandbox/marrs/org.apache.ace.client.rest/src/org/apache/ace/client/rest/RESTClientServlet.java
URL: http://svn.apache.org/viewvc/ace/sandbox/marrs/org.apache.ace.client.rest/src/org/apache/ace/client/rest/RESTClientServlet.java?rev=1368929&r1=1368928&r2=1368929&view=diff
==============================================================================
--- ace/sandbox/marrs/org.apache.ace.client.rest/src/org/apache/ace/client/rest/RESTClientServlet.java
(original)
+++ ace/sandbox/marrs/org.apache.ace.client.rest/src/org/apache/ace/client/rest/RESTClientServlet.java
Fri Aug  3 13:02:59 2012
@@ -351,7 +351,7 @@ public class RESTClientServlet extends H
             else if (pathElements.length == 3) {
                 // Possible repository object creation...
                 RepositoryValueObject data = getRepositoryValueObject(req);
-                createRepositoryObject(workspace, pathElements[2], data, resp);
+                createRepositoryObject(workspace, pathElements[2], data, req, resp);
             }
             else if (pathElements.length == 5) {
                 // Possible workspace action...
@@ -379,7 +379,7 @@ public class RESTClientServlet extends H
         }
 
         RepositoryValueObject data = getRepositoryValueObject(req);
-        updateRepositoryObject(workspace, pathElements[2], pathElements[3], data, resp);
+        updateRepositoryObject(workspace, pathElements[2], pathElements[3], data, req, resp);
     }
 
     /**
@@ -408,11 +408,11 @@ public class RESTClientServlet extends H
      * @param resp the servlet response to write the response data to.
      * @throws IOException in case of I/O errors.
      */
-    private void createRepositoryObject(Workspace workspace, String entityType, RepositoryValueObject
data, HttpServletResponse resp) throws IOException {
+    private void createRepositoryObject(Workspace workspace, String entityType, RepositoryValueObject
data, HttpServletRequest req, HttpServletResponse resp) throws IOException {
         try {
             RepositoryObject object = workspace.addRepositoryObject(entityType, data.attributes,
data.tags);
 
-            resp.sendRedirect(buildPathFromElements(WORK_FOLDER, workspace.getSessionID(),
entityType, object.getDefinition()));
+            resp.sendRedirect(req.getServletPath() + "/" + buildPathFromElements(WORK_FOLDER,
workspace.getSessionID(), entityType, object.getDefinition()));
         }
         catch (IllegalArgumentException e) {
             m_logger.log(LogService.LOG_WARNING, "Failed to add entity of type: " + entityType,
e);
@@ -445,8 +445,9 @@ public class RESTClientServlet extends H
 
         if (!workspace.login(req)) {
             resp.sendError(HttpServletResponse.SC_UNAUTHORIZED);
-        } else {
-            resp.sendRedirect(buildPathFromElements(WORK_FOLDER, sessionID));
+        }
+        else {
+            resp.sendRedirect(req.getServletPath() + "/" + buildPathFromElements(WORK_FOLDER,
sessionID));
         }
     }
 
@@ -666,11 +667,11 @@ public class RESTClientServlet extends H
      * @param resp the servlet response to write the response data to.
      * @throws IOException in case of I/O errors.
      */
-    private void updateRepositoryObject(Workspace workspace, String entityType, String entityId,
RepositoryValueObject data, HttpServletResponse resp) throws IOException {
+    private void updateRepositoryObject(Workspace workspace, String entityType, String entityId,
RepositoryValueObject data, HttpServletRequest req, HttpServletResponse resp) throws IOException
{
         try {
             workspace.updateObjectWithData(entityType, entityId, data);
 
-            resp.sendRedirect(buildPathFromElements(WORK_FOLDER, workspace.getSessionID(),
entityType, entityId));
+            resp.sendRedirect(req.getServletPath() + "/" + buildPathFromElements(WORK_FOLDER,
workspace.getSessionID(), entityType, entityId));
         }
         catch (IllegalArgumentException e) {
             m_logger.log(LogService.LOG_WARNING, "Failed to update entity of type: " + entityType,
e);



Mime
View raw message