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 2006/06/09 22:48:08 UTC
svn commit: r413160 - in /incubator/roller/branches/roller_3.0:
metadata/xdoclet/ src/org/apache/roller/ui/core/struts/
src/org/apache/roller/ui/core/struts/actions/ web/ web/WEB-INF/
web/WEB-INF/jsps/ web/WEB-INF/jsps/authoring/ web/roller-ui/
Author: agilliland
Date: Fri Jun 9 13:48:07 2006
New Revision: 413160
URL: http://svn.apache.org/viewvc?rev=413160&view=rev
Log:
moving the login and logout urls under /roller-ui
made them both struts actions as well.
jsps were moved under WEB-INF/jsps
Added:
incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/core/struts/
incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/core/struts/actions/
incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/core/struts/actions/LoginAction.java
incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/core/struts/actions/LogoutAction.java
incubator/roller/branches/roller_3.0/web/WEB-INF/jsps/loginBody.jsp
- copied unchanged from r412521, incubator/roller/branches/roller_3.0/web/loginBody.jsp
incubator/roller/branches/roller_3.0/web/roller-ui/login-redirect.jsp
- copied, changed from r412548, incubator/roller/branches/roller_3.0/web/login-redirect.jsp
Removed:
incubator/roller/branches/roller_3.0/web/login-redirect.jsp
incubator/roller/branches/roller_3.0/web/login.jsp
incubator/roller/branches/roller_3.0/web/loginBody.jsp
incubator/roller/branches/roller_3.0/web/logout-redirect.jsp
Modified:
incubator/roller/branches/roller_3.0/metadata/xdoclet/global-forwards.xml
incubator/roller/branches/roller_3.0/metadata/xdoclet/servlet-mappings.xml
incubator/roller/branches/roller_3.0/web/WEB-INF/jsps/authoring/welcome.jsp
incubator/roller/branches/roller_3.0/web/WEB-INF/security.xml
incubator/roller/branches/roller_3.0/web/WEB-INF/tiles-defs.xml
Modified: incubator/roller/branches/roller_3.0/metadata/xdoclet/global-forwards.xml
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/metadata/xdoclet/global-forwards.xml?rev=413160&r1=413159&r2=413160&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/metadata/xdoclet/global-forwards.xml (original)
+++ incubator/roller/branches/roller_3.0/metadata/xdoclet/global-forwards.xml Fri Jun 9 13:48:07 2006
@@ -1,8 +1,8 @@
<global-forwards>
<forward name="access-denied" path=".denied"/>
<forward name="error" path="/error.jsp"/>
-<forward name="login-redirect" path="/login-redirect.jsp"/>
-<forward name="logout-redirect" path="/logout-redirect.jsp"/>
+<forward name="login-redirect" path="/roller-ui/login-redirect.jsp"/>
+<forward name="logout-redirect" path="/roller-ui/logout"/>
<!-- unprotected actions -->
<forward name="page" path="/page"/>
Modified: incubator/roller/branches/roller_3.0/metadata/xdoclet/servlet-mappings.xml
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/metadata/xdoclet/servlet-mappings.xml?rev=413160&r1=413159&r2=413160&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/metadata/xdoclet/servlet-mappings.xml (original)
+++ incubator/roller/branches/roller_3.0/metadata/xdoclet/servlet-mappings.xml Fri Jun 9 13:48:07 2006
@@ -3,6 +3,16 @@
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>action</servlet-name>
+ <url-pattern>/roller-ui/login</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>action</servlet-name>
+ <url-pattern>/roller-ui/logout</url-pattern>
+ </servlet-mapping>
<!-- we map the page servlet manually because of webdoclets inheritance issue -->
<servlet-mapping>
Added: incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/core/struts/actions/LoginAction.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/core/struts/actions/LoginAction.java?rev=413160&view=auto
==============================================================================
--- incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/core/struts/actions/LoginAction.java (added)
+++ incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/core/struts/actions/LoginAction.java Fri Jun 9 13:48:07 2006
@@ -0,0 +1,49 @@
+/*
+ * 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.ui.core.struts.actions;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import org.apache.struts.action.Action;
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+
+
+/**
+ * Handle user logins.
+ *
+ * @struts.action path="/roller-ui/login" name="LoginAction"
+ * @struts.action-forward name="login.page" path=".login"
+ */
+public class LoginAction extends Action {
+
+
+ public ActionForward execute(ActionMapping mapping,
+ ActionForm actionForm,
+ HttpServletRequest request,
+ HttpServletResponse response)
+ throws Exception {
+
+ // anything to do before showing the login form?
+
+ return mapping.findForward("login.page");
+ }
+
+}
Added: incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/core/struts/actions/LogoutAction.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/core/struts/actions/LogoutAction.java?rev=413160&view=auto
==============================================================================
--- incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/core/struts/actions/LogoutAction.java (added)
+++ incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/core/struts/actions/LogoutAction.java Fri Jun 9 13:48:07 2006
@@ -0,0 +1,65 @@
+/*
+ * 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.ui.core.struts.actions;
+
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+import org.acegisecurity.ui.rememberme.TokenBasedRememberMeServices;
+import org.apache.roller.ui.core.RollerSession;
+import org.apache.struts.action.Action;
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+
+
+/**
+ * Handle user logouts.
+ *
+ * @struts.action path="/roller-ui/logout" name="LogoutAction"
+ */
+public class LogoutAction extends Action {
+
+
+ public ActionForward execute(ActionMapping mapping,
+ ActionForm actionForm,
+ HttpServletRequest request,
+ HttpServletResponse response)
+ throws Exception {
+
+ // kill any current session
+ HttpSession session = request.getSession(false);
+ if(session != null) {
+ request.getSession().removeAttribute(RollerSession.ROLLER_SESSION);
+ request.getSession().invalidate();
+ }
+
+ // make sure remember me is discarded
+ Cookie terminate = new Cookie(TokenBasedRememberMeServices.ACEGI_SECURITY_HASHED_REMEMBER_ME_COOKIE_KEY, null);
+ terminate.setMaxAge(0);
+ response.addCookie(terminate);
+
+ // redirect user back to homepage
+ response.sendRedirect(request.getContextPath());
+
+ return null;
+ }
+
+}
Modified: incubator/roller/branches/roller_3.0/web/WEB-INF/jsps/authoring/welcome.jsp
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/web/WEB-INF/jsps/authoring/welcome.jsp?rev=413160&r1=413159&r2=413160&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/web/WEB-INF/jsps/authoring/welcome.jsp (original)
+++ incubator/roller/branches/roller_3.0/web/WEB-INF/jsps/authoring/welcome.jsp Fri Jun 9 13:48:07 2006
@@ -21,7 +21,7 @@
<p><fmt:message key="welcome.accountCreated" /></p>
-<p><a href='<c:out value="${contextURL}"/>/login-redirect.jsp'><fmt:message key="welcome.clickHere" /></a>
+<p><html:link forward="login-redirect"><fmt:message key="welcome.clickHere" /></html:link>
<fmt:message key="welcome.toLoginAndPost" /></p>
<br />
<br />
Modified: incubator/roller/branches/roller_3.0/web/WEB-INF/security.xml
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/web/WEB-INF/security.xml?rev=413160&r1=413159&r2=413160&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/web/WEB-INF/security.xml (original)
+++ incubator/roller/branches/roller_3.0/web/WEB-INF/security.xml Fri Jun 9 13:48:07 2006
@@ -46,7 +46,7 @@
/editor/**=admin,editor
/admin/**=admin
/rewrite-status*=admin
- /login-redirect.jsp=admin,editor
+ /roller-ui/login-redirect.jsp=admin,editor
</value>
</property>
</bean>
@@ -117,7 +117,7 @@
<bean id="authenticationProcessingFilter" class="org.acegisecurity.ui.webapp.AuthenticationProcessingFilter">
<property name="authenticationManager" ref="authenticationManager"/>
- <property name="authenticationFailureUrl" value="/login.jsp?error=true"/>
+ <property name="authenticationFailureUrl" value="/roller-ui/login?error=true"/>
<property name="defaultTargetUrl" value="/"/>
<property name="filterProcessesUrl" value="/j_security_check"/>
<property name="rememberMeServices" ref="rememberMeServices"/>
@@ -136,7 +136,7 @@
<bean id="remoteUserFilter" class="org.acegisecurity.wrapper.SecurityContextHolderAwareRequestFilter"/>
<bean id="authenticationProcessingFilterEntryPoint" class="org.acegisecurity.ui.webapp.AuthenticationProcessingFilterEntryPoint">
- <property name="loginFormUrl" value="/login.jsp"/>
+ <property name="loginFormUrl" value="/roller-ui/login"/>
<property name="forceHttps" value="false"/>
</bean>
Modified: incubator/roller/branches/roller_3.0/web/WEB-INF/tiles-defs.xml
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/web/WEB-INF/tiles-defs.xml?rev=413160&r1=413159&r2=413160&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/web/WEB-INF/tiles-defs.xml (original)
+++ incubator/roller/branches/roller_3.0/web/WEB-INF/tiles-defs.xml Fri Jun 9 13:48:07 2006
@@ -262,6 +262,11 @@
<!-- Misc login and error pages -->
+<definition name=".login" extends=".tiles-simplepage" >
+ <put name="banner" value="/WEB-INF/jsps/tiles/banner.jsp" />
+ <put name="content" value="/WEB-INF/jsps/loginBody.jsp" />
+</definition>
+
<definition name=".denied" extends=".tiles-simplepage" >
<put name="content" value="/WEB-INF/jsps/denied.jsp" />
</definition>
Copied: incubator/roller/branches/roller_3.0/web/roller-ui/login-redirect.jsp (from r412548, incubator/roller/branches/roller_3.0/web/login-redirect.jsp)
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/web/roller-ui/login-redirect.jsp?p2=incubator/roller/branches/roller_3.0/web/roller-ui/login-redirect.jsp&p1=incubator/roller/branches/roller_3.0/web/login-redirect.jsp&r1=412548&r2=413160&rev=413160&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/web/login-redirect.jsp (original)
+++ incubator/roller/branches/roller_3.0/web/roller-ui/login-redirect.jsp Fri Jun 9 13:48:07 2006
@@ -1,4 +1,4 @@
-<!--
+<%--
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
@@ -14,28 +14,22 @@
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.
--->
-<%@ page language="java" errorPage="/error.jsp" contentType="text/html; charset=UTF-8" %><%@
-taglib uri="http://java.sun.com/jstl/core" prefix="c" %><%@
-taglib uri="http://www.rollerweblogger.org/tags" prefix="roller" %><%@
-page import="org.apache.roller.model.*" %><%@
-page import="org.apache.roller.pojos.*" %><%@
-page import="org.apache.roller.config.RollerConfig" %><%@
-page import="org.apache.roller.ui.core.RollerSession" %><%@
-page import="java.util.List" %>
+--%>
+<%@ page language="java" contentType="text/html; charset=UTF-8" %>
+<%@ page import="org.apache.roller.model.*" %>
+<%@ page import="org.apache.roller.pojos.*" %>
+<%@ page import="org.apache.roller.ui.core.RollerSession" %>
+<%@ page import="java.util.List" %>
<%
-Roller roller = RollerFactory.getRoller();
-RollerSession rollerSession = RollerSession.getRollerSession(request);
-UserData user = rollerSession.getAuthenticatedUser();
-List websites = roller.getUserManager().getWebsites(user, Boolean.TRUE, null, null, null, 0, Integer.MAX_VALUE);
+UserData user = RollerSession.getRollerSession(request).getAuthenticatedUser();
+List websites = RollerFactory.getRoller().getUserManager().getWebsites(user, Boolean.TRUE, null, null, null, 0, Integer.MAX_VALUE);
+
if (websites.size() == 1) {
- WebsiteData website = (WebsiteData)websites.get(0);
- website.hasUserPermissions(user, PermissionsData.LIMITED);
- response.sendRedirect(
- "editor/weblog.do?method=create&rmk=tabbedmenu.weblog&rmik=tabbedmenu.weblog.newEntry&weblog="+website.getHandle());
+ WebsiteData website = (WebsiteData) websites.get(0);
+ response.sendRedirect(request.getContextPath()+"/editor/weblog.do?method=create&weblog="+website.getHandle());
} else {
- response.sendRedirect(
- "editor/yourWebsites.do?method=edit&rmik=tabbedmenu.user.websites");
+ response.sendRedirect(request.getContextPath()+"/editor/yourWebsites.do");
}
+
%>