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/02/23 20:29:18 UTC
svn commit: r630513 [1/2] -
/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/
Author: ajaquith
Date: Sat Feb 23 11:29:13 2008
New Revision: 630513
URL: http://svn.apache.org/viewvc?rev=630513&view=rev
Log:
Initial Stripes component commit.
Modified:
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/AdminBeanIteratorTag.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/AttachmentsIteratorTag.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/AuthorTag.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/BaseURLTag.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/BreadcrumbsTag.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/CalendarTag.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/CheckLockTag.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/CheckRequestContextTag.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/CheckVersionTag.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/CommentLinkTag.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/ContentEncodingTag.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/ContentTag.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/CookieTag.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/DiffLinkTag.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/EditLinkTag.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/EditorIteratorTag.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/FeedDiscoveryTag.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/HasAttachmentsTag.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/HistoryIteratorTag.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/IncludeResourcesTag.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/IncludeTag.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/InsertDiffTag.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/InsertPageTag.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/IteratorTag.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/LinkTag.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/LinkToParentTag.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/LinkToTag.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/MessagesTag.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/NextVersionTag.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/NoSuchPageTag.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/PageDateTag.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/PageInfoLinkTag.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/PageNameTag.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/PageSizeTag.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/PageTypeTag.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/PageVersionTag.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/ParentPageNameTag.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/PermissionTag.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/PluginTag.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/PreviousVersionTag.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/RSSCoffeeCupLinkTag.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/RSSImageLinkTag.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/RSSLinkTag.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/RequestResourceTag.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/SearchResultIteratorTag.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/TabTag.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/TemplateDirTag.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/TranslateTag.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/UploadLinkTag.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/UserCheckTag.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/UserNameTag.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/UserProfileTag.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/VariableTag.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/WikiBodyTag.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/WikiTagBase.java
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/AdminBeanIteratorTag.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/AdminBeanIteratorTag.java?rev=630513&r1=630512&r2=630513&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/AdminBeanIteratorTag.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/AdminBeanIteratorTag.java Sat Feb 23 11:29:13 2008
@@ -43,7 +43,7 @@
Collection beans = mgr.getAllBeans();
- ArrayList typedBeans = new ArrayList();
+ ArrayList<AdminBean> typedBeans = new ArrayList<AdminBean>();
for( Iterator i = beans.iterator(); i.hasNext(); )
{
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/AttachmentsIteratorTag.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/AttachmentsIteratorTag.java?rev=630513&r1=630512&r2=630513&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/AttachmentsIteratorTag.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/AttachmentsIteratorTag.java Sat Feb 23 11:29:13 2008
@@ -22,7 +22,6 @@
import java.io.IOException;
import java.util.Collection;
import javax.servlet.jsp.JspWriter;
-import javax.servlet.jsp.PageContext;
import org.apache.log4j.Logger;
@@ -30,6 +29,7 @@
import com.ecyrd.jspwiki.WikiContext;
import com.ecyrd.jspwiki.WikiPage;
import com.ecyrd.jspwiki.providers.ProviderException;
+import com.ecyrd.jspwiki.action.WikiActionBeanFactory;
import com.ecyrd.jspwiki.attachment.AttachmentManager;
import com.ecyrd.jspwiki.attachment.Attachment;
@@ -55,8 +55,7 @@
public final int doStartTag()
{
- m_wikiContext = (WikiContext) pageContext.getAttribute( WikiTagBase.ATTR_CONTEXT,
- PageContext.REQUEST_SCOPE );
+ m_wikiContext = (WikiContext)WikiActionBeanFactory.findActionBean( pageContext );
WikiEngine engine = m_wikiContext.getEngine();
AttachmentManager mgr = engine.getAttachmentManager();
@@ -90,9 +89,7 @@
WikiContext context = (WikiContext)m_wikiContext.clone();
context.setPage( att );
- pageContext.setAttribute( WikiTagBase.ATTR_CONTEXT,
- context,
- PageContext.REQUEST_SCOPE );
+ WikiActionBeanFactory.saveActionBean( pageContext, context );
pageContext.setAttribute( getId(), att );
}
@@ -140,9 +137,7 @@
WikiContext context = (WikiContext)m_wikiContext.clone();
context.setPage( att );
- pageContext.setAttribute( WikiTagBase.ATTR_CONTEXT,
- context,
- PageContext.REQUEST_SCOPE );
+ WikiActionBeanFactory.saveActionBean( pageContext, context );
pageContext.setAttribute( getId(), att );
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/AuthorTag.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/AuthorTag.java?rev=630513&r1=630512&r2=630513&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/AuthorTag.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/AuthorTag.java Sat Feb 23 11:29:13 2008
@@ -21,6 +21,7 @@
import java.io.IOException;
+import com.ecyrd.jspwiki.WikiContext;
import com.ecyrd.jspwiki.WikiEngine;
import com.ecyrd.jspwiki.WikiPage;
import com.ecyrd.jspwiki.TextUtil;
@@ -43,8 +44,14 @@
public final int doWikiStartTag()
throws IOException
{
- WikiEngine engine = m_wikiContext.getEngine();
- WikiPage page = m_wikiContext.getPage();
+ if ( !( m_actionBean instanceof WikiContext ) )
+ {
+ return SKIP_BODY;
+ }
+
+ WikiContext context = (WikiContext)m_actionBean;
+ WikiEngine engine = context.getEngine();
+ WikiPage page = context.getPage();
String author = page.getAuthor();
@@ -58,11 +65,11 @@
RenderingManager mgr = engine.getRenderingManager();
- MarkupParser p = mgr.getParser( m_wikiContext, "["+author+"|"+author+"]" );
+ MarkupParser p = mgr.getParser( context, "["+author+"|"+author+"]" );
WikiDocument d = p.parse();
- author = mgr.getHTML( m_wikiContext, d );
+ author = mgr.getHTML( context, d );
}
pageContext.getOut().print( author );
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/BaseURLTag.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/BaseURLTag.java?rev=630513&r1=630512&r2=630513&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/BaseURLTag.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/BaseURLTag.java Sat Feb 23 11:29:13 2008
@@ -35,7 +35,7 @@
public final int doWikiStartTag()
throws IOException
{
- pageContext.getOut().print( m_wikiContext.getEngine().getBaseURL() );
+ pageContext.getOut().print( m_actionBean.getEngine().getBaseURL() );
return SKIP_BODY;
}
}
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/BreadcrumbsTag.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/BreadcrumbsTag.java?rev=630513&r1=630512&r2=630513&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/BreadcrumbsTag.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/BreadcrumbsTag.java Sat Feb 23 11:29:13 2008
@@ -19,16 +19,17 @@
*/
package com.ecyrd.jspwiki.tags;
-import com.ecyrd.jspwiki.WikiContext;
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.LinkedList;
import javax.servlet.http.HttpSession;
import javax.servlet.jsp.JspWriter;
import org.apache.log4j.Logger;
-import java.io.IOException;
-import java.io.Serializable;
-import java.util.LinkedList;
+import com.ecyrd.jspwiki.WikiContext;
+import com.ecyrd.jspwiki.action.ViewActionBean;
/**
* Implement a "breadcrumb" (most recently visited) trail. This tag can be added to any view jsp page.
@@ -88,28 +89,27 @@
HttpSession session = pageContext.getSession();
FixedQueue trail = (FixedQueue) session.getAttribute(BREADCRUMBTRAIL_KEY);
- String page = m_wikiContext.getPage().getName();
-
if( trail == null )
{
trail = new FixedQueue(m_maxQueueSize);
}
- if( m_wikiContext.getRequestContext().equals( WikiContext.VIEW ) )
+ if( m_actionBean instanceof ViewActionBean && m_page != null )
{
+ String pageName = m_page.getName();
if( trail.isEmpty() )
{
- trail.pushItem(page);
+ trail.pushItem( pageName );
}
else
{
//
// Don't add the page to the queue if the page was just refreshed
//
- if( !((String) trail.getLast()).equals(page) )
+ if( !((String) trail.getLast()).equals( pageName ) )
{
- trail.pushItem(page);
- log.debug("added page: " + page);
+ trail.pushItem( pageName );
+ log.debug( "added page: " + pageName );
}
log.debug("didn't add page because of refresh");
}
@@ -135,10 +135,14 @@
//FIXME: I can't figure out how to detect the appropriate jsp page to put here, so I hard coded Wiki.jsp
//This breaks when you view an attachment metadata page
- out.print("<a class=\"" + linkclass + "\" href=\"" +
- m_wikiContext.getViewURL(curPage)+ "\">" + curPage + "</a>");
-
- if( i < queueSize - 2 )
+ if ( m_actionBean instanceof WikiContext )
+ {
+ WikiContext context = (WikiContext)m_actionBean;
+ out.print("<a class=\"" + linkclass + "\" href=\"" +
+ context.getViewURL(curPage)+ "\">" + curPage + "</a>");
+ }
+
+ if( i < queueSize - 2 )
{
out.print(m_separator);
}
@@ -151,7 +155,7 @@
* Extends the LinkedList class to provide a fixed-size queue implementation
*/
public static class FixedQueue
- extends LinkedList
+ extends LinkedList<Object>
implements Serializable
{
private int m_size;
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/CalendarTag.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/CalendarTag.java?rev=630513&r1=630512&r2=630513&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/CalendarTag.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/CalendarTag.java Sat Feb 23 11:29:13 2008
@@ -23,6 +23,8 @@
import java.util.Calendar;
import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
import java.text.SimpleDateFormat;
import java.text.ParseException;
@@ -30,9 +32,9 @@
import javax.servlet.http.HttpServletRequest;
import com.ecyrd.jspwiki.WikiEngine;
-import com.ecyrd.jspwiki.WikiPage;
import com.ecyrd.jspwiki.WikiContext;
import com.ecyrd.jspwiki.TextUtil;
+import com.ecyrd.jspwiki.action.ViewActionBean;
import com.ecyrd.jspwiki.providers.ProviderException;
@@ -102,11 +104,9 @@
private String format( String txt )
{
- WikiPage p = m_wikiContext.getPage();
-
- if( p != null )
+ if( m_page != null )
{
- return TextUtil.replaceString( txt, "%p", p.getName() );
+ return TextUtil.replaceString( txt, "%p", m_page.getName() );
}
return txt;
@@ -117,7 +117,7 @@
*/
private String getDayLink( Calendar day )
{
- WikiEngine engine = m_wikiContext.getEngine();
+ WikiEngine engine = m_actionBean.getEngine();
String result = "";
if( m_pageFormat != null )
@@ -134,7 +134,8 @@
}
else
{
- result = "<td class=\"link\"><a href=\""+m_wikiContext.getViewURL( pagename )+"\">"+
+ WikiContext context = (WikiContext)m_actionBean;
+ result = "<td class=\"link\"><a href=\""+context.getViewURL( pagename )+"\">"+
day.get( Calendar.DATE )+"</a></td>";
}
}
@@ -192,14 +193,15 @@
nextMonth.add( Calendar.DATE, -1);
nextMonth.add( Calendar.MONTH, 1 ); // Now move to 1st day of next month
- if ( day.before(nextMonth) )
+ if ( day.before(nextMonth) && m_page != null )
{
- WikiPage thePage = m_wikiContext.getPage();
- String pageName = thePage.getName();
+ WikiContext context = (WikiContext)m_actionBean;
+ String pageName = m_page.getName();
String calendarDate = m_dateFormat.format(day.getTime());
- String url = m_wikiContext.getURL( WikiContext.VIEW, pageName,
- "calendar.date="+calendarDate );
+ Map<String,String> urlParams = new HashMap<String,String>();
+ urlParams.put("calendar.date", calendarDate );
+ String url = context.getContext().getURL( ViewActionBean.class, pageName, urlParams );
if ( (queryString != null) && (queryString.length() > 0) )
{
@@ -245,7 +247,7 @@
throws IOException,
ProviderException
{
- WikiEngine engine = m_wikiContext.getEngine();
+ WikiEngine engine = m_actionBean.getEngine();
JspWriter out = pageContext.getOut();
Calendar cal = Calendar.getInstance();
Calendar prevCal = Calendar.getInstance();
@@ -284,7 +286,7 @@
out.write( "<table class=\"calendar\">\n" );
- HttpServletRequest httpServletRequest = m_wikiContext.getHttpRequest();
+ HttpServletRequest httpServletRequest = m_actionBean.getContext().getRequest();
String queryString = engine.safeGetQueryString( httpServletRequest );
out.write( "<tr>"+
getMonthNaviLink(prevCal,"<<", queryString)+
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/CheckLockTag.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/CheckLockTag.java?rev=630513&r1=630512&r2=630513&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/CheckLockTag.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/CheckLockTag.java Sat Feb 23 11:29:13 2008
@@ -21,14 +21,13 @@
import java.io.IOException;
-import com.ecyrd.jspwiki.WikiEngine;
-import com.ecyrd.jspwiki.WikiPage;
-import com.ecyrd.jspwiki.PageManager;
+import javax.servlet.http.HttpSession;
+
import com.ecyrd.jspwiki.PageLock;
+import com.ecyrd.jspwiki.PageManager;
+import com.ecyrd.jspwiki.WikiEngine;
import com.ecyrd.jspwiki.providers.ProviderException;
-import javax.servlet.http.HttpSession;
-
/**
*
* @author Janne Jalkanen
@@ -71,18 +70,17 @@
throws IOException,
ProviderException
{
- WikiEngine engine = m_wikiContext.getEngine();
- WikiPage page = m_wikiContext.getPage();
+ WikiEngine engine = m_actionBean.getEngine();
- if( page != null )
+ if( m_page != null )
{
PageManager mgr = engine.getPageManager();
- PageLock lock = mgr.getCurrentLock( page );
+ PageLock lock = mgr.getCurrentLock( m_page );
HttpSession session = pageContext.getSession();
- PageLock userLock = (PageLock) session.getAttribute("lock-"+page.getName());
+ PageLock userLock = (PageLock) session.getAttribute("lock-"+m_page.getName());
if( (lock != null && m_mode == LOCKED && lock != userLock ) ||
(lock != null && m_mode == OWNED && lock == userLock ) ||
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/CheckRequestContextTag.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/CheckRequestContextTag.java?rev=630513&r1=630512&r2=630513&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/CheckRequestContextTag.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/CheckRequestContextTag.java Sat Feb 23 11:29:13 2008
@@ -65,7 +65,7 @@
{
for(int i = 0; i < m_contextList.length; i++ )
{
- String ctx = m_wikiContext.getRequestContext();
+ String ctx = m_actionBean.getRequestContext();
String checkedCtx = m_contextList[i];
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/CheckVersionTag.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/CheckVersionTag.java?rev=630513&r1=630512&r2=630513&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/CheckVersionTag.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/CheckVersionTag.java Sat Feb 23 11:29:13 2008
@@ -78,15 +78,14 @@
throws IOException,
ProviderException
{
- WikiEngine engine = m_wikiContext.getEngine();
- WikiPage page = m_wikiContext.getPage();
+ WikiEngine engine = m_actionBean.getEngine();
- if( page != null && engine.pageExists(page.getName()) )
+ if( m_page != null && engine.pageExists(m_page.getName()) )
{
- int version = page.getVersion();
+ int version = m_page.getVersion();
boolean include = false;
- WikiPage latest = engine.getPage( page.getName() );
+ WikiPage latest = engine.getPage( m_page.getName() );
//log.debug("Doing version check: this="+page.getVersion()+
// ", latest="+latest.getVersion());
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/CommentLinkTag.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/CommentLinkTag.java?rev=630513&r1=630512&r2=630513&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/CommentLinkTag.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/CommentLinkTag.java Sat Feb 23 11:29:13 2008
@@ -22,8 +22,8 @@
import java.io.IOException;
import javax.servlet.jsp.JspWriter;
-import com.ecyrd.jspwiki.WikiPage;
import com.ecyrd.jspwiki.WikiContext;
+import com.ecyrd.jspwiki.action.CommentActionBean;
/**
* Writes a comment link. Body of the link becomes the link text.
@@ -44,22 +44,20 @@
public final int doWikiStartTag()
throws IOException
{
- WikiPage page = null;
- String pageName = null;
+ String pageName = null;
//
// Determine the page and the link.
//
if( m_pageName == null )
{
- page = m_wikiContext.getPage();
- if( page == null )
+ if( m_page == null )
{
// You can't call this on the page itself anyways.
return SKIP_BODY;
}
- pageName = page.getName();
+ pageName = m_page.getName();
}
else
{
@@ -88,7 +86,7 @@
private String getCommentURL( String pageName )
{
- return m_wikiContext.getURL(WikiContext.COMMENT, pageName);
+ return ((WikiContext)m_actionBean).getContext().getURL(CommentActionBean.class, pageName);
}
}
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/ContentEncodingTag.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/ContentEncodingTag.java?rev=630513&r1=630512&r2=630513&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/ContentEncodingTag.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/ContentEncodingTag.java Sat Feb 23 11:29:13 2008
@@ -37,7 +37,7 @@
public final int doWikiStartTag()
throws IOException
{
- WikiEngine engine = m_wikiContext.getEngine();
+ WikiEngine engine = m_actionBean.getEngine();
pageContext.getOut().print( engine.getContentEncoding() );
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/ContentTag.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/ContentTag.java?rev=630513&r1=630512&r2=630513&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/ContentTag.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/ContentTag.java Sat Feb 23 11:29:13 2008
@@ -19,14 +19,15 @@
*/
package com.ecyrd.jspwiki.tags;
-import java.util.*;
+import java.util.HashMap;
+import java.util.Map;
import java.io.IOException;
import javax.servlet.jsp.JspException;
import javax.servlet.ServletException;
import com.ecyrd.jspwiki.providers.ProviderException;
-import com.ecyrd.jspwiki.*;
+import com.ecyrd.jspwiki.action.*;
/**
* Is used as a "super include" tag, which can include the proper context
@@ -40,56 +41,56 @@
{
private static final long serialVersionUID = 0L;
- private Map m_mappings = new HashMap();
+ private Map<Class <? extends WikiActionBean>,String> m_mappings = new HashMap<Class <? extends WikiActionBean>,String>();
public void setView( String s )
{
- m_mappings.put( WikiContext.VIEW, s );
+ m_mappings.put( ViewActionBean.class, s );
}
public void setDiff( String s )
{
- m_mappings.put( WikiContext.DIFF, s );
+ m_mappings.put( DiffActionBean.class, s );
}
public void setInfo( String s )
{
- m_mappings.put( WikiContext.INFO, s );
+ m_mappings.put( PageInfoActionBean.class, s );
}
public void setPreview( String s )
{
- m_mappings.put( WikiContext.PREVIEW, s );
+ m_mappings.put( PreviewActionBean.class, s );
}
public void setConflict( String s )
{
- m_mappings.put( WikiContext.CONFLICT, s );
+ m_mappings.put( DiffActionBean.class, s );
}
public void setFind( String s )
{
- m_mappings.put( WikiContext.FIND, s );
+ m_mappings.put( SearchActionBean.class, s );
}
public void setPrefs( String s )
{
- m_mappings.put( WikiContext.PREFS, s );
+ m_mappings.put( UserPreferencesActionBean.class, s );
}
public void setError( String s )
{
- m_mappings.put( WikiContext.ERROR, s );
+ m_mappings.put( ErrorActionBean.class, s );
}
public void setEdit( String s )
{
- m_mappings.put( WikiContext.EDIT, s );
+ m_mappings.put( EditActionBean.class, s );
}
public void setComment( String s )
{
- m_mappings.put( WikiContext.COMMENT, s );
+ m_mappings.put( CommentActionBean.class, s );
}
public final int doWikiStartTag()
@@ -105,23 +106,28 @@
try
{
// Check the overridden templates first
- String requestContext = m_wikiContext.getRequestContext();
- String contentTemplate = (String)m_mappings.get( requestContext );
+ String contentTemplate = m_mappings.get( m_actionBean.getClass() );
- // If not found, use the defaults
+ // If not found, use the default name (trim "ActionBean" from name, and append "Content"
+ // e.g., EditActionBean yields "EditContent.jsp"
if ( contentTemplate == null )
{
- contentTemplate = m_wikiContext.getContentTemplate();
+ String beanName = m_actionBean.getClass().getName();
+ if ( beanName.endsWith( "ActionBean" ) )
+ {
+ beanName = beanName.substring( 0, beanName.lastIndexOf( "ActionBean") );
+ }
+ contentTemplate = beanName + "Content.jsp";
}
// If still no, something fishy is going on
if( contentTemplate == null )
{
- throw new JspException("This template uses <wiki:Content/> in an unsupported context: " + requestContext );
+ throw new JspException("This template uses <wiki:Content/> in an unsupported context: " + m_actionBean.getClass().getName() );
}
- String page = m_wikiContext.getEngine().getTemplateManager().findJSP( pageContext,
- m_wikiContext.getTemplate(),
+ String page = m_actionBean.getEngine().getTemplateManager().findJSP( pageContext,
+ m_actionBean.getTemplate(),
contentTemplate );
pageContext.include( page );
}
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/CookieTag.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/CookieTag.java?rev=630513&r1=630512&r2=630513&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/CookieTag.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/CookieTag.java Sat Feb 23 11:29:13 2008
@@ -266,7 +266,7 @@
return;
}
String in = c.getValue();
- Map values = parseCookieValues( in );
+ Map<String, String> values = parseCookieValues( in );
values.put( item, value );
String cv = encodeValues( values );
c.setValue( cv );
@@ -291,9 +291,9 @@
* Parses a cookie value, of format name1%3Fvalue1&name2%3Fvalue2...,
* into a Map<String,String>.
*/
- private Map parseCookieValues( String s )
+ private Map<String, String> parseCookieValues( String s )
{
- Map rval = new HashMap();
+ Map<String,String> rval = new HashMap<String,String>();
if( s == null )
{
return rval;
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/DiffLinkTag.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/DiffLinkTag.java?rev=630513&r1=630512&r2=630513&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/DiffLinkTag.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/DiffLinkTag.java Sat Feb 23 11:29:13 2008
@@ -20,9 +20,13 @@
package com.ecyrd.jspwiki.tags;
import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
import javax.servlet.jsp.JspWriter;
import com.ecyrd.jspwiki.*;
+import com.ecyrd.jspwiki.action.DiffActionBean;
/**
* Writes a diff link. Body of the link becomes the link text.
@@ -83,14 +87,14 @@
public final int doWikiStartTag()
throws IOException
{
- WikiEngine engine = m_wikiContext.getEngine();
+ WikiEngine engine = m_actionBean.getEngine();
String pageName = m_pageName;
- if( m_pageName == null )
+ if( pageName == null )
{
- if( m_wikiContext.getPage() != null )
+ if( m_page != null )
{
- pageName = m_wikiContext.getPage().getName();
+ pageName = m_page.getName();
}
else
{
@@ -125,12 +129,12 @@
}
else if( VER_PREVIOUS.equals(getVersion()) )
{
- r1 = m_wikiContext.getPage().getVersion() - 1;
+ r1 = m_page.getVersion() - 1;
r1 = (r1 < 1 ) ? 1 : r1;
}
else if( VER_CURRENT.equals(getVersion()) )
{
- r1 = m_wikiContext.getPage().getVersion();
+ r1 = m_page.getVersion();
}
else
{
@@ -146,21 +150,24 @@
}
else if( VER_PREVIOUS.equals(getNewVersion()) )
{
- r2 = m_wikiContext.getPage().getVersion() - 1;
+ r2 = m_page.getVersion() - 1;
r2 = (r2 < 1 ) ? 1 : r2;
}
else if( VER_CURRENT.equals(getNewVersion()) )
{
- r2 = m_wikiContext.getPage().getVersion();
+ r2 = m_page.getVersion();
}
else
{
r2 = Integer.parseInt( getNewVersion() );
}
- String url = m_wikiContext.getURL( WikiContext.DIFF,
+ Map<String,String> urlParams = new HashMap<String,String>();
+ urlParams.put("r1", String.valueOf( r1 ));
+ urlParams.put("r2", String.valueOf( r2 ));
+ String url = m_actionBean.getContext().getURL( DiffActionBean.class,
pageName,
- "r1="+r1+"&r2="+r2 );
+ urlParams );
switch( m_format )
{
case ANCHOR:
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/EditLinkTag.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/EditLinkTag.java?rev=630513&r1=630512&r2=630513&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/EditLinkTag.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/EditLinkTag.java Sat Feb 23 11:29:13 2008
@@ -20,11 +20,15 @@
package com.ecyrd.jspwiki.tags;
import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
import javax.servlet.jsp.JspWriter;
import com.ecyrd.jspwiki.WikiContext;
import com.ecyrd.jspwiki.WikiEngine;
import com.ecyrd.jspwiki.WikiPage;
+import com.ecyrd.jspwiki.action.EditActionBean;
/**
* Writes an edit link. Body of the link becomes the link text.
@@ -75,9 +79,8 @@
public final int doWikiStartTag()
throws IOException
{
- WikiEngine engine = m_wikiContext.getEngine();
+ WikiEngine engine = m_actionBean.getEngine();
WikiPage page = null;
- String versionString = "";
String pageName = null;
//
@@ -85,14 +88,13 @@
//
if( m_pageName == null )
{
- page = m_wikiContext.getPage();
- if( page == null )
+ if( m_page == null )
{
// You can't call this on the page itself anyways.
return SKIP_BODY;
}
- pageName = page.getName();
+ pageName = m_page.getName();
}
else
{
@@ -102,11 +104,12 @@
//
// Determine the latest version, if the version attribute is "this".
//
+ Map<String,String> urlParams = new HashMap<String,String>();
if( m_version != null )
{
if( "this".equalsIgnoreCase(m_version) )
{
- if( page == null )
+ if( m_page == null )
{
// No page, so go fetch according to page name.
page = engine.getPage( m_pageName );
@@ -114,12 +117,12 @@
if( page != null )
{
- versionString = "version="+page.getVersion();
+ urlParams.put("version", String.valueOf(page.getVersion()));
}
}
else
{
- versionString = "version="+m_version;
+ urlParams.put("version", String.valueOf(m_version));
}
}
@@ -128,17 +131,19 @@
// user commanded.
//
JspWriter out = pageContext.getOut();
+ WikiContext context = (WikiContext)m_actionBean;
switch( m_format )
{
case ANCHOR:
- out.print("<a href=\""+m_wikiContext.getURL(WikiContext.EDIT,pageName, versionString)
- +"\" accesskey=\"" + m_accesskey + "\" title=\"" + m_title + "\">");
- break;
+ urlParams.put("accesskey", m_accesskey);
+ urlParams.put("title", m_title);
+ out.print("<a href=\""+context.getContext().getURL(EditActionBean.class,pageName, urlParams) + "\">");
+ break;
case URL:
- out.print( m_wikiContext.getURL(WikiContext.EDIT,pageName,versionString) );
- break;
+ out.print( context.getContext().getURL(EditActionBean.class,pageName,urlParams) );
+ break;
}
return EVAL_BODY_INCLUDE;
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/EditorIteratorTag.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/EditorIteratorTag.java?rev=630513&r1=630512&r2=630513&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/EditorIteratorTag.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/EditorIteratorTag.java Sat Feb 23 11:29:13 2008
@@ -26,6 +26,7 @@
import com.ecyrd.jspwiki.WikiContext;
import com.ecyrd.jspwiki.WikiEngine;
+import com.ecyrd.jspwiki.action.WikiActionBeanFactory;
import com.ecyrd.jspwiki.ui.Editor;
import com.ecyrd.jspwiki.ui.EditorManager;
@@ -45,14 +46,14 @@
public final int doStartTag()
{
- m_wikiContext = WikiContext.findContext(pageContext);
+ m_wikiContext = (WikiContext) WikiActionBeanFactory.findActionBean( pageContext );
WikiEngine engine = m_wikiContext.getEngine();
EditorManager mgr = engine.getEditorManager();
String[] editorList = mgr.getEditorList();
- Collection editors = new ArrayList();
+ Collection<Editor>editors = new ArrayList<Editor>();
for ( int i = 0; i < editorList.length; i++ )
{
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/FeedDiscoveryTag.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/FeedDiscoveryTag.java?rev=630513&r1=630512&r2=630513&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/FeedDiscoveryTag.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/FeedDiscoveryTag.java Sat Feb 23 11:29:13 2008
@@ -21,10 +21,14 @@
import java.io.IOException;
+import javax.servlet.http.HttpServletResponse;
+
+import net.sourceforge.stripes.action.UrlBinding;
+import net.sourceforge.stripes.util.UrlBuilder;
+
import com.ecyrd.jspwiki.TextUtil;
-import com.ecyrd.jspwiki.WikiContext;
import com.ecyrd.jspwiki.WikiEngine;
-import com.ecyrd.jspwiki.WikiPage;
+import com.ecyrd.jspwiki.action.RSSActionBean;
import com.ecyrd.jspwiki.plugin.WeblogPlugin;
import com.ecyrd.jspwiki.util.BlogUtil;
@@ -42,40 +46,56 @@
public final int doWikiStartTag()
throws IOException
{
- WikiEngine engine = m_wikiContext.getEngine();
- WikiPage page = m_wikiContext.getPage();
-
- String encodedName = engine.encodeName( page.getName() );
+ WikiEngine engine = m_actionBean.getEngine();
- String rssURL = engine.getGlobalRSSURL();
- String rssFeedURL = engine.getURL(WikiContext.NONE, "rss.jsp",
- "page="+encodedName+"&mode=wiki",
- true );
+ String rssSiteURL = engine.getGlobalRSSURL();
- if( rssURL != null )
+ if( rssSiteURL != null )
{
- String siteName = BlogUtil.getSiteName(m_wikiContext);
+ // Write the feed URL for the site
+ String siteName = BlogUtil.getSiteName(m_actionBean);
siteName = TextUtil.replaceEntities( siteName );
-
- pageContext.getOut().print("<link rel=\"alternate\" type=\"application/rss+xml\" title=\"RSS wiki feed for the entire site.\" href=\""+rssURL+"\" />\n");
- pageContext.getOut().print("<link rel=\"alternate\" type=\"application/rss+xml\" title=\"RSS wiki feed for page "+siteName+".\" href=\""+rssFeedURL+"\" />\n");
-
- // TODO: Enable this
- /*
- pageContext.getOut().print("<link rel=\"service.post\" type=\"application/atom+xml\" title=\""+
- siteName+"\" href=\""+atomPostURL+"\" />\n");
- */
- // FIXME: This does not work always, as plugins are not initialized until the first fetch
- if( "true".equals(page.getAttribute(WeblogPlugin.ATTR_ISWEBLOG)) )
+ pageContext.getOut().print("<link rel=\"alternate\" type=\"application/rss+xml\" title=\"RSS wiki feed for the entire site.\" href=\""+rssSiteURL+"\" />\n");
+
+ // Write the feed URL for this page
+ if ( m_page != null )
{
- String blogFeedURL = engine.getURL(WikiContext.NONE,"rss.jsp","page="+encodedName,true);
- String atomFeedURL = engine.getURL(WikiContext.NONE,"rss.jsp","page="+encodedName+"&type=atom",true);
-
- pageContext.getOut().print("<link rel=\"alternate\" type=\"application/rss+xml\" title=\"RSS feed for weblog "+
- siteName+".\" href=\""+blogFeedURL+"\" />\n");
+ HttpServletResponse httpResponse = (HttpServletResponse)pageContext.getResponse();
+ String encodedPageName = engine.encodeName( m_page.getName() );
+ String url = RSSActionBean.class.getAnnotation(UrlBinding.class).value();
+
+ // Create the feed
+ UrlBuilder urlBuilder = new UrlBuilder( url, true );
+ urlBuilder.addParameter("page", encodedPageName);
+ urlBuilder.addParameter("mode", "wiki");
+ String rssPageURL = httpResponse.encodeURL( urlBuilder.toString() );
+ if( rssPageURL != null )
+ {
+ pageContext.getOut().print("<link rel=\"alternate\" type=\"application/rss+xml\" title=\"RSS wiki feed for page "+siteName+".\" href=\""+rssPageURL+"\" />\n");
+
+ // TODO: Enable this
+ /*
+ pageContext.getOut().print("<link rel=\"service.post\" type=\"application/atom+xml\" title=\""+
+ siteName+"\" href=\""+atomPostURL+"\" />\n");
+ */
+ // FIXME: This does not work always, as plugins are not initialized until the first fetch
+ if( "true".equals(m_page.getAttribute(WeblogPlugin.ATTR_ISWEBLOG)) )
+ {
+ // Create blog feed URL
+ urlBuilder = new UrlBuilder( url, true );
+ urlBuilder.addParameter("page", encodedPageName);
+ String blogPageFeedURL = httpResponse.encodeURL( urlBuilder.toString() );
+ pageContext.getOut().print("<link rel=\"alternate\" type=\"application/rss+xml\" title=\"RSS feed for weblog "+
+ siteName+".\" href=\""+blogPageFeedURL+"\" />\n");
+
+ // Create atom feed URL
+ urlBuilder.addParameter("type", "atom");
+ String atomPageFeedURL = httpResponse.encodeURL( urlBuilder.toString() );
- pageContext.getOut().print("<link rel=\"service.feed\" type=\"application/atom+xml\" title=\"Atom 1.0 weblog feed for "+
- siteName+"\" href=\""+atomFeedURL+"\" />\n");
+ pageContext.getOut().print("<link rel=\"service.feed\" type=\"application/atom+xml\" title=\"Atom 1.0 weblog feed for "+
+ siteName+"\" href=\""+atomPageFeedURL+"\" />\n");
+ }
+ }
}
}
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/HasAttachmentsTag.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/HasAttachmentsTag.java?rev=630513&r1=630512&r2=630513&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/HasAttachmentsTag.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/HasAttachmentsTag.java Sat Feb 23 11:29:13 2008
@@ -22,7 +22,6 @@
import java.io.IOException;
import com.ecyrd.jspwiki.WikiEngine;
-import com.ecyrd.jspwiki.WikiPage;
import com.ecyrd.jspwiki.attachment.AttachmentManager;
import com.ecyrd.jspwiki.providers.ProviderException;
@@ -40,15 +39,14 @@
public final int doWikiStartTag()
throws IOException
{
- WikiEngine engine = m_wikiContext.getEngine();
- WikiPage page = m_wikiContext.getPage();
+ WikiEngine engine = m_actionBean.getEngine();
AttachmentManager mgr = engine.getAttachmentManager();
try
{
- if( page != null && engine.pageExists(page) && mgr.attachmentsEnabled() )
+ if( m_page != null && engine.pageExists(m_page) && mgr.attachmentsEnabled() )
{
- if( mgr.hasAttachments(page) )
+ if( mgr.hasAttachments(m_page) )
{
return EVAL_BODY_INCLUDE;
}
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/HistoryIteratorTag.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/HistoryIteratorTag.java?rev=630513&r1=630512&r2=630513&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/HistoryIteratorTag.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/HistoryIteratorTag.java Sat Feb 23 11:29:13 2008
@@ -22,13 +22,13 @@
import java.io.IOException;
import java.util.Collection;
import javax.servlet.jsp.JspWriter;
-import javax.servlet.jsp.PageContext;
import org.apache.log4j.Logger;
import com.ecyrd.jspwiki.WikiEngine;
import com.ecyrd.jspwiki.WikiContext;
import com.ecyrd.jspwiki.WikiPage;
+import com.ecyrd.jspwiki.action.WikiActionBeanFactory;
import com.ecyrd.jspwiki.providers.ProviderException;
/**
@@ -53,8 +53,7 @@
public final int doStartTag()
{
- m_wikiContext = (WikiContext) pageContext.getAttribute( WikiTagBase.ATTR_CONTEXT,
- PageContext.REQUEST_SCOPE );
+ m_wikiContext = (WikiContext) WikiActionBeanFactory.findActionBean( pageContext );
WikiEngine engine = m_wikiContext.getEngine();
WikiPage page;
@@ -79,9 +78,7 @@
{
WikiContext context = (WikiContext)m_wikiContext.clone();
context.setPage( (WikiPage)m_iterator.next() );
- pageContext.setAttribute( WikiTagBase.ATTR_CONTEXT,
- context,
- PageContext.REQUEST_SCOPE );
+ WikiActionBeanFactory.saveActionBean( pageContext, context );
pageContext.setAttribute( getId(),
context.getPage() );
}
@@ -123,9 +120,7 @@
{
WikiContext context = (WikiContext)m_wikiContext.clone();
context.setPage( (WikiPage)m_iterator.next() );
- pageContext.setAttribute( WikiTagBase.ATTR_CONTEXT,
- context,
- PageContext.REQUEST_SCOPE );
+ WikiActionBeanFactory.saveActionBean( pageContext, context );
pageContext.setAttribute( getId(),
context.getPage() );
return EVAL_BODY_BUFFERED;
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/IncludeResourcesTag.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/IncludeResourcesTag.java?rev=630513&r1=630512&r2=630513&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/IncludeResourcesTag.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/IncludeResourcesTag.java Sat Feb 23 11:29:13 2008
@@ -50,7 +50,7 @@
public int doWikiStartTag() throws Exception
{
//String marker = m_wikiContext.getEngine().getTemplateManager().getMarker(m_wikiContext, m_type);
- String marker = TemplateManager.getMarker(m_wikiContext, m_type);
+ String marker = TemplateManager.getMarker(m_actionBean, m_type);
pageContext.getOut().println( marker );
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/IncludeTag.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/IncludeTag.java?rev=630513&r1=630512&r2=630513&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/IncludeTag.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/IncludeTag.java Sat Feb 23 11:29:13 2008
@@ -39,22 +39,24 @@
{
private static final long serialVersionUID = 0L;
- protected String m_page;
+ protected String m_pageName;
+ protected boolean m_searchTemplates;
public void initTag()
{
super.initTag();
- m_page = null;
+ m_pageName = null;
+ m_searchTemplates = false;
}
public void setPage( String page )
{
- m_page = page;
+ m_pageName = page;
}
public String getPage()
{
- return m_page;
+ return m_pageName;
}
public final int doWikiStartTag()
@@ -71,13 +73,13 @@
{
try
{
- String page = m_wikiContext.getEngine().getTemplateManager().findJSP( pageContext,
- m_wikiContext.getTemplate(),
- m_page );
+ String page = m_actionBean.getEngine().getTemplateManager().findJSP( pageContext,
+ m_actionBean.getTemplate(),
+ m_pageName );
if( page == null )
{
- pageContext.getOut().println("No template file called '"+TextUtil.replaceEntities(m_page)+"'");
+ pageContext.getOut().println("No template file called '"+TextUtil.replaceEntities(m_pageName)+"'");
}
else
{
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/InsertDiffTag.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/InsertDiffTag.java?rev=630513&r1=630512&r2=630513&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/InsertDiffTag.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/InsertDiffTag.java Sat Feb 23 11:29:13 2008
@@ -24,8 +24,8 @@
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.PageContext;
-import com.ecyrd.jspwiki.WikiContext;
import com.ecyrd.jspwiki.WikiEngine;
+import com.ecyrd.jspwiki.WikiPage;
/**
* Writes difference between two pages using a HTML table. If there is
@@ -81,17 +81,16 @@
public final int doWikiStartTag()
throws IOException
{
- WikiEngine engine = m_wikiContext.getEngine();
- WikiContext ctx;
+ WikiEngine engine = m_actionBean.getEngine();
+ WikiPage page;
if( m_pageName == null )
{
- ctx = m_wikiContext;
+ page = m_page;
}
else
{
- ctx = (WikiContext)m_wikiContext.clone();
- ctx.setPage( engine.getPage(m_pageName) );
+ page = engine.getPage( m_pageName );
}
Integer vernew = (Integer) pageContext.getAttribute( ATTR_NEWVERSION,
@@ -101,11 +100,11 @@
log.info("Request diff between version "+verold+" and "+vernew);
- if( ctx.getPage() != null )
+ if( page != null )
{
JspWriter out = pageContext.getOut();
- String diff = engine.getDiff( ctx,
+ String diff = engine.getDiff( engine.getWikiActionBeanFactory().newViewActionBean( page ),
vernew.intValue(),
verold.intValue() );
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/InsertPageTag.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/InsertPageTag.java?rev=630513&r1=630512&r2=630513&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/InsertPageTag.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/InsertPageTag.java Sat Feb 23 11:29:13 2008
@@ -22,6 +22,7 @@
import java.io.IOException;
import javax.servlet.jsp.JspWriter;
+import com.ecyrd.jspwiki.WikiContext;
import com.ecyrd.jspwiki.WikiEngine;
import com.ecyrd.jspwiki.WikiPage;
import com.ecyrd.jspwiki.providers.ProviderException;
@@ -92,8 +93,8 @@
throws IOException,
ProviderException
{
- WikiEngine engine = m_wikiContext.getEngine();
- WikiPage insertedPage;
+ WikiEngine engine = m_actionBean.getEngine();
+ WikiPage page;
//
// NB: The page might not really exist if the user is currently
@@ -103,36 +104,37 @@
if( m_pageName == null )
{
- insertedPage = m_wikiContext.getPage();
- if( !engine.pageExists(insertedPage) ) return SKIP_BODY;
+ page = m_page;
+ if( !engine.pageExists( page ) ) return SKIP_BODY;
}
else
{
- insertedPage = engine.getPage( m_pageName );
+ page = engine.getPage( m_pageName );
}
- if( insertedPage != null )
+ if( page != null )
{
// FIXME: Do version setting later.
// page.setVersion( WikiProvider.LATEST_VERSION );
- log.debug("Inserting page "+insertedPage);
+ log.debug("Inserting page "+page);
JspWriter out = pageContext.getOut();
- WikiPage oldPage = m_wikiContext.setRealPage( insertedPage );
+ WikiContext context = (WikiContext)m_actionBean;
+ WikiPage oldPage = context.setRealPage( page );
switch( m_mode )
{
case HTML:
- out.print( engine.getHTML( m_wikiContext, insertedPage ) );
+ out.print( engine.getHTML(context, page) );
break;
case PLAIN:
- out.print( engine.getText( m_wikiContext, insertedPage ) );
+ out.print( engine.getText(context, page) );
break;
}
- m_wikiContext.setRealPage( oldPage );
+ context.setRealPage( oldPage );
}
return SKIP_BODY;
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/IteratorTag.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/IteratorTag.java?rev=630513&r1=630512&r2=630513&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/IteratorTag.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/IteratorTag.java Sat Feb 23 11:29:13 2008
@@ -26,12 +26,12 @@
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.BodyTagSupport;
import javax.servlet.jsp.tagext.TryCatchFinally;
-import javax.servlet.jsp.PageContext;
import org.apache.log4j.Logger;
import com.ecyrd.jspwiki.WikiContext;
import com.ecyrd.jspwiki.WikiPage;
+import com.ecyrd.jspwiki.action.WikiActionBeanFactory;
/**
* Iterates through tags.
@@ -110,7 +110,7 @@
*/
public int doStartTag()
{
- m_wikiContext = WikiContext.findContext(pageContext);
+ m_wikiContext = (WikiContext) WikiActionBeanFactory.findActionBean( pageContext );
resetIterator();
@@ -142,9 +142,7 @@
//
// Push it to the iterator stack, and set the id.
//
- pageContext.setAttribute( WikiTagBase.ATTR_CONTEXT,
- context,
- PageContext.REQUEST_SCOPE );
+ WikiActionBeanFactory.saveActionBean( pageContext, context );
pageContext.setAttribute( getId(),
o );
}
@@ -155,9 +153,7 @@
public int doEndTag()
{
// Return back to the original.
- pageContext.setAttribute( WikiTagBase.ATTR_CONTEXT,
- m_wikiContext,
- PageContext.REQUEST_SCOPE );
+ WikiActionBeanFactory.saveActionBean( pageContext, m_wikiContext );
return EVAL_PAGE;
}
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/LinkTag.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/LinkTag.java?rev=630513&r1=630512&r2=630513&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/LinkTag.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/LinkTag.java Sat Feb 23 11:29:13 2008
@@ -20,15 +20,17 @@
package com.ecyrd.jspwiki.tags;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.Map;
+import javax.servlet.http.HttpServletResponse;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.BodyContent;
import javax.servlet.jsp.tagext.BodyTag;
import com.ecyrd.jspwiki.*;
+import com.ecyrd.jspwiki.action.AttachActionBean;
+import com.ecyrd.jspwiki.action.NoneActionBean;
import com.ecyrd.jspwiki.attachment.Attachment;
import com.ecyrd.jspwiki.parser.JSPWikiMarkupParser;
import com.ecyrd.jspwiki.parser.MarkupParser;
@@ -67,7 +69,7 @@
private boolean m_absolute = false;
private boolean m_overrideAbsolute = false;
- private Map m_containedParams;
+ private Map<String,String> m_containedParams;
private BodyContent m_bodyContent;
@@ -159,7 +161,7 @@
{
if( m_containedParams == null )
{
- m_containedParams = new HashMap();
+ m_containedParams = new HashMap<String,String>();
}
m_containedParams.put( name, value );
}
@@ -176,30 +178,37 @@
private String figureOutURL()
throws ProviderException
{
+ // Init container parameters if not set
+ if( m_containedParams == null )
+ {
+ m_containedParams = new HashMap<String,String>();
+ }
+
+ // Set up the URL parameters map
String url = null;
- WikiEngine engine = m_wikiContext.getEngine();
+ WikiEngine engine = m_actionBean.getEngine();
+ HttpServletResponse response = (HttpServletResponse)pageContext.getResponse();
+ Map<String,String> urlParams = new HashMap<String,String>();
- if( m_pageName == null )
+ if( m_pageName == null )
{
- WikiPage page = m_wikiContext.getPage();
-
- if( page != null )
+ if( m_page != null )
{
- m_pageName = page.getName();
+ m_pageName = m_page.getName();
}
}
if( m_templatefile != null )
{
- String params = addParamsForRecipient( null, m_containedParams );
+ urlParams.putAll( m_containedParams );
String template = engine.getTemplateDir();
- url = engine.getURL( WikiContext.NONE, "templates/"+template+"/"+m_templatefile, params, false );
+ url = response.encodeURL( m_actionBean.getContext().getURL( NoneActionBean.class, "templates/"+template+"/"+m_templatefile, urlParams, false ) );
}
else if( m_jsp != null )
{
- String params = addParamsForRecipient( null, m_containedParams );
+ urlParams.putAll( m_containedParams );
//url = m_wikiContext.getURL( WikiContext.NONE, m_jsp, params );
- url = engine.getURL( WikiContext.NONE, m_jsp, params, m_absolute );
+ url = response.encodeURL( m_actionBean.getContext().getURL( NoneActionBean.class, m_jsp, urlParams, m_absolute ) );
}
else if( m_ref != null )
{
@@ -233,7 +242,11 @@
{
int hashMark = -1;
- String parms = (m_version != null) ? "version="+getVersion() : null;
+ Map<String,String> parms = new HashMap<String,String>();
+ if (m_version != null)
+ {
+ parms.put("version", getVersion());
+ }
//
// Internal wiki link, but is it an attachment link?
@@ -242,7 +255,7 @@
if( p instanceof Attachment )
{
- url = m_wikiContext.getURL( WikiContext.ATTACH, m_pageName );
+ url = m_actionBean.getContext().getURL( AttachActionBean.class, m_pageName );
}
else if( (hashMark = m_ref.indexOf('#')) != -1 )
{
@@ -279,25 +292,19 @@
{
WikiPage p = engine.getPage( m_pageName );
- String parms = (m_version != null) ? "version="+getVersion() : null;
-
- parms = addParamsForRecipient( parms, m_containedParams );
+ if ( m_version != null )
+ {
+ urlParams.put("version", getVersion());
+ }
+ urlParams.putAll( m_containedParams );
if( p instanceof Attachment )
{
- String ctx = m_context;
- // Switch context appropriately when attempting to view an
- // attachment, but don't override the context setting otherwise
- if( m_context == null || m_context.equals( WikiContext.VIEW ) )
- {
- ctx = WikiContext.ATTACH;
- }
- url = engine.getURL( ctx, m_pageName, parms, m_absolute );
- //url = m_wikiContext.getURL( ctx, m_pageName, parms );
+ url = response.encodeURL( m_actionBean.getContext().getURL( AttachActionBean.class, m_pageName, urlParams, m_absolute ) );
}
else
{
- url = makeBasicURL( m_context, m_pageName, parms, m_absolute );
+ url = makeBasicURL( m_context, m_pageName, urlParams, m_absolute );
}
}
else
@@ -308,44 +315,13 @@
return url;
}
-
- private String addParamsForRecipient( String addTo, Map params )
- {
- if( params == null || params.size() == 0 )
- {
- return addTo;
- }
- StringBuffer buf = new StringBuffer();
- Iterator it = params.entrySet().iterator();
- while( it.hasNext() )
- {
- Map.Entry e = (Map.Entry) it.next();
- String n = (String)e.getKey();
- String v = (String)e.getValue();
- buf.append( n );
- buf.append( "=" );
- buf.append( v );
- if( it.hasNext() )
- {
- buf.append( "&" );
- }
- }
- if( addTo == null )
- {
- return buf.toString();
- }
- if( !addTo.endsWith( "&" ) )
- {
- return addTo + "&" + buf.toString();
- }
- return addTo + buf.toString();
- }
-
- private String makeBasicURL( String context, String page, String parms, boolean absolute )
+
+ private String makeBasicURL( String context, String page, Map<String,String>parms, boolean absolute )
{
String url;
- WikiEngine engine = m_wikiContext.getEngine();
-
+ WikiEngine engine = m_actionBean.getEngine();
+ WikiContext wikiContext = (WikiContext)m_actionBean;
+
if( context.equals( WikiContext.DIFF ) )
{
int r1 = 0;
@@ -359,12 +335,12 @@
}
else if( DiffLinkTag.VER_PREVIOUS.equals(getVersion()) )
{
- r1 = m_wikiContext.getPage().getVersion() - 1;
+ r1 = wikiContext.getPage().getVersion() - 1;
r1 = (r1 < 1 ) ? 1 : r1;
}
else if( DiffLinkTag.VER_CURRENT.equals(getVersion()) )
{
- r1 = m_wikiContext.getPage().getVersion();
+ r1 = wikiContext.getPage().getVersion();
}
else
{
@@ -379,23 +355,23 @@
}
else if( DiffLinkTag.VER_PREVIOUS.equals(m_compareToVersion) )
{
- r2 = m_wikiContext.getPage().getVersion() - 1;
+ r2 = wikiContext.getPage().getVersion() - 1;
r2 = (r2 < 1 ) ? 1 : r2;
}
else if( DiffLinkTag.VER_CURRENT.equals(m_compareToVersion) )
{
- r2 = m_wikiContext.getPage().getVersion();
+ r2 = wikiContext.getPage().getVersion();
}
else
{
r2 = Integer.parseInt( m_compareToVersion );
}
- parms = "r1="+r1+"&r2="+r2;
+ parms.put("r1", String.valueOf(r1));
+ parms.put("r2", String.valueOf(r2));
}
- //url = m_wikiContext.getURL( m_context, m_pageName, parms );
- url = engine.getURL( m_context, m_pageName, parms, m_absolute );
+ url = wikiContext.getContext().getURL( m_actionBean.getClass(), m_pageName, parms, m_absolute );
return url;
}
@@ -412,7 +388,7 @@
if( !m_overrideAbsolute )
{
// TODO: see WikiContext.getURL(); this check needs to be specified somewhere.
- WikiEngine engine = m_wikiContext.getEngine();
+ WikiEngine engine = m_actionBean.getEngine();
m_absolute = "absolute".equals( engine.getWikiProperties().getProperty( WikiEngine.PROP_REFSTYLE ) );
}
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/LinkToParentTag.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/LinkToParentTag.java?rev=630513&r1=630512&r2=630513&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/LinkToParentTag.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/LinkToParentTag.java Sat Feb 23 11:29:13 2008
@@ -21,7 +21,6 @@
import java.io.IOException;
-import com.ecyrd.jspwiki.WikiPage;
import com.ecyrd.jspwiki.attachment.Attachment;
/**
@@ -44,19 +43,17 @@
public int doWikiStartTag()
throws IOException
{
- WikiPage p = m_wikiContext.getPage();
-
//
// We just simply set the page to be our parent page
// and call the superclass.
//
- if( p instanceof Attachment )
+ if( m_page != null && m_page instanceof Attachment )
{
- setPage( ((Attachment)p).getParentName() );
+ setPage( ((Attachment)m_page).getParentName() );
}
else
{
- String name = p.getName();
+ String name = m_page.getName();
int entrystart = name.indexOf("_blogentry_");
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/LinkToTag.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/LinkToTag.java?rev=630513&r1=630512&r2=630513&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/LinkToTag.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/LinkToTag.java Sat Feb 23 11:29:13 2008
@@ -20,10 +20,14 @@
package com.ecyrd.jspwiki.tags;
import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
import javax.servlet.jsp.JspWriter;
import com.ecyrd.jspwiki.WikiContext;
-import com.ecyrd.jspwiki.WikiPage;
+import com.ecyrd.jspwiki.action.AttachActionBean;
+import com.ecyrd.jspwiki.action.ViewActionBean;
import com.ecyrd.jspwiki.attachment.Attachment;
/**
@@ -86,13 +90,11 @@
if( m_pageName == null )
{
- WikiPage p = m_wikiContext.getPage();
-
- if( p != null )
+ if( m_page != null )
{
- pageName = p.getName();
+ pageName = m_page.getName();
- isattachment = p instanceof Attachment;
+ isattachment = (m_page instanceof Attachment);
}
else
{
@@ -100,24 +102,29 @@
}
}
+ WikiContext context = (WikiContext)m_actionBean;
JspWriter out = pageContext.getOut();
String url;
String linkclass;
+ Map<String,String> urlParams = new HashMap<String,String>();
+ if ( getVersion() != null )
+ {
+ urlParams.put("version",getVersion());
+ }
+
if( isattachment )
{
- url = m_wikiContext.getURL(WikiContext.ATTACH,pageName,
- (getVersion() != null) ? "version="+getVersion() : null );
+ url = context.getContext().getURL(AttachActionBean.class, pageName, urlParams);
linkclass = "attachment";
}
else
{
- StringBuffer params = new StringBuffer();
- if( getVersion() != null ) params.append( "version="+getVersion() );
- if( getTemplate() != null ) params.append( (params.length()>0?"&":"") + "skin="+getTemplate() );
-
- url = m_wikiContext.getURL( WikiContext.VIEW, pageName,
- params.toString() );
+ if( getTemplate() != null )
+ {
+ urlParams.put("skin", getTemplate());
+ }
+ url = context.getContext().getURL( ViewActionBean.class, pageName, urlParams );
linkclass = "wikipage";
}
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/MessagesTag.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/MessagesTag.java?rev=630513&r1=630512&r2=630513&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/MessagesTag.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/MessagesTag.java Sat Feb 23 11:29:13 2008
@@ -84,7 +84,7 @@
public final int doWikiStartTag() throws IOException
{
- WikiSession session = m_wikiContext.getWikiSession();
+ WikiSession session = m_actionBean.getWikiSession();
if ( CLEAR.equals( m_action ) )
{
if ( m_topic == null )
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/NextVersionTag.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/NextVersionTag.java?rev=630513&r1=630512&r2=630513&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/NextVersionTag.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/NextVersionTag.java Sat Feb 23 11:29:13 2008
@@ -21,8 +21,6 @@
import java.io.IOException;
-import com.ecyrd.jspwiki.WikiPage;
-
/**
* Writes the version number of the next version of the page.
*
@@ -37,16 +35,17 @@
public final int doWikiStartTag()
throws IOException
{
- WikiPage page = m_wikiContext.getPage();
-
- int version = page.getVersion();
+ if ( m_page != null )
+ {
+ int version = m_page.getVersion();
- if( version == -1 )
- version = -1;
- else
- version++;
+ if( version == -1 )
+ version = -1;
+ else
+ version++;
- pageContext.getOut().print( version );
+ pageContext.getOut().print( version );
+ }
return SKIP_BODY;
}
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/NoSuchPageTag.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/NoSuchPageTag.java?rev=630513&r1=630512&r2=630513&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/NoSuchPageTag.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/NoSuchPageTag.java Sat Feb 23 11:29:13 2008
@@ -58,12 +58,12 @@
throws IOException,
ProviderException
{
- WikiEngine engine = m_wikiContext.getEngine();
+ WikiEngine engine = m_actionBean.getEngine();
WikiPage page;
if( m_pageName == null )
{
- page = m_wikiContext.getPage();
+ page = m_page;
}
else
{
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/PageDateTag.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/PageDateTag.java?rev=630513&r1=630512&r2=630513&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/PageDateTag.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/PageDateTag.java Sat Feb 23 11:29:13 2008
@@ -19,11 +19,9 @@
*/
package com.ecyrd.jspwiki.tags;
-import java.util.Date;
-import java.text.SimpleDateFormat;
import java.io.IOException;
-
-import com.ecyrd.jspwiki.WikiPage;
+import java.text.SimpleDateFormat;
+import java.util.Date;
/**
* Writes the modification date of the page, formatted
@@ -71,11 +69,9 @@
public final int doWikiStartTag()
throws IOException
{
- WikiPage page = m_wikiContext.getPage();
-
- if( page != null )
+ if( m_page != null )
{
- Date d = page.getLastModified();
+ Date d = m_page.getLastModified();
//
// Date may be null if the page does not exist.
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/PageInfoLinkTag.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/PageInfoLinkTag.java?rev=630513&r1=630512&r2=630513&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/PageInfoLinkTag.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/PageInfoLinkTag.java Sat Feb 23 11:29:13 2008
@@ -20,11 +20,11 @@
package com.ecyrd.jspwiki.tags;
import java.io.IOException;
+
import javax.servlet.jsp.JspWriter;
-import com.ecyrd.jspwiki.WikiContext;
import com.ecyrd.jspwiki.WikiEngine;
-import com.ecyrd.jspwiki.WikiPage;
+import com.ecyrd.jspwiki.action.PageInfoActionBean;
/**
* Writes a link to the Wiki PageInfo. Body of the link becomes the actual text.
@@ -60,16 +60,14 @@
public final int doWikiStartTag()
throws IOException
{
- WikiEngine engine = m_wikiContext.getEngine();
+ WikiEngine engine = m_actionBean.getEngine();
String pageName = m_pageName;
if( m_pageName == null )
{
- WikiPage p = m_wikiContext.getPage();
-
- if( p != null )
+ if( m_page != null )
{
- pageName = p.getName();
+ pageName = m_page.getName();
}
else
{
@@ -81,7 +79,7 @@
{
JspWriter out = pageContext.getOut();
- String url = m_wikiContext.getURL( WikiContext.INFO, pageName );
+ String url = m_actionBean.getContext().getURL( PageInfoActionBean.class, pageName );
switch( m_format )
{
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/PageNameTag.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/PageNameTag.java?rev=630513&r1=630512&r2=630513&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/PageNameTag.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/PageNameTag.java Sat Feb 23 11:29:13 2008
@@ -22,7 +22,6 @@
import java.io.IOException;
import com.ecyrd.jspwiki.WikiEngine;
-import com.ecyrd.jspwiki.WikiPage;
import com.ecyrd.jspwiki.attachment.Attachment;
/**
@@ -39,18 +38,17 @@
public final int doWikiStartTag()
throws IOException
{
- WikiEngine engine = m_wikiContext.getEngine();
- WikiPage page = m_wikiContext.getPage();
-
- if( page != null )
+ WikiEngine engine = m_actionBean.getEngine();
+
+ if( m_page != null )
{
- if( page instanceof Attachment )
+ if( m_page instanceof Attachment )
{
- pageContext.getOut().print( ((Attachment)page).getFileName() );
+ pageContext.getOut().print( ((Attachment)m_page).getFileName() );
}
else
{
- pageContext.getOut().print( engine.beautifyTitle( m_wikiContext.getName() ) );
+ pageContext.getOut().print( engine.beautifyTitle( m_page.getName() ) );
}
}
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/PageSizeTag.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/PageSizeTag.java?rev=630513&r1=630512&r2=630513&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/PageSizeTag.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/PageSizeTag.java Sat Feb 23 11:29:13 2008
@@ -22,7 +22,6 @@
import java.io.IOException;
import com.ecyrd.jspwiki.WikiEngine;
-import com.ecyrd.jspwiki.WikiPage;
import com.ecyrd.jspwiki.providers.ProviderException;
/**
@@ -39,19 +38,18 @@
public final int doWikiStartTag()
throws IOException
{
- WikiEngine engine = m_wikiContext.getEngine();
- WikiPage page = m_wikiContext.getPage();
+ WikiEngine engine = m_actionBean.getEngine();
try
{
- if( page != null )
+ if( m_page != null )
{
- long size = page.getSize();
+ long size = m_page.getSize();
- if( size == -1 && engine.pageExists(page) ) // should never happen with attachments
+ if( size == -1 && engine.pageExists(m_page) ) // should never happen with attachments
{
- size = engine.getPureText( page.getName(), page.getVersion() ).length();
- page.setSize( size );
+ size = engine.getPureText( m_page.getName(), m_page.getVersion() ).length();
+ m_page.setSize( size );
}
pageContext.getOut().write( Long.toString(size) );
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/PageTypeTag.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/PageTypeTag.java?rev=630513&r1=630512&r2=630513&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/PageTypeTag.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/PageTypeTag.java Sat Feb 23 11:29:13 2008
@@ -21,7 +21,6 @@
import java.io.IOException;
-import com.ecyrd.jspwiki.WikiPage;
import com.ecyrd.jspwiki.attachment.Attachment;
/**
@@ -56,21 +55,19 @@
public final int doWikiStartTag()
throws IOException
{
- WikiPage page = m_wikiContext.getPage();
-
- if( page != null )
+ if( m_page != null )
{
- if( m_type.equals("attachment") && page instanceof Attachment )
+ if( m_type.equals("attachment") && m_page instanceof Attachment )
{
return EVAL_BODY_INCLUDE;
}
- if( m_type.equals("page") && !(page instanceof Attachment) )
+ if( m_type.equals("page") && !(m_page instanceof Attachment) )
{
return EVAL_BODY_INCLUDE;
}
- if( m_type.equals("weblogentry") && !(page instanceof Attachment) && page.getName().indexOf("_blogentry_") != -1 )
+ if( m_type.equals("weblogentry") && !(m_page instanceof Attachment) && m_page.getName().indexOf("_blogentry_") != -1 )
{
return EVAL_BODY_INCLUDE;
}
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/PageVersionTag.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/PageVersionTag.java?rev=630513&r1=630512&r2=630513&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/PageVersionTag.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/tags/PageVersionTag.java Sat Feb 23 11:29:13 2008
@@ -21,8 +21,6 @@
import java.io.IOException;
-import com.ecyrd.jspwiki.WikiPage;
-
/**
* Writes the version of the current page. If this is
* marked as the current version, then includes body as text instead of
@@ -39,11 +37,9 @@
public final int doWikiStartTag()
throws IOException
{
- WikiPage page = m_wikiContext.getPage();
-
- if( page != null )
+ if( m_page != null )
{
- int version = page.getVersion();
+ int version = m_page.getVersion();
if( version > 0 )
{