incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r575664 - /incubator/sling/trunk/webmanager/src/main/java/org/apache/sling/console/web/SlingManager.java
Date Fri, 14 Sep 2007 12:48:06 GMT
Author: fmeschbe
Date: Fri Sep 14 05:48:06 2007
New Revision: 575664

URL: http://svn.apache.org/viewvc?rev=575664&view=rev
Log:
- Allow action on "root" URL (no preliminary redirection if there is an action)
- Add support for _noredir_ parameter preventing redirection after successfull action

Modified:
    incubator/sling/trunk/webmanager/src/main/java/org/apache/sling/console/web/SlingManager.java

Modified: incubator/sling/trunk/webmanager/src/main/java/org/apache/sling/console/web/SlingManager.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/webmanager/src/main/java/org/apache/sling/console/web/SlingManager.java?rev=575664&r1=575663&r2=575664&view=diff
==============================================================================
--- incubator/sling/trunk/webmanager/src/main/java/org/apache/sling/console/web/SlingManager.java
(original)
+++ incubator/sling/trunk/webmanager/src/main/java/org/apache/sling/console/web/SlingManager.java
Fri Sep 14 05:48:06 2007
@@ -63,6 +63,13 @@
     private static final long serialVersionUID = 1L;
 
     /**
+     * The name and value of a parameter which will prevent redirection to a
+     * render after the action has been executed (value is "_noredir_"). This
+     * may be used by programmatic action submissions.
+     */
+    public static final String PARAM_NO_REDIRECT_AFTER_ACTION = "_noredir_";
+    
+    /**
      * @scr.property value="/sling"
      */
     private static final String PROP_MANAGER_ROOT = "manager.root";
@@ -86,7 +93,7 @@
      * @scr.property value="admin"
      */
     private static final String PROP_PASSWORD = "password";
-
+    
     private ComponentContext componentContext;
 
     /**
@@ -115,6 +122,11 @@
         HttpServletRequest request = (HttpServletRequest) req;
         HttpServletResponse response = (HttpServletResponse) res;
 
+        // handle the request action, terminate if done
+        if (this.handleAction(request, response)) {
+            return;
+        }
+
         // check whether we are not at .../{webManagerRoot}
         if (request.getRequestURI().endsWith(this.webManagerRoot)) {
             response.sendRedirect(request.getRequestURI() + "/"
@@ -122,11 +134,6 @@
             return;
         }
 
-        // handle the request action, terminate if done
-        if (this.handleAction(request, response)) {
-            return;
-        }
-
         // otherwise we render the response
         Render render = this.getRender(request);
         if (render == null) {
@@ -162,6 +169,15 @@
                 } catch (ServletException se) {
                     this.log(se.getMessage(), se.getRootCause());
                 }
+                
+                // maybe overwrite redirect
+                if (PARAM_NO_REDIRECT_AFTER_ACTION.equals(getParameter(req, PARAM_NO_REDIRECT_AFTER_ACTION)))
{
+                    resp.setStatus(HttpServletResponse.SC_OK);
+                    resp.setContentType("text/html");
+                    resp.getWriter().println("Ok");
+                    return true;
+                }
+                
                 if (redirect) {
                     String uri = req.getRequestURI();
                     // Object pars =



Mime
View raw message