You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jspwiki.apache.org by aj...@apache.org on 2008/12/10 06:14:56 UTC
svn commit: r724981 - in /incubator/jspwiki/trunk: ./ src/com/ecyrd/jspwiki/
src/com/ecyrd/jspwiki/action/ src/com/ecyrd/jspwiki/content/
src/com/ecyrd/jspwiki/tags/ src/com/ecyrd/jspwiki/ui/stripes/
src/org/apache/jspwiki/api/ src/webdocs/
Author: ajaquith
Date: Tue Dec 9 21:14:55 2008
New Revision: 724981
URL: http://svn.apache.org/viewvc?rev=724981&view=rev
Log:
Additional improvements, bug fixes to Stripes-related code. Wiki.jsp and PageInfo.jsp completely migrated to Stripes.
Removed:
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/action/PageInfoActionBean.java
Modified:
incubator/jspwiki/trunk/ChangeLog
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/WikiContext.java
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/action/EditActionBean.java
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/action/UserProfileActionBean.java
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/action/ViewActionBean.java
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/content/WikiName.java
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/TranslateTag.java
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/ui/stripes/WikiActionBeanContext.java
incubator/jspwiki/trunk/src/org/apache/jspwiki/api/WikiContext.java
incubator/jspwiki/trunk/src/webdocs/LoginForm.jsp
incubator/jspwiki/trunk/src/webdocs/PageInfo.jsp
incubator/jspwiki/trunk/src/webdocs/Wiki.jsp
Modified: incubator/jspwiki/trunk/ChangeLog
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/ChangeLog?rev=724981&r1=724980&r2=724981&view=diff
==============================================================================
--- incubator/jspwiki/trunk/ChangeLog (original)
+++ incubator/jspwiki/trunk/ChangeLog Tue Dec 9 21:14:55 2008
@@ -1,3 +1,17 @@
+2008-12-06 Andrew Jaquith <ajaquith AT apache DOT org>
+
+ * 3.0.0-svn-29
+
+ * Additional improvements, bug fixes to Stripes-related code.
+ Wiki.jsp and PageInfo.jsp completely migrated to Stripes.
+
+ * TemplateManager gains a new (fairly volatile) method that
+ returns a ForwardResolution to content template pages.
+
+ * TabTag gains a much-needed 'titleKey' property, making the
+ need to embed i18n-related scriptlets in JSPs unnecessary.
+ Please use this in preference to the 'title' property.
+
2008-12-05 Janne Jalkanen <ja...@apache.org>
* 3.0.0-svn-28
Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/WikiContext.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/WikiContext.java?rev=724981&r1=724980&r2=724981&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/WikiContext.java (original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/WikiContext.java Tue Dec 9 21:14:55 2008
@@ -82,7 +82,7 @@
public static final String DIFF = HandlerInfo.getHandlerInfo( EditActionBean.class, "diff" ).getRequestContext();
/** User is viewing page history. */
- public static final String INFO = HandlerInfo.getHandlerInfo( PageInfoActionBean.class, "info" ).getRequestContext();
+ public static final String INFO = HandlerInfo.getHandlerInfo( ViewActionBean.class, "info" ).getRequestContext();
/** User is previewing the changes he just made. */
public static final String PREVIEW = HandlerInfo.getHandlerInfo( EditActionBean.class, "preview" ).getRequestContext();
Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/action/EditActionBean.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/action/EditActionBean.java?rev=724981&r1=724980&r2=724981&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/action/EditActionBean.java (original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/action/EditActionBean.java Tue Dec 9 21:14:55 2008
@@ -6,6 +6,7 @@
import com.ecyrd.jspwiki.ui.stripes.HandlerPermission;
import com.ecyrd.jspwiki.ui.stripes.WikiRequestContext;
+@HttpCache(allow=false)
@UrlBinding("/Edit.jsp")
public class EditActionBean extends AbstractPageActionBean
{
Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/action/UserProfileActionBean.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/action/UserProfileActionBean.java?rev=724981&r1=724980&r2=724981&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/action/UserProfileActionBean.java (original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/action/UserProfileActionBean.java Tue Dec 9 21:14:55 2008
@@ -119,7 +119,7 @@
// Set user cookie
Principal principal = getContext().getWikiSession().getUserPrincipal();
CookieAssertionLoginModule.setUserCookie( getContext().getResponse(), principal.getName() );
- UrlBuilder builder = new UrlBuilder( getContext().getLocale(), ViewActionBean.class, false );
+ UrlBuilder builder = new UrlBuilder( getContext().getLocale(), "/Wiki.jsp", false );
if( m_redirect != null )
{
builder.addParameter( "page", m_redirect );
@@ -258,7 +258,7 @@
@WikiRequestContext( "profile" )
public Resolution view()
{
- return new ForwardResolution( ViewActionBean.class );
+ return new ForwardResolution( "/UserPreferences.jsp" );
}
}
Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/action/ViewActionBean.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/action/ViewActionBean.java?rev=724981&r1=724980&r2=724981&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/action/ViewActionBean.java (original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/action/ViewActionBean.java Tue Dec 9 21:14:55 2008
@@ -123,10 +123,10 @@
}
/**
- * Default handler that simply forwards the user back to the same page.
+ * Default handler that simply forwards the user back to the display JSP <code>PageContent.jsp</code>.
* Every ActionBean needs a default handler to function properly, so we use
* this (very simple) one.
- * @return a forward resolution back to the same page
+ * @return a forward to the content template
*/
@DefaultHandler
@HandlesEvent("view")
@@ -134,7 +134,19 @@
@WikiRequestContext("view")
public Resolution view()
{
- return new ForwardResolution(ViewActionBean.class);
+ return getContext().getEngine().getTemplateManager().getContentPage( this, "ViewTemplate.jsp", "PageContent.jsp" );
+ }
+
+ /**
+ * Handler that forwards to the page information display JSP <code>InfoContent.jsp</code>.
+ * @return a forward to the content template
+ */
+ @HandlesEvent("info")
+ @HandlerPermission(permissionClass=PagePermission.class, target="${page.qualifiedName}", actions=PagePermission.VIEW_ACTION)
+ @WikiRequestContext("info")
+ public Resolution info()
+ {
+ return getContext().getEngine().getTemplateManager().getContentPage( this, "ViewTemplate.jsp", "InfoContent.jsp" );
}
}
Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/content/WikiName.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/content/WikiName.java?rev=724981&r1=724980&r2=724981&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/content/WikiName.java (original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/content/WikiName.java Tue Dec 9 21:14:55 2008
@@ -71,13 +71,11 @@
return name;
}
- else
- {
- name.m_space = ContentManager.DEFAULT_SPACE;
- name.m_path = path;
-
- return name;
- }
+
+ name.m_space = ContentManager.DEFAULT_SPACE;
+ name.m_path = path;
+
+ return name;
// FIXME: Should probably use this
//throw new IllegalArgumentException("The path does not represent a fully qualified WikiName (space:path/path/path)");
Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/TranslateTag.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/TranslateTag.java?rev=724981&r1=724980&r2=724981&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/TranslateTag.java (original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/TranslateTag.java Tue Dec 9 21:14:55 2008
@@ -21,12 +21,11 @@
package com.ecyrd.jspwiki.tags;
import javax.servlet.jsp.JspException;
-import javax.servlet.jsp.PageContext;
import javax.servlet.jsp.tagext.BodyContent;
import javax.servlet.jsp.tagext.BodyTagSupport;
import com.ecyrd.jspwiki.WikiContext;
-
+import com.ecyrd.jspwiki.action.WikiContextFactory;
import com.ecyrd.jspwiki.log.Logger;
import com.ecyrd.jspwiki.log.LoggerFactory;
@@ -47,8 +46,7 @@
{
try
{
- WikiContext context = (WikiContext) pageContext.getAttribute( WikiTagBase.ATTR_CONTEXT,
- PageContext.REQUEST_SCOPE );
+ WikiContext context = WikiContextFactory.findContext( pageContext );
//
// Because the TranslateTag should not affect any of the real page attributes
Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/ui/stripes/WikiActionBeanContext.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/ui/stripes/WikiActionBeanContext.java?rev=724981&r1=724980&r2=724981&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/ui/stripes/WikiActionBeanContext.java (original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/ui/stripes/WikiActionBeanContext.java Tue Dec 9 21:14:55 2008
@@ -146,20 +146,15 @@
*/
public Object clone()
{
- try
- {
- // super.clone() must always be called to make sure that inherited
- // objects
- // get the right type
- WikiActionBeanContext copy = (WikiActionBeanContext) super.clone();
- copy.m_delegate = m_delegate;
- return copy;
- }
- catch( CloneNotSupportedException e )
- {
- } // Never happens
-
- return null;
+ WikiActionBeanContext copy = new WikiActionBeanContext();
+ copy.m_delegate = m_delegate;
+ copy.setEngine( getEngine() );
+ copy.setEventName( getEventName() );
+ copy.setRequest( getRequest() );
+ copy.setResponse( getResponse() );
+ copy.setServletContext( getServletContext() );
+ copy.setValidationErrors( getValidationErrors() );
+ return copy;
}
/**
@@ -167,8 +162,15 @@
*/
public WikiContext deepClone()
{
- // TODO Auto-generated method stub
- return null;
+ WikiActionBeanContext copy = new WikiActionBeanContext();
+ copy.m_delegate = (DefaultWikiContext) m_delegate.deepClone();
+ copy.setEngine( getEngine() );
+ copy.setEventName( getEventName() );
+ copy.setRequest( getRequest() );
+ copy.setResponse( getResponse() );
+ copy.setServletContext( getServletContext() );
+ copy.setValidationErrors( getValidationErrors() );
+ return copy;
}
/**
Modified: incubator/jspwiki/trunk/src/org/apache/jspwiki/api/WikiContext.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/org/apache/jspwiki/api/WikiContext.java?rev=724981&r1=724980&r2=724981&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/org/apache/jspwiki/api/WikiContext.java (original)
+++ incubator/jspwiki/trunk/src/org/apache/jspwiki/api/WikiContext.java Tue Dec 9 21:14:55 2008
@@ -82,7 +82,7 @@
public static final String DIFF = HandlerInfo.getHandlerInfo( EditActionBean.class, "diff" ).getRequestContext();
/** User is viewing page history. */
- public static final String INFO = HandlerInfo.getHandlerInfo( PageInfoActionBean.class, "info" ).getRequestContext();
+ public static final String INFO = HandlerInfo.getHandlerInfo( ViewActionBean.class, "info" ).getRequestContext();
/** User is previewing the changes he just made. */
public static final String PREVIEW = HandlerInfo.getHandlerInfo( EditActionBean.class, "preview" ).getRequestContext();
Modified: incubator/jspwiki/trunk/src/webdocs/LoginForm.jsp
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/webdocs/LoginForm.jsp?rev=724981&r1=724980&r2=724981&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/webdocs/LoginForm.jsp (original)
+++ incubator/jspwiki/trunk/src/webdocs/LoginForm.jsp Tue Dec 9 21:14:55 2008
@@ -5,7 +5,7 @@
<%@ page errorPage="/Error.jsp" %>
<%@ taglib uri="/WEB-INF/jspwiki.tld" prefix="wiki" %>
<%@ taglib uri="/WEB-INF/stripes.tld" prefix="stripes" %>
-<stripes:useActionBean beanclass="com.ecyrd.jspwiki.action.LoginActionBean" />
+<stripes:useActionBean beanclass="com.ecyrd.jspwiki.action.LoginActionBean" event="view" executeResolution="true" />
<%!
/**
* This page contains the logic for finding and including
Modified: incubator/jspwiki/trunk/src/webdocs/PageInfo.jsp
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/webdocs/PageInfo.jsp?rev=724981&r1=724980&r2=724981&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/webdocs/PageInfo.jsp (original)
+++ incubator/jspwiki/trunk/src/webdocs/PageInfo.jsp Tue Dec 9 21:14:55 2008
@@ -1,31 +1,2 @@
-<%@ page import="com.ecyrd.jspwiki.log.Logger" %>
-<%@ page import="com.ecyrd.jspwiki.log.LoggerFactory" %>
-<%@ page import="com.ecyrd.jspwiki.*" %>
-<%@ page import="com.ecyrd.jspwiki.util.*" %>
-<%@ page errorPage="/Error.jsp" %>
-<%@ taglib uri="/WEB-INF/jspwiki.tld" prefix="wiki" %>
<%@ taglib uri="/WEB-INF/stripes.tld" prefix="stripes" %>
-<stripes:useActionBean beanclass="com.ecyrd.jspwiki.action.PageInfoActionBean" event="info" />
-
-<%!
- Logger log = LoggerFactory.getLogger("JSPWiki");
-%>
-
-<%
- WikiEngine wiki = WikiEngine.getInstance( getServletConfig() );
- // Create wiki context and check for authorization
- WikiContext wikiContext = wiki.createContext( request, WikiContext.INFO );
- String pagereq = wikiContext.getPage().getName();
-
- WatchDog w = wiki.getCurrentWatchDog();
- try{
- w.enterState("Generating INFO response",60);
-
- // Set the content type and include the response content
- response.setContentType("text/html; charset="+wiki.getContentEncoding() );
- String contentPage = wiki.getTemplateManager().findJSP( pageContext,
- wikiContext.getTemplate(),
- "ViewTemplate.jsp" );
-%><wiki:Include page="<%=contentPage%>" />
-
-<% } finally { w.exitState(); } %>
\ No newline at end of file
+<stripes:useActionBean beanclass="com.ecyrd.jspwiki.action.ViewActionBean" event="info" executeResolution="true"/>
Modified: incubator/jspwiki/trunk/src/webdocs/Wiki.jsp
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/webdocs/Wiki.jsp?rev=724981&r1=724980&r2=724981&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/webdocs/Wiki.jsp (original)
+++ incubator/jspwiki/trunk/src/webdocs/Wiki.jsp Tue Dec 9 21:14:55 2008
@@ -7,37 +7,4 @@
<%@ page errorPage="/Error.jsp" %>
<%@ taglib uri="/WEB-INF/jspwiki.tld" prefix="wiki" %>
<%@ taglib uri="/WEB-INF/stripes.tld" prefix="stripes" %>
-<stripes:useActionBean beanclass="com.ecyrd.jspwiki.action.ViewActionBean" event="view" />
-<%!
- Logger log = LoggerFactory.getLogger("JSPWiki");
-%>
-
-<%
- WikiEngine wiki = WikiEngine.getInstance( getServletConfig() );
- // Create wiki context and check for authorization
- WikiContext wikiContext = WikiContextFactory.findContext( pageContext );
- String pagereq = wikiContext.getPage().getName();
-
- StopWatch sw = new StopWatch();
- sw.start();
- WatchDog w = wiki.getCurrentWatchDog();
- try {
- w.enterState("Generating VIEW response for "+wikiContext.getPage(),60);
-
- // Set the content type and include the response content
- wikiContext.setVariable( "contentTemplate", "PageContent.jsp" );
- response.setContentType("text/html; charset="+wiki.getContentEncoding() );
- String contentPage = wiki.getTemplateManager().findJSP( pageContext,
- wikiContext.getTemplate(),
- "ViewTemplate.jsp" );
-
-%><wiki:Include page="<%=contentPage%>" /><%
- }
- finally
- {
- sw.stop();
- if( log.isDebugEnabled() ) log.debug("Total response time from server on page "+pagereq+": "+sw);
- w.exitState();
- }
-%>
-
+<stripes:useActionBean beanclass="com.ecyrd.jspwiki.action.ViewActionBean" event="view" executeResolution="true" />