Author: chathura
Date: Thu Jan 31 00:26:42 2008
New Revision: 13200

Log:


Fixed a bug in resource upload.



Modified:
   
branches/registry/1_0/modules/webapps/src/main/java/org/wso2/registry/web/ControllerServlet.java

Modified: 
branches/registry/1_0/modules/webapps/src/main/java/org/wso2/registry/web/ControllerServlet.java
==============================================================================
--- 
branches/registry/1_0/modules/webapps/src/main/java/org/wso2/registry/web/ControllerServlet.java
    (original)
+++ 
branches/registry/1_0/modules/webapps/src/main/java/org/wso2/registry/web/ControllerServlet.java
    Thu Jan 31 00:26:42 2008
@@ -341,42 +341,24 @@
 
     private void handleFileUpload(HttpServletRequest request, 
HttpServletResponse response)
             throws IOException, ServletException {
+
+        String path = "";
+
         try {
             Registry registry = Utils.getSecureRegistry(request);
 
             Resource fileElement =
                     FileUploadUtil.processUpload(request);
-            String path = fileElement.getPath();
+            path = fileElement.getPath();
 
             registry.put(path, fileElement);
 
-            response.setContentType("text/html");
-
-            String parentPath = getParentPath(path);
-            ResourceDetailsAction details = new ResourceDetailsAction();
-            details.setPath(parentPath);
-            details.execute(request);
-
-            CollectionViewAction collection = null;
-            if (details.isCollection()) {
-                collection = new CollectionViewAction();
-                collection.setPath(parentPath);
-                collection.execute(request);
-            }
-
-            request.getSession().setAttribute(UIConstants.RESOURCE_BEAN, 
details);
-            request.getSession().setAttribute(UIConstants.COLLECTION_BEAN, 
collection);
-
-            request.getRequestDispatcher(UIConstants.RESOURCES_JSP)
-                    .forward(request, response);
-
-        } catch (Exception e) {
-
+        } catch (RegistryException e) {
             e.printStackTrace();
-            response.setContentType("text/html");
-            request.getRequestDispatcher(UIConstants.RESOURCES_JSP)
-                    .forward(request, response);
+            setErrorMessage(request, e.getMessage());
         }
+
+        response.sendRedirect("/wso2registry/web" + path);
     }
 
     protected void doGet(HttpServletRequest request,

_______________________________________________
Registry-dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/registry-dev

Reply via email to