You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@roller.apache.org by ag...@apache.org on 2007/06/06 18:27:24 UTC

svn commit: r544876 - in /roller/trunk/apps/weblogger: src/java/org/apache/roller/weblogger/ui/struts2/util/StrutsRedirectServlet.java testdata/roller-custom.properties

Author: agilliland
Date: Wed Jun  6 09:27:23 2007
New Revision: 544876

URL: http://svn.apache.org/viewvc?view=rev&rev=544876
Log:
redirect support for old struts1 urls which need to be maintained for backwards compatability.  this commit includes redirects for the old yourWebsites.do url which is distributed in emails regarding member invitations, and it includes redirects for the old commentManagement.do url which is distributed in emails regarding comment notifications.


Added:
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/util/StrutsRedirectServlet.java
Modified:
    roller/trunk/apps/weblogger/testdata/roller-custom.properties

Added: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/util/StrutsRedirectServlet.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/util/StrutsRedirectServlet.java?view=auto&rev=544876
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/util/StrutsRedirectServlet.java (added)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/util/StrutsRedirectServlet.java Wed Jun  6 09:27:23 2007
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  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.  For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
+
+package org.apache.roller.weblogger.ui.struts2.util;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import org.apache.roller.weblogger.util.URLUtilities;
+
+
+/**
+ * Handles redirects for old struts1 urls.
+ */
+public class StrutsRedirectServlet extends HttpServlet {
+    
+    // only handle GET requests
+    public void doGet(HttpServletRequest request, HttpServletResponse response)
+            throws IOException, ServletException {
+        
+        String redirectUrl = null;
+        
+        String servlet = request.getServletPath();
+        if(servlet != null && "/roller-ui/authoring/commentManagement.do".equals(servlet)) {
+            // redirect to new comment management action
+            Map<String, String> params = new HashMap();
+            params.put("weblog", request.getParameter("weblog"));
+            params.put("bean.entryId", request.getParameter("entryId"));
+            redirectUrl = URLUtilities.getActionURL("comments", "/roller-ui/authoring", null, params, true);
+            
+        } else if(servlet != null && "/roller-ui/yourWebsites.do".equals(servlet)) {
+            // redirect to new main menu action
+            redirectUrl = URLUtilities.getActionURL("menu", "/roller-ui", null, null, true);
+        }
+        
+        if(redirectUrl != null) {
+            response.setStatus(response.SC_MOVED_PERMANENTLY);
+            response.setHeader("Location", redirectUrl);
+        } else {
+            response.sendError(response.SC_NOT_FOUND);
+        }
+    }
+    
+}

Modified: roller/trunk/apps/weblogger/testdata/roller-custom.properties
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/testdata/roller-custom.properties?view=diff&rev=544876&r1=544875&r2=544876
==============================================================================
--- roller/trunk/apps/weblogger/testdata/roller-custom.properties (original)
+++ roller/trunk/apps/weblogger/testdata/roller-custom.properties Wed Jun  6 09:27:23 2007
@@ -1,7 +1,7 @@
 
-persistence.roller.classname=org.apache.roller.weblogger.business.jpa.JPARollerImpl
+#persistence.roller.classname=org.apache.roller.weblogger.business.jpa.JPARollerImpl
 #persistence.roller.classname=org.apache.roller.weblogger.business.datamapper.jpa.JPARollerImpl
-#persistence.roller.classname=org.apache.roller.weblogger.business.hibernate.HibernateRollerImpl
+persistence.roller.classname=org.apache.roller.weblogger.business.hibernate.HibernateRollerImpl
 
 # we don't want to start with any folders/bookmarks for testing
 newuser.blogroll=