jspwiki-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From juanpa...@apache.org
Subject [jspwiki] 18/36: more substitutions of WikiContext constants with ContextEnum ones
Date Sun, 29 Mar 2020 09:39:18 GMT
This is an automated email from the ASF dual-hosted git repository.

juanpablo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jspwiki.git

commit b051cde2744dccf6636a1c1db28ed102f995ee6e
Author: juanpablo <juanpablo@apache.org>
AuthorDate: Sat Mar 28 00:32:42 2020 +0100

    more substitutions of WikiContext constants with ContextEnum ones
---
 .../main/java/org/apache/wiki/rss/AtomFeed.java    |  6 +--
 .../org/apache/wiki/rss/DefaultRSSGenerator.java   | 20 +++----
 .../main/java/org/apache/wiki/rss/RSS10Feed.java   |  6 +--
 .../main/java/org/apache/wiki/rss/RSS20Feed.java   |  4 +-
 .../apache/wiki/search/DefaultSearchManager.java   |  4 +-
 .../java/org/apache/wiki/tags/CommentLinkTag.java  |  4 +-
 .../main/java/org/apache/wiki/tags/ContentTag.java | 22 ++++----
 .../java/org/apache/wiki/tags/DiffLinkTag.java     |  4 +-
 .../org/apache/wiki/tags/FeedDiscoveryTag.java     | 15 +++---
 .../main/java/org/apache/wiki/tags/LinkTag.java    | 20 +++----
 .../main/java/org/apache/wiki/tags/LinkToTag.java  |  6 +--
 .../java/org/apache/wiki/tags/PageInfoLinkTag.java |  4 +-
 .../java/org/apache/wiki/tags/RSSImageLinkTag.java |  4 +-
 .../java/org/apache/wiki/tags/TranslateTag.java    |  7 +--
 .../java/org/apache/wiki/tags/UploadLinkTag.java   | 61 +++++++++-------------
 .../java/org/apache/wiki/tags/WikiTagBase.java     |  5 +-
 .../org/apache/wiki/ui/DefaultEditorManager.java   |  4 +-
 .../org/apache/wiki/xmlrpc/MetaWeblogHandler.java  |  6 +--
 .../org/apache/wiki/xmlrpc/RPCHandlerUTF8.java     |  6 +--
 .../java/org/apache/wiki/xmlrpc/RPCServlet.java    |  4 +-
 .../src/test/java/org/apache/wiki/TestEngine.java  |  3 +-
 .../org/apache/wiki/search/SearchManagerTest.java  | 10 ++--
 .../org/apache/wiki/ui/CommandResolverTest.java    | 20 ++++---
 .../apache/wiki/url/ShortURLConstructorTest.java   | 11 ++--
 .../wiki/url/ShortViewURLConstructorTest.java      | 11 ++--
 25 files changed, 128 insertions(+), 139 deletions(-)

diff --git a/jspwiki-main/src/main/java/org/apache/wiki/rss/AtomFeed.java b/jspwiki-main/src/main/java/org/apache/wiki/rss/AtomFeed.java
index 7639d11..7128c73 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/rss/AtomFeed.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/rss/AtomFeed.java
@@ -19,10 +19,10 @@
 package org.apache.wiki.rss;
 
 import org.apache.commons.lang3.time.DateFormatUtils;
-import org.apache.wiki.WikiContext;
 import org.apache.wiki.api.Release;
 import org.apache.wiki.api.core.Attachment;
 import org.apache.wiki.api.core.Context;
+import org.apache.wiki.api.core.ContextEnum;
 import org.apache.wiki.api.core.Engine;
 import org.apache.wiki.api.core.Page;
 import org.apache.wiki.api.exceptions.ProviderException;
@@ -105,7 +105,7 @@ public class AtomFeed extends Feed {
                     for( final Attachment att : c ) {
                         final Element attEl = getElement( "link" );
                         attEl.setAttribute( "rel", "enclosure" );
-                        attEl.setAttribute( "href", engine.getURL( WikiContext.ATTACH, att.getName(), null ) );
+                        attEl.setAttribute( "href", engine.getURL( ContextEnum.PAGE_ATTACH.getRequestContext(), att.getName(), null ) );
                         attEl.setAttribute( "length", Long.toString( att.getSize() ) );
                         attEl.setAttribute( "type", getMimeType( servletContext, att.getFileName() ) );
 
@@ -148,7 +148,7 @@ public class AtomFeed extends Feed {
         root.addContent( getElement( "link" ).setAttribute( "href", engine.getBaseURL() ) );
         root.addContent( getElement( "generator" ).setText( "JSPWiki " + Release.VERSTR ) );
 
-        final String rssFeedURL  = engine.getURL(WikiContext.NONE, "rss.jsp",
+        final String rssFeedURL  = engine.getURL( ContextEnum.PAGE_NONE.getRequestContext(), "rss.jsp",
                                                  "page=" + engine.encodeName( m_wikiContext.getPage().getName() ) +
                                                  "&mode=" + m_mode +
                                                  "&type=atom" );
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/rss/DefaultRSSGenerator.java b/jspwiki-main/src/main/java/org/apache/wiki/rss/DefaultRSSGenerator.java
index 8498e1c..8790fcc 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/rss/DefaultRSSGenerator.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/rss/DefaultRSSGenerator.java
@@ -19,9 +19,9 @@
 package org.apache.wiki.rss;
 
 import org.apache.log4j.Logger;
-import org.apache.wiki.WikiContext;
 import org.apache.wiki.api.core.Attachment;
 import org.apache.wiki.api.core.Context;
+import org.apache.wiki.api.core.ContextEnum;
 import org.apache.wiki.api.core.Engine;
 import org.apache.wiki.api.core.Page;
 import org.apache.wiki.api.core.Session;
@@ -114,10 +114,10 @@ public class DefaultRSSGenerator implements RSSGenerator {
 
         sb.append( "<br /><hr /><br />" )
           .append( "Parent page: <a href=\"" )
-          .append( m_engine.getURL( WikiContext.VIEW, att.getParentName(), null ) )
+          .append( m_engine.getURL( ContextEnum.PAGE_VIEW.getRequestContext(), att.getParentName(), null ) )
           .append( "\">" ).append( att.getParentName() ).append( "</a><br />" )
           .append( "Info page: <a href=\"" )
-          .append( m_engine.getURL( WikiContext.INFO, att.getName(), null ) )
+          .append( m_engine.getURL( ContextEnum.PAGE_INFO.getRequestContext(), att.getName(), null ) )
           .append( "\">" ).append( att.getName() ).append( "</a>" );
 
         return sb.toString();
@@ -162,7 +162,7 @@ public class DefaultRSSGenerator implements RSSGenerator {
     @Override
     public String generate() {
         final Context context = Wiki.context().create( m_engine, Wiki.contents().page( m_engine, "__DUMMY" ) );
-        context.setRequestContext( WikiContext.RSS );
+        context.setRequestContext( ContextEnum.PAGE_RSS.getRequestContext() );
         final Feed feed = new RSS10Feed( context );
         return "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + generateFullWikiRSS( context, feed );
     }
@@ -237,9 +237,9 @@ public class DefaultRSSGenerator implements RSSGenerator {
 
             final String url;
             if( page instanceof Attachment ) {
-                url = m_engine.getURL( WikiContext.ATTACH, page.getName(),null );
+                url = m_engine.getURL( ContextEnum.PAGE_ATTACH.getRequestContext(), page.getName(),null );
             } else {
-                url = m_engine.getURL( WikiContext.VIEW, page.getName(), null );
+                url = m_engine.getURL( ContextEnum.PAGE_VIEW.getRequestContext(), page.getName(), null );
             }
 
             final Entry e = new Entry();
@@ -283,9 +283,9 @@ public class DefaultRSSGenerator implements RSSGenerator {
             String url;
 
             if( page instanceof Attachment ) {
-                url = m_engine.getURL( WikiContext.ATTACH, page.getName(), "version=" + page.getVersion() );
+                url = m_engine.getURL( ContextEnum.PAGE_ATTACH.getRequestContext(), page.getName(), "version=" + page.getVersion() );
             } else {
-                url = m_engine.getURL( WikiContext.VIEW, page.getName(), "version=" + page.getVersion() );
+                url = m_engine.getURL( ContextEnum.PAGE_VIEW.getRequestContext(), page.getName(), "version=" + page.getVersion() );
             }
 
             // Unfortunately, this is needed because the code will again go through replacement conversion
@@ -340,9 +340,9 @@ public class DefaultRSSGenerator implements RSSGenerator {
             final String url;
 
             if( page instanceof Attachment ) {
-                url = m_engine.getURL( WikiContext.ATTACH, page.getName(),null );
+                url = m_engine.getURL( ContextEnum.PAGE_ATTACH.getRequestContext(), page.getName(),null );
             } else {
-                url = m_engine.getURL( WikiContext.VIEW, page.getName(),null );
+                url = m_engine.getURL( ContextEnum.PAGE_VIEW.getRequestContext(), page.getName(),null );
             }
 
             e.setURL( url );
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/rss/RSS10Feed.java b/jspwiki-main/src/main/java/org/apache/wiki/rss/RSS10Feed.java
index 227aaa0..63df6f1 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/rss/RSS10Feed.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/rss/RSS10Feed.java
@@ -18,8 +18,8 @@
  */
 package org.apache.wiki.rss;
 
-import org.apache.wiki.WikiContext;
 import org.apache.wiki.api.core.Context;
+import org.apache.wiki.api.core.ContextEnum;
 import org.apache.wiki.api.core.Engine;
 import org.apache.wiki.api.core.Page;
 import org.apache.wiki.util.XhtmlUtil;
@@ -88,7 +88,7 @@ public class RSS10Feed extends Feed {
 
             if( p.getVersion() > 1 ) {
                 item.addContent( new Element( "diff", NS_WIKI )
-                                         .addContent( engine.getURL( WikiContext.DIFF, p.getName(), "r1=-1" ) ) );
+                                         .addContent( engine.getURL( ContextEnum.PAGE_DIFF.getRequestContext(), p.getName(), "r1=-1" ) ) );
             }
 
             //
@@ -128,7 +128,7 @@ public class RSS10Feed extends Feed {
             //
             //  PageHistory
             item.addContent( new Element( "history", NS_WIKI )
-                                    .addContent( engine.getURL( WikiContext.INFO, p.getName(), null ) ) );
+                                    .addContent( engine.getURL( ContextEnum.PAGE_INFO.getRequestContext(), p.getName(), null ) ) );
 
             //
             // Add to root
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/rss/RSS20Feed.java b/jspwiki-main/src/main/java/org/apache/wiki/rss/RSS20Feed.java
index e2fa6f8..3408251 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/rss/RSS20Feed.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/rss/RSS20Feed.java
@@ -18,10 +18,10 @@
  */
 package org.apache.wiki.rss;
 
-import org.apache.wiki.WikiContext;
 import org.apache.wiki.api.Release;
 import org.apache.wiki.api.core.Attachment;
 import org.apache.wiki.api.core.Context;
+import org.apache.wiki.api.core.ContextEnum;
 import org.apache.wiki.api.core.Engine;
 import org.apache.wiki.api.core.Page;
 import org.apache.wiki.api.exceptions.ProviderException;
@@ -84,7 +84,7 @@ public class RSS20Feed extends Feed
                     final List< Attachment > c = engine.getManager( AttachmentManager.class ).listAttachments( p );
                     for( final Attachment att : c ) {
                         final Element attEl = new Element( "enclosure" );
-                        attEl.setAttribute( "url", engine.getURL( WikiContext.ATTACH, att.getName(), null ) );
+                        attEl.setAttribute( "url", engine.getURL( ContextEnum.PAGE_ATTACH.getRequestContext(), att.getName(), null ) );
                         attEl.setAttribute( "length", Long.toString( att.getSize() ) );
                         attEl.setAttribute( "type", getMimeType( servletContext, att.getFileName() ) );
 
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/search/DefaultSearchManager.java b/jspwiki-main/src/main/java/org/apache/wiki/search/DefaultSearchManager.java
index a4a6b9f..fd00d44 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/search/DefaultSearchManager.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/search/DefaultSearchManager.java
@@ -21,11 +21,11 @@ package org.apache.wiki.search;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.time.StopWatch;
 import org.apache.log4j.Logger;
-import org.apache.wiki.WikiContext;
 import org.apache.wiki.ajax.AjaxUtil;
 import org.apache.wiki.ajax.WikiAjaxDispatcherServlet;
 import org.apache.wiki.ajax.WikiAjaxServlet;
 import org.apache.wiki.api.core.Context;
+import org.apache.wiki.api.core.ContextEnum;
 import org.apache.wiki.api.core.Engine;
 import org.apache.wiki.api.core.Page;
 import org.apache.wiki.api.exceptions.FilterException;
@@ -124,7 +124,7 @@ public class DefaultSearchManager extends BasePageFilter implements SearchManage
                     result = AjaxUtil.toJson( callResults );
                 } else if( actionName.equals( AJAX_ACTION_PAGES ) ) {
                     log.debug("Calling findPages() START");
-                    final Context wikiContext = Wiki.context().create( m_engine, req, WikiContext.VIEW );
+                    final Context wikiContext = Wiki.context().create( m_engine, req, ContextEnum.PAGE_VIEW.getRequestContext() );
                     final List< Map< String, Object > > callResults = findPages( itemId, maxResults, wikiContext );
                     log.debug( "Calling findPages() DONE. " + callResults.size() );
                     result = AjaxUtil.toJson( callResults );
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/tags/CommentLinkTag.java b/jspwiki-main/src/main/java/org/apache/wiki/tags/CommentLinkTag.java
index d8205ae..826a180 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/tags/CommentLinkTag.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/tags/CommentLinkTag.java
@@ -19,7 +19,7 @@
 package org.apache.wiki.tags;
 
 import org.apache.wiki.InternalWikiException;
-import org.apache.wiki.WikiContext;
+import org.apache.wiki.api.core.ContextEnum;
 import org.apache.wiki.api.core.Page;
 
 import javax.servlet.jsp.JspWriter;
@@ -73,7 +73,7 @@ public class CommentLinkTag
     }
 
     private String getCommentURL( final String pageName ) {
-        return m_wikiContext.getURL( WikiContext.COMMENT, pageName );
+        return m_wikiContext.getURL( ContextEnum.PAGE_COMMENT.getRequestContext(), pageName );
     }
 
 }
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/tags/ContentTag.java b/jspwiki-main/src/main/java/org/apache/wiki/tags/ContentTag.java
index 033d6d8..0ab0def 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/tags/ContentTag.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/tags/ContentTag.java
@@ -19,7 +19,7 @@
 package org.apache.wiki.tags;
 
 import org.apache.log4j.Logger;
-import org.apache.wiki.WikiContext;
+import org.apache.wiki.api.core.ContextEnum;
 import org.apache.wiki.api.exceptions.ProviderException;
 import org.apache.wiki.ui.TemplateManager;
 
@@ -50,7 +50,7 @@ public class ContentTag extends WikiTagBase {
      */
     public void setView( final String s )
     {
-        m_mappings.put( WikiContext.VIEW, s );
+        m_mappings.put( ContextEnum.PAGE_VIEW.getRequestContext(), s );
     }
 
     /**
@@ -60,7 +60,7 @@ public class ContentTag extends WikiTagBase {
      */
     public void setDiff( final String s )
     {
-        m_mappings.put( WikiContext.DIFF, s );
+        m_mappings.put( ContextEnum.PAGE_DIFF.getRequestContext(), s );
     }
 
     /**
@@ -70,7 +70,7 @@ public class ContentTag extends WikiTagBase {
      */
     public void setInfo( final String s )
     {
-        m_mappings.put( WikiContext.INFO, s );
+        m_mappings.put( ContextEnum.PAGE_INFO.getRequestContext(), s );
     }
 
     /**
@@ -80,7 +80,7 @@ public class ContentTag extends WikiTagBase {
      */
     public void setPreview( final String s )
     {
-        m_mappings.put( WikiContext.PREVIEW, s );
+        m_mappings.put( ContextEnum.PAGE_PREVIEW.getRequestContext(), s );
     }
 
     /**
@@ -90,7 +90,7 @@ public class ContentTag extends WikiTagBase {
      */
     public void setConflict( final String s )
     {
-        m_mappings.put( WikiContext.CONFLICT, s );
+        m_mappings.put( ContextEnum.PAGE_CONFLICT.getRequestContext(), s );
     }
 
     /**
@@ -100,7 +100,7 @@ public class ContentTag extends WikiTagBase {
      */
     public void setFind( final String s )
     {
-        m_mappings.put( WikiContext.FIND, s );
+        m_mappings.put( ContextEnum.WIKI_FIND.getRequestContext(), s );
     }
 
     /**
@@ -110,7 +110,7 @@ public class ContentTag extends WikiTagBase {
      */
     public void setPrefs( final String s )
     {
-        m_mappings.put( WikiContext.PREFS, s );
+        m_mappings.put( ContextEnum.WIKI_PREFS.getRequestContext(), s );
     }
 
     /**
@@ -120,7 +120,7 @@ public class ContentTag extends WikiTagBase {
      */
     public void setError( final String s )
     {
-        m_mappings.put( WikiContext.ERROR, s );
+        m_mappings.put( ContextEnum.WIKI_ERROR.getRequestContext(), s );
     }
 
     /**
@@ -130,7 +130,7 @@ public class ContentTag extends WikiTagBase {
      */
     public void setEdit( final String s )
     {
-        m_mappings.put( WikiContext.EDIT, s );
+        m_mappings.put( ContextEnum.PAGE_EDIT.getRequestContext(), s );
     }
 
     /**
@@ -140,7 +140,7 @@ public class ContentTag extends WikiTagBase {
      */
     public void setComment( final String s )
     {
-        m_mappings.put( WikiContext.COMMENT, s );
+        m_mappings.put( ContextEnum.PAGE_COMMENT.getRequestContext(), s );
     }
 
     /**
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/tags/DiffLinkTag.java b/jspwiki-main/src/main/java/org/apache/wiki/tags/DiffLinkTag.java
index c90d478..01fce48 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/tags/DiffLinkTag.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/tags/DiffLinkTag.java
@@ -18,7 +18,7 @@
  */
 package org.apache.wiki.tags;
 
-import org.apache.wiki.WikiContext;
+import org.apache.wiki.api.core.ContextEnum;
 import org.apache.wiki.api.core.Engine;
 import org.apache.wiki.api.core.Page;
 import org.apache.wiki.api.providers.WikiProvider;
@@ -131,7 +131,7 @@ public class DiffLinkTag extends WikiLinkTag {
             r2 = Integer.parseInt( getNewVersion() );
         }
 
-        final String url = m_wikiContext.getURL( WikiContext.DIFF, pageName, "r1="+r1+"&amp;r2="+r2 );
+        final String url = m_wikiContext.getURL( ContextEnum.PAGE_DIFF.getRequestContext(), pageName, "r1="+r1+"&amp;r2="+r2 );
         switch( m_format ) {
           case ANCHOR:
             out.print("<a href=\""+url+"\">");
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/tags/FeedDiscoveryTag.java b/jspwiki-main/src/main/java/org/apache/wiki/tags/FeedDiscoveryTag.java
index 3dd20a5..4c95004 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/tags/FeedDiscoveryTag.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/tags/FeedDiscoveryTag.java
@@ -18,9 +18,9 @@
  */
 package org.apache.wiki.tags;
 
-import org.apache.wiki.WikiContext;
-import org.apache.wiki.WikiPage;
+import org.apache.wiki.api.core.ContextEnum;
 import org.apache.wiki.api.core.Engine;
+import org.apache.wiki.api.core.Page;
 import org.apache.wiki.plugin.WeblogPlugin;
 import org.apache.wiki.rss.Feed;
 import org.apache.wiki.util.TextUtil;
@@ -36,13 +36,14 @@ public class FeedDiscoveryTag extends WikiTagBase {
 
     private static final long serialVersionUID = 0L;
     
-    @Override public final int doWikiStartTag() throws IOException {
+    @Override
+    public final int doWikiStartTag() throws IOException {
         final Engine engine = m_wikiContext.getEngine();
-        final WikiPage page = m_wikiContext.getPage();
+        final Page page = m_wikiContext.getPage();
 
         final String encodedName = engine.encodeName( page.getName() );
         final String rssURL      = engine.getGlobalRSSURL();
-        final String rssFeedURL  = engine.getURL( WikiContext.NONE, "rss.jsp","page="+encodedName+"&amp;mode=wiki" );
+        final String rssFeedURL  = engine.getURL( ContextEnum.PAGE_NONE.getRequestContext(), "rss.jsp","page="+encodedName+"&amp;mode=wiki" );
         
         if( rssURL != null ) {
             String siteName = Feed.getSiteName(m_wikiContext);
@@ -58,8 +59,8 @@ public class FeedDiscoveryTag extends WikiTagBase {
             */
             // FIXME: This does not work always, as plugins are not initialized until the first fetch
             if( "true".equals( page.getAttribute( WeblogPlugin.ATTR_ISWEBLOG ) ) ) {
-                final String blogFeedURL = engine.getURL( WikiContext.NONE,"rss.jsp","page="+encodedName );
-                final String atomFeedURL = engine.getURL( WikiContext.NONE,"rss.jsp","page="+encodedName+"&amp;type=atom" );
+                final String blogFeedURL = engine.getURL( ContextEnum.PAGE_NONE.getRequestContext(),"rss.jsp","page="+encodedName );
+                final String atomFeedURL = engine.getURL( ContextEnum.PAGE_NONE.getRequestContext(),"rss.jsp","page="+encodedName+"&amp;type=atom" );
         
                 pageContext.getOut().print("<link rel=\"alternate\" type=\"application/rss+xml\" title=\"RSS feed for weblog "+
                                            siteName+".\" href=\""+blogFeedURL+"\" />\n");
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/tags/LinkTag.java b/jspwiki-main/src/main/java/org/apache/wiki/tags/LinkTag.java
index 16740d8..86e8615 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/tags/LinkTag.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/tags/LinkTag.java
@@ -19,8 +19,8 @@
 package org.apache.wiki.tags;
 
 import org.apache.log4j.Logger;
-import org.apache.wiki.WikiContext;
 import org.apache.wiki.api.core.Attachment;
+import org.apache.wiki.api.core.ContextEnum;
 import org.apache.wiki.api.core.Engine;
 import org.apache.wiki.api.core.Page;
 import org.apache.wiki.api.exceptions.ProviderException;
@@ -60,7 +60,7 @@ public class LinkTag extends WikiLinkTag implements ParamHandler, BodyTag {
     private String m_rel       = null;
     private String m_jsp     = null;
     private String m_ref     = null;
-    private String m_context = WikiContext.VIEW;
+    private String m_context = ContextEnum.PAGE_VIEW.getRequestContext();
     private String m_accesskey = null;
     private String m_tabindex = null;
     private String m_templatefile = null;
@@ -73,7 +73,7 @@ public class LinkTag extends WikiLinkTag implements ParamHandler, BodyTag {
     public void initTag() {
         super.initTag();
         m_version = m_cssClass = m_style = m_title = m_target = m_compareToVersion = m_rel = m_jsp = m_ref = m_accesskey = m_templatefile = null;
-        m_context = WikiContext.VIEW;
+        m_context = ContextEnum.PAGE_VIEW.getRequestContext();
         m_containedParams = new HashMap<>();
     }
 
@@ -181,11 +181,11 @@ public class LinkTag extends WikiLinkTag implements ParamHandler, BodyTag {
         if( m_templatefile != null ) {
             final String params = addParamsForRecipient( null, m_containedParams );
             final String template = engine.getTemplateDir();
-            url = engine.getURL( WikiContext.NONE, "templates/"+template+"/"+m_templatefile, params );
+            url = engine.getURL( ContextEnum.PAGE_NONE.getRequestContext(), "templates/"+template+"/"+m_templatefile, params );
         } else if( m_jsp != null ) {
             final String params = addParamsForRecipient( null, m_containedParams );
-            //url = m_wikiContext.getURL( WikiContext.NONE, m_jsp, params );
-            url = engine.getURL( WikiContext.NONE, m_jsp, params );
+            //url = m_wikiContext.getURL( ContextEnum.PAGE_NONE.getRequestContext(), m_jsp, params );
+            url = engine.getURL( ContextEnum.PAGE_NONE.getRequestContext(), m_jsp, params );
         } else if( m_ref != null ) {
             final int interwikipoint;
             if( new LinkParsingOperations( m_wikiContext ).isExternalLink(m_ref) ) {
@@ -210,7 +210,7 @@ public class LinkTag extends WikiLinkTag implements ParamHandler, BodyTag {
                 //  Internal wiki link, but is it an attachment link?
                 final Page p = engine.getManager( PageManager.class ).getPage( m_pageName );
                 if( p instanceof Attachment ) {
-                    url = m_wikiContext.getURL( WikiContext.ATTACH, m_pageName );
+                    url = m_wikiContext.getURL( ContextEnum.PAGE_ATTACH.getRequestContext(), m_pageName );
                 } else if( (hashMark = m_ref.indexOf('#')) != -1 ) {
                     // It's an internal Wiki link, but to a named section
 
@@ -244,8 +244,8 @@ public class LinkTag extends WikiLinkTag implements ParamHandler, BodyTag {
                 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;
+                if( m_context == null || m_context.equals( ContextEnum.PAGE_VIEW.getRequestContext() ) ) {
+                    ctx = ContextEnum.PAGE_ATTACH.getRequestContext();
                 }
                 url = engine.getURL( ctx, m_pageName, parms );
                 //url = m_wikiContext.getURL( ctx, m_pageName, parms );
@@ -289,7 +289,7 @@ public class LinkTag extends WikiLinkTag implements ParamHandler, BodyTag {
     private String makeBasicURL( final String context, final String page, String parms ) {
         final Engine engine = m_wikiContext.getEngine();
 
-        if( context.equals( WikiContext.DIFF ) ) {
+        if( context.equals( ContextEnum.PAGE_DIFF.getRequestContext() ) ) {
             int r1;
             int r2;
 
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/tags/LinkToTag.java b/jspwiki-main/src/main/java/org/apache/wiki/tags/LinkToTag.java
index 6aba5a0..caf95ab 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/tags/LinkToTag.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/tags/LinkToTag.java
@@ -18,8 +18,8 @@
  */
 package org.apache.wiki.tags;
 
-import org.apache.wiki.WikiContext;
 import org.apache.wiki.api.core.Attachment;
+import org.apache.wiki.api.core.ContextEnum;
 import org.apache.wiki.api.core.Page;
 import org.apache.wiki.attachment.AttachmentManager;
 
@@ -94,7 +94,7 @@ public class LinkToTag extends WikiLinkTag {
         String forceDownload = "";
 
         if( isattachment ) {
-            url = m_wikiContext.getURL( WikiContext.ATTACH, pageName, ( getVersion() != null ) ? "version=" + getVersion() : null );
+            url = m_wikiContext.getURL( ContextEnum.PAGE_ATTACH.getRequestContext(), pageName, ( getVersion() != null ) ? "version=" + getVersion() : null );
             linkclass = "attachment";
 
             if( m_wikiContext.getEngine().getManager( AttachmentManager.class ).forceDownload( pageName ) ) {
@@ -110,7 +110,7 @@ public class LinkToTag extends WikiLinkTag {
                 params.append( params.length() > 0 ? "&amp;" : "" ).append( "skin=" ).append( getTemplate() );
             }
 
-            url = m_wikiContext.getURL( WikiContext.VIEW, pageName, params.toString() );
+            url = m_wikiContext.getURL( ContextEnum.PAGE_VIEW.getRequestContext(), pageName, params.toString() );
             linkclass = "wikipage";
         }
 
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/tags/PageInfoLinkTag.java b/jspwiki-main/src/main/java/org/apache/wiki/tags/PageInfoLinkTag.java
index d698874..1e64efd 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/tags/PageInfoLinkTag.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/tags/PageInfoLinkTag.java
@@ -18,7 +18,7 @@
  */
 package org.apache.wiki.tags;
 
-import org.apache.wiki.WikiContext;
+import org.apache.wiki.api.core.ContextEnum;
 import org.apache.wiki.api.core.Engine;
 import org.apache.wiki.api.core.Page;
 import org.apache.wiki.pages.PageManager;
@@ -70,7 +70,7 @@ public class PageInfoLinkTag extends WikiLinkTag {
 
         if( engine.getManager( PageManager.class ).wikiPageExists(pageName) ) {
             final JspWriter out = pageContext.getOut();
-            final String url = m_wikiContext.getURL( WikiContext.INFO, pageName );
+            final String url = m_wikiContext.getURL( ContextEnum.PAGE_INFO.getRequestContext(), pageName );
 
             switch( m_format ) {
               case ANCHOR: out.print("<a class=\"pageinfo\" href=\""+url+"\" accesskey=\"" + m_accesskey + "\" title=\"" + m_title + "\">"); break;
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/tags/RSSImageLinkTag.java b/jspwiki-main/src/main/java/org/apache/wiki/tags/RSSImageLinkTag.java
index 151a03c..2db5f93 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/tags/RSSImageLinkTag.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/tags/RSSImageLinkTag.java
@@ -18,7 +18,7 @@
  */
 package org.apache.wiki.tags;
 
-import org.apache.wiki.WikiContext;
+import org.apache.wiki.api.core.ContextEnum;
 import org.apache.wiki.api.core.Engine;
 import org.apache.wiki.i18n.InternationalizationManager;
 import org.apache.wiki.preferences.Preferences;
@@ -101,7 +101,7 @@ public class RSSImageLinkTag
             } else {
                 final String page = m_pageName != null ? m_pageName : m_wikiContext.getPage().getName();
                 final String params = "page="+page+"&mode="+m_mode;
-                out.print( "<a href='"+m_wikiContext.getURL( WikiContext.NONE, "rss.jsp", params ));
+                out.print( "<a href='"+m_wikiContext.getURL( ContextEnum.PAGE_NONE.getRequestContext(), "rss.jsp", params ));
                 out.print( "' class='feed'" );
                 out.print( " title='"+MessageFormat.format( rb.getString( "rss.title" ), page )+"'>" );
                 out.print( "&nbsp;</a> ");
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/tags/TranslateTag.java b/jspwiki-main/src/main/java/org/apache/wiki/tags/TranslateTag.java
index 48dec5e..f1a96c9 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/tags/TranslateTag.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/tags/TranslateTag.java
@@ -19,7 +19,7 @@
 package org.apache.wiki.tags;
 
 import org.apache.log4j.Logger;
-import org.apache.wiki.WikiContext;
+import org.apache.wiki.api.core.Context;
 import org.apache.wiki.render.RenderingManager;
 
 import javax.servlet.jsp.JspException;
@@ -39,9 +39,10 @@ public class TranslateTag
     
     private static final Logger log = Logger.getLogger( TranslateTag.class );
 
-    @Override public final int doAfterBody() throws JspException {
+    @Override
+    public final int doAfterBody() throws JspException {
         try {
-            WikiContext context = (WikiContext) pageContext.getAttribute( WikiContext.ATTR_CONTEXT, PageContext.REQUEST_SCOPE );
+            Context context = (Context) pageContext.getAttribute( Context.ATTR_CONTEXT, PageContext.REQUEST_SCOPE );
 
             //  Because the TranslateTag should not affect any of the real page attributes we have to make a clone here.
             context = context.deepClone();
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/tags/UploadLinkTag.java b/jspwiki-main/src/main/java/org/apache/wiki/tags/UploadLinkTag.java
index 46c3506..cd5b01a 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/tags/UploadLinkTag.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/tags/UploadLinkTag.java
@@ -18,56 +18,45 @@
  */
 package org.apache.wiki.tags;
 
-import java.io.IOException;
+import org.apache.wiki.api.core.ContextEnum;
+
 import javax.servlet.jsp.JspWriter;
+import java.io.IOException;
 
-import org.apache.wiki.WikiContext;
 
 /**
- *  Writes a link to the upload page.  Body of the link becomes the actual text.
- *  The link is written regardless to whether the page exists or not.
- *
- *  <P><B>Attributes</B></P>
- *  <UL>
- *    <LI>page - Page name to refer to.  Default is the current page.
- *    <LI>format - either "anchor" or "url" to output either an <A>... or just the HREF part of one.
- *  </UL>
+ * Writes a link to the upload page.  Body of the link becomes the actual text.
+ * The link is written regardless to whether the page exists or not.
+ * <P><B>Attributes</B></P>
+ * <UL>
+ * <LI>page - Page name to refer to.  Default is the current page.
+ * <LI>format - either "anchor" or "url" to output either an <A>... or just the HREF part of one.
+ * </UL>
  *
- *  @since 2.0
+ * @since 2.0
  */
-public class UploadLinkTag
-    extends WikiLinkTag
-{
+public class UploadLinkTag extends WikiLinkTag {
+
     private static final long serialVersionUID = 0L;
-    
-    public final int doWikiStartTag()
-        throws IOException
-    {
-        String     pageName = m_pageName;
 
-        if( m_pageName == null )
-        {
-            if( m_wikiContext.getPage() != null )
-            {
+    @Override
+    public final int doWikiStartTag() throws IOException {
+        String pageName = m_pageName;
+        if( m_pageName == null ) {
+            if( m_wikiContext.getPage() != null ) {
                 pageName = m_wikiContext.getPage().getName();
-            }
-            else
-            {
+            } else {
                 return SKIP_BODY;
             }
         }
 
-        JspWriter out = pageContext.getOut();
-
-        String url = m_wikiContext.getURL( WikiContext.UPLOAD,
-                                           pageName );
-
-        switch( m_format )
-        {
-          case ANCHOR:
-            out.print("<a target=\"_new\" class=\"uploadlink\" href=\""+url+"\">");
+        final JspWriter out = pageContext.getOut();
+        final String url = m_wikiContext.getURL( ContextEnum.PAGE_UPLOAD.getRequestContext(), pageName );
+        switch( m_format ) {
+        case ANCHOR:
+            out.print( "<a target=\"_new\" class=\"uploadlink\" href=\"" + url + "\">" );
             break;
-          case URL:
+        case URL:
             out.print( url );
             break;
         }
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/tags/WikiTagBase.java b/jspwiki-main/src/main/java/org/apache/wiki/tags/WikiTagBase.java
index f9f1d55..0220f2b 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/tags/WikiTagBase.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/tags/WikiTagBase.java
@@ -19,7 +19,6 @@
 package org.apache.wiki.tags;
 
 import org.apache.log4j.Logger;
-import org.apache.wiki.WikiContext;
 import org.apache.wiki.api.core.Context;
 import org.apache.wiki.util.TextUtil;
 
@@ -41,7 +40,7 @@ public abstract class WikiTagBase extends TagSupport implements TryCatchFinally
     private static final long serialVersionUID = -1409836349293777141L;
     private static final Logger log = Logger.getLogger( WikiTagBase.class );
 
-    protected WikiContext m_wikiContext;
+    protected Context m_wikiContext;
 
     /**
      * This method calls the parent setPageContext() but it also provides a way for a tag to initialize itself before
@@ -63,7 +62,7 @@ public abstract class WikiTagBase extends TagSupport implements TryCatchFinally
     
     public int doStartTag() throws JspException {
         try {
-            m_wikiContext = ( WikiContext )pageContext.getAttribute( Context.ATTR_CONTEXT, PageContext.REQUEST_SCOPE );
+            m_wikiContext = ( Context )pageContext.getAttribute( Context.ATTR_CONTEXT, PageContext.REQUEST_SCOPE );
             if( m_wikiContext == null ) {
                 throw new JspException("WikiContext may not be NULL - serious internal problem!");
             }
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/ui/DefaultEditorManager.java b/jspwiki-main/src/main/java/org/apache/wiki/ui/DefaultEditorManager.java
index 9d74621..5299a4a 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/ui/DefaultEditorManager.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/ui/DefaultEditorManager.java
@@ -19,8 +19,8 @@
 package org.apache.wiki.ui;
 
 import org.apache.log4j.Logger;
-import org.apache.wiki.WikiContext;
 import org.apache.wiki.api.core.Context;
+import org.apache.wiki.api.core.ContextEnum;
 import org.apache.wiki.api.core.Engine;
 import org.apache.wiki.api.exceptions.NoSuchVariableException;
 import org.apache.wiki.modules.BaseModuleManager;
@@ -99,7 +99,7 @@ public class DefaultEditorManager extends BaseModuleManager implements EditorMan
     /** {@inheritDoc} */
     @Override
     public String getEditorName( final Context context ) {
-        if( context.getRequestContext().equals( WikiContext.PREVIEW ) ) {
+        if( context.getRequestContext().equals( ContextEnum.PAGE_PREVIEW.getRequestContext() ) ) {
             return EDITOR_PREVIEW;
         }
 
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/xmlrpc/MetaWeblogHandler.java b/jspwiki-main/src/main/java/org/apache/wiki/xmlrpc/MetaWeblogHandler.java
index e9b5883..e987294 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/xmlrpc/MetaWeblogHandler.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/xmlrpc/MetaWeblogHandler.java
@@ -19,9 +19,9 @@
 package org.apache.wiki.xmlrpc;
 
 import org.apache.log4j.Logger;
-import org.apache.wiki.WikiContext;
 import org.apache.wiki.api.core.Attachment;
 import org.apache.wiki.api.core.Context;
+import org.apache.wiki.api.core.ContextEnum;
 import org.apache.wiki.api.core.Engine;
 import org.apache.wiki.api.core.Page;
 import org.apache.wiki.api.spi.Wiki;
@@ -114,7 +114,7 @@ public class MetaWeblogHandler implements WikiRPCHandler {
     }
 
     private String getURL( final String page ) {
-        return m_context.getEngine().getURL( WikiContext.VIEW, page,null );
+        return m_context.getEngine().getURL( ContextEnum.PAGE_VIEW.getRequestContext(), page,null );
     }
 
     /**
@@ -263,7 +263,7 @@ public class MetaWeblogHandler implements WikiRPCHandler {
             att.setAuthor( username );
             attmgr.storeAttachment( att, new ByteArrayInputStream( data ) );
 
-            url = engine.getURL( WikiContext.ATTACH, att.getName(), null );
+            url = engine.getURL( ContextEnum.PAGE_ATTACH.getRequestContext(), att.getName(), null );
         } catch( final Exception e ) {
             log.error( "Failed to upload attachment", e );
             throw new XmlRpcException( 0, "Failed to upload media object: "+e.getMessage() );
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/xmlrpc/RPCHandlerUTF8.java b/jspwiki-main/src/main/java/org/apache/wiki/xmlrpc/RPCHandlerUTF8.java
index 31b59d5..67870d5 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/xmlrpc/RPCHandlerUTF8.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/xmlrpc/RPCHandlerUTF8.java
@@ -19,9 +19,9 @@
 package org.apache.wiki.xmlrpc;
 
 import org.apache.wiki.LinkCollector;
-import org.apache.wiki.WikiContext;
 import org.apache.wiki.api.core.Attachment;
 import org.apache.wiki.api.core.Context;
+import org.apache.wiki.api.core.ContextEnum;
 import org.apache.wiki.api.core.Page;
 import org.apache.wiki.api.spi.Wiki;
 import org.apache.wiki.auth.permissions.PagePermission;
@@ -195,7 +195,7 @@ public class RPCHandlerUTF8 extends AbstractRPCHandler {
             if( m_engine.getManager( PageManager.class ).wikiPageExists( link ) ) {
                 ht.put( "href", context.getViewURL( link ) );
             } else {
-                ht.put( "href", context.getURL( WikiContext.EDIT, link ) );
+                ht.put( "href", context.getURL( ContextEnum.PAGE_EDIT.getRequestContext(), link ) );
             }
 
             result.add( ht );
@@ -208,7 +208,7 @@ public class RPCHandlerUTF8 extends AbstractRPCHandler {
             final Hashtable<String, String> ht = new Hashtable<>();
             ht.put( "page", link );
             ht.put( "type", LINK_LOCAL );
-            ht.put( "href", context.getURL(WikiContext.ATTACH,link) );
+            ht.put( "href", context.getURL( ContextEnum.PAGE_ATTACH.getRequestContext(), link ) );
             result.add( ht );
         }
 
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/xmlrpc/RPCServlet.java b/jspwiki-main/src/main/java/org/apache/wiki/xmlrpc/RPCServlet.java
index ac9bbf7..bf3c731 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/xmlrpc/RPCServlet.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/xmlrpc/RPCServlet.java
@@ -19,8 +19,8 @@
 package org.apache.wiki.xmlrpc;
 
 import org.apache.log4j.Logger;
-import org.apache.wiki.WikiContext;
 import org.apache.wiki.api.core.Context;
+import org.apache.wiki.api.core.ContextEnum;
 import org.apache.wiki.api.core.Engine;
 import org.apache.wiki.api.spi.Wiki;
 import org.apache.xmlrpc.ContextXmlRpcHandler;
@@ -110,7 +110,7 @@ public class RPCServlet extends HttpServlet {
         log.debug("Received POST to RPCServlet");
 
         try {
-            final Context ctx = Wiki.context().create( m_engine, request, WikiContext.NONE );
+            final Context ctx = Wiki.context().create( m_engine, request, ContextEnum.PAGE_NONE.getRequestContext() );
             final XmlRpcContext xmlrpcContext = new WikiXmlRpcContext( m_xmlrpcServer.getHandlerMapping(), ctx );
             final byte[] result = m_xmlrpcServer.execute( request.getInputStream(), xmlrpcContext );
 
diff --git a/jspwiki-main/src/test/java/org/apache/wiki/TestEngine.java b/jspwiki-main/src/test/java/org/apache/wiki/TestEngine.java
index abf90c6..fe13c37 100644
--- a/jspwiki-main/src/test/java/org/apache/wiki/TestEngine.java
+++ b/jspwiki-main/src/test/java/org/apache/wiki/TestEngine.java
@@ -26,6 +26,7 @@ import org.apache.commons.lang3.StringUtils;
 import org.apache.log4j.Logger;
 import org.apache.wiki.api.core.Attachment;
 import org.apache.wiki.api.core.Context;
+import org.apache.wiki.api.core.ContextEnum;
 import org.apache.wiki.api.core.Page;
 import org.apache.wiki.api.core.Session;
 import org.apache.wiki.api.exceptions.ProviderException;
@@ -446,7 +447,7 @@ public class TestEngine extends WikiEngine {
     public String getI18nHTML( final String pagename ) {
         final Page page = getManager( PageManager.class ).getPage( pagename, PageProvider.LATEST_VERSION );
         final Context context = Wiki.context().create( this, newHttpRequest(), page );
-        context.setRequestContext( WikiContext.NONE );
+        context.setRequestContext( ContextEnum.PAGE_NONE.getRequestContext() );
         return getManager( RenderingManager.class ).getHTML( context, page );
     }
 
diff --git a/jspwiki-main/src/test/java/org/apache/wiki/search/SearchManagerTest.java b/jspwiki-main/src/test/java/org/apache/wiki/search/SearchManagerTest.java
index 527cd85..455024f 100644
--- a/jspwiki-main/src/test/java/org/apache/wiki/search/SearchManagerTest.java
+++ b/jspwiki-main/src/test/java/org/apache/wiki/search/SearchManagerTest.java
@@ -21,8 +21,10 @@ package org.apache.wiki.search;
 import net.sf.ehcache.CacheManager;
 import net.sourceforge.stripes.mock.MockHttpServletRequest;
 import org.apache.wiki.TestEngine;
-import org.apache.wiki.WikiContext;
+import org.apache.wiki.api.core.Context;
+import org.apache.wiki.api.core.ContextEnum;
 import org.apache.wiki.api.search.SearchResult;
+import org.apache.wiki.api.spi.Wiki;
 import org.apache.wiki.pages.PageManager;
 import org.awaitility.Awaitility;
 import org.junit.jupiter.api.AfterEach;
@@ -80,7 +82,7 @@ public class SearchManagerTest {
     Callable< Boolean > findsResultsFor( final Collection< SearchResult > res, final String text ) {
         return () -> {
             final MockHttpServletRequest request = m_engine.newHttpRequest();
-            final WikiContext ctx = new WikiContext( m_engine, request, WikiContext.EDIT );
+            final Context ctx = Wiki.context().create( m_engine, request, ContextEnum.PAGE_EDIT.getRequestContext() );
             final Collection< SearchResult > search = m_mgr.findPages( text, ctx );
             if( search != null && search.size() > 0 ) {
                 // debugSearchResults( search );
@@ -123,7 +125,7 @@ public class SearchManagerTest {
         final String txt = "It was the dawn of the third age of mankind, ten years after the Earth-Minbari War.";
         final MockHttpServletRequest request = m_engine.newHttpRequest();
         request.getParameterMap().put( "page", new String[]{ "TestPage" } );
-        final WikiContext ctx = new WikiContext( m_engine, request, WikiContext.EDIT );
+        final Context ctx = Wiki.context().create( m_engine, request, ContextEnum.PAGE_EDIT.getRequestContext() );
         m_engine.getManager( PageManager.class ).saveText( ctx, txt );
         m_engine.getManager( PageManager.class ).saveText( ctx, "The Babylon Project was a dream given form. Its goal: to prevent another war by creating a place where humans and aliens could work out their differences peacefully." );
 
@@ -145,7 +147,7 @@ public class SearchManagerTest {
         final String txt = "It was the dawn of the third age of mankind, ten years after the Earth-Minbari War.";
         final MockHttpServletRequest request = m_engine.newHttpRequest();
         request.getParameterMap().put( "page", new String[]{ "TestPage" } );
-        final WikiContext ctx = new WikiContext( m_engine, request, WikiContext.EDIT );
+        final Context ctx = Wiki.context().create( m_engine, request, ContextEnum.PAGE_EDIT.getRequestContext() );
         m_engine.getManager( PageManager.class ).saveText( ctx, txt );
 
         Collection< SearchResult > res = new ArrayList<>();
diff --git a/jspwiki-main/src/test/java/org/apache/wiki/ui/CommandResolverTest.java b/jspwiki-main/src/test/java/org/apache/wiki/ui/CommandResolverTest.java
index e43ae6e..0d4dd3e 100644
--- a/jspwiki-main/src/test/java/org/apache/wiki/ui/CommandResolverTest.java
+++ b/jspwiki-main/src/test/java/org/apache/wiki/ui/CommandResolverTest.java
@@ -24,11 +24,9 @@ package org.apache.wiki.ui;
 
 import net.sourceforge.stripes.mock.MockHttpServletRequest;
 import org.apache.wiki.TestEngine;
-import org.apache.wiki.WikiContext;
-import org.apache.wiki.WikiEngine;
-import org.apache.wiki.WikiPage;
 import org.apache.wiki.api.core.Command;
 import org.apache.wiki.api.core.ContextEnum;
+import org.apache.wiki.api.core.Engine;
 import org.apache.wiki.api.core.Page;
 import org.apache.wiki.auth.GroupPrincipal;
 import org.apache.wiki.pages.PageManager;
@@ -47,7 +45,7 @@ public class CommandResolverTest {
     @BeforeEach
     public void setUp() throws Exception {
         final Properties props = TestEngine.getTestProperties();
-        props.setProperty( WikiEngine.PROP_MATCHPLURALS, "yes" );
+        props.setProperty( Engine.PROP_MATCHPLURALS, "yes" );
         m_engine = new TestEngine( props );
         resolver = m_engine.getManager( CommandResolver.class );
         m_engine.saveText( "SinglePage", "This is a test." );
@@ -68,14 +66,14 @@ public class CommandResolverTest {
         Assertions.assertEquals( ContextEnum.PAGE_EDIT.getRequestContext(), a.getRequestContext() );
 
         // Ditto for prefs context
-        a = CommandResolver.findCommand( WikiContext.PREFS );
+        a = CommandResolver.findCommand( ContextEnum.WIKI_PREFS.getRequestContext() );
         Assertions.assertEquals( WikiCommand.PREFS, a );
-        Assertions.assertEquals( WikiContext.PREFS, a.getRequestContext() );
+        Assertions.assertEquals( ContextEnum.WIKI_PREFS.getRequestContext(), a.getRequestContext() );
 
         // Ditto for group view context
-        a = CommandResolver.findCommand( WikiContext.VIEW_GROUP );
+        a = CommandResolver.findCommand( ContextEnum.GROUP_VIEW.getRequestContext() );
         Assertions.assertEquals( GroupCommand.VIEW_GROUP, a );
-        Assertions.assertEquals( WikiContext.VIEW_GROUP, a.getRequestContext() );
+        Assertions.assertEquals( ContextEnum.GROUP_VIEW.getRequestContext(), a.getRequestContext() );
 
         // Looking for non-existent context; should result in exception
         Assertions.assertThrows( IllegalArgumentException.class, () -> CommandResolver.findCommand( "nonExistentContext" ) );
@@ -94,12 +92,12 @@ public class CommandResolverTest {
         Assertions.assertNull( a.getTarget() );
 
         // Ditto for prefs context
-        a = resolver.findCommand( request, WikiContext.PREFS );
+        a = resolver.findCommand( request, ContextEnum.WIKI_PREFS.getRequestContext() );
         Assertions.assertEquals( WikiCommand.PREFS, a );
         Assertions.assertNull( a.getTarget() );
 
         // Ditto for group view context
-        a = resolver.findCommand( request, WikiContext.VIEW_GROUP );
+        a = resolver.findCommand( request, ContextEnum.GROUP_VIEW.getRequestContext() );
         Assertions.assertEquals( GroupCommand.VIEW_GROUP, a );
         Assertions.assertNull( a.getTarget() );
 
@@ -167,7 +165,7 @@ public class CommandResolverTest {
         MockHttpServletRequest request = m_engine.newHttpRequest( "/Wiki.jsp" );
         Command a = resolver.findCommand( request, ContextEnum.PAGE_EDIT.getRequestContext() );
         Assertions.assertNotNull( a.getTarget() );
-        Assertions.assertEquals( ((WikiPage)a.getTarget()).getName(), m_engine.getFrontPage() );
+        Assertions.assertEquals( ((Page)a.getTarget()).getName(), m_engine.getFrontPage() );
 
         // Passing an EDIT request with Group JSP yields VIEW_GROUP
         request = m_engine.newHttpRequest( "/Group.jsp" );
diff --git a/jspwiki-main/src/test/java/org/apache/wiki/url/ShortURLConstructorTest.java b/jspwiki-main/src/test/java/org/apache/wiki/url/ShortURLConstructorTest.java
index 4b62f9f..a66103d 100644
--- a/jspwiki-main/src/test/java/org/apache/wiki/url/ShortURLConstructorTest.java
+++ b/jspwiki-main/src/test/java/org/apache/wiki/url/ShortURLConstructorTest.java
@@ -23,7 +23,6 @@
 package org.apache.wiki.url;
 
 import org.apache.wiki.TestEngine;
-import org.apache.wiki.WikiContext;
 import org.apache.wiki.api.core.ContextEnum;
 import org.apache.wiki.api.exceptions.WikiException;
 import org.junit.jupiter.api.Assertions;
@@ -120,7 +119,7 @@ public class ShortURLConstructorTest
     {
         final URLConstructor c = getConstructor(null );
 
-        Assertions.assertEquals( "/test/wiki/Main?do=Edit", c.makeURL(WikiContext.EDIT,"Main",null) );
+        Assertions.assertEquals( "/test/wiki/Main?do=Edit", c.makeURL(ContextEnum.PAGE_EDIT.getRequestContext(),"Main",null) );
     }
 
     @Test
@@ -129,7 +128,7 @@ public class ShortURLConstructorTest
     {
         final URLConstructor c = getConstructor(null );
 
-        Assertions.assertEquals( "/test/attach/Main/foo.txt", c.makeURL(WikiContext.ATTACH,"Main/foo.txt",null) );
+        Assertions.assertEquals( "/test/attach/Main/foo.txt", c.makeURL(ContextEnum.PAGE_ATTACH.getRequestContext(),"Main/foo.txt",null) );
     }
 
     @Test
@@ -138,7 +137,7 @@ public class ShortURLConstructorTest
     {
         final URLConstructor c = getConstructor(null );
 
-        Assertions.assertEquals( "/test/attach/Main/foo.txt", c.makeURL(WikiContext.ATTACH,"Main/foo.txt",null) );
+        Assertions.assertEquals( "/test/attach/Main/foo.txt", c.makeURL(ContextEnum.PAGE_ATTACH.getRequestContext(),"Main/foo.txt",null) );
     }
 
     @Test
@@ -147,7 +146,7 @@ public class ShortURLConstructorTest
     {
         final URLConstructor c = getConstructor(null );
 
-        Assertions.assertEquals( "/test/foo.jsp", c.makeURL(WikiContext.NONE,"foo.jsp",null) );
+        Assertions.assertEquals( "/test/foo.jsp", c.makeURL(ContextEnum.PAGE_NONE.getRequestContext(),"foo.jsp",null) );
     }
 
     @Test
@@ -156,7 +155,7 @@ public class ShortURLConstructorTest
     {
         final URLConstructor c = getConstructor(null );
 
-        Assertions.assertEquals( "/test/foo.jsp?a=1&amp;b=2", c.makeURL(WikiContext.NONE,"foo.jsp","a=1&amp;b=2") );
+        Assertions.assertEquals( "/test/foo.jsp?a=1&amp;b=2", c.makeURL(ContextEnum.PAGE_NONE.getRequestContext(),"foo.jsp","a=1&amp;b=2") );
     }
 
     @Test
diff --git a/jspwiki-main/src/test/java/org/apache/wiki/url/ShortViewURLConstructorTest.java b/jspwiki-main/src/test/java/org/apache/wiki/url/ShortViewURLConstructorTest.java
index a2fdad0..9e82f4e 100644
--- a/jspwiki-main/src/test/java/org/apache/wiki/url/ShortViewURLConstructorTest.java
+++ b/jspwiki-main/src/test/java/org/apache/wiki/url/ShortViewURLConstructorTest.java
@@ -23,7 +23,6 @@
 package org.apache.wiki.url;
 
 import org.apache.wiki.TestEngine;
-import org.apache.wiki.WikiContext;
 import org.apache.wiki.api.core.ContextEnum;
 import org.apache.wiki.api.exceptions.WikiException;
 import org.junit.jupiter.api.Assertions;
@@ -120,7 +119,7 @@ public class ShortViewURLConstructorTest
     {
         final URLConstructor c = getConstructor(null );
 
-        Assertions.assertEquals( "/test/Edit.jsp?page=Main", c.makeURL(WikiContext.EDIT,"Main",null) );
+        Assertions.assertEquals( "/test/Edit.jsp?page=Main", c.makeURL(ContextEnum.PAGE_EDIT.getRequestContext(),"Main",null) );
     }
 
     @Test
@@ -129,7 +128,7 @@ public class ShortViewURLConstructorTest
     {
         final URLConstructor c = getConstructor(null );
 
-        Assertions.assertEquals( "/test/attach/Main/foo.txt", c.makeURL(WikiContext.ATTACH,"Main/foo.txt",null) );
+        Assertions.assertEquals( "/test/attach/Main/foo.txt", c.makeURL(ContextEnum.PAGE_ATTACH.getRequestContext(),"Main/foo.txt",null) );
     }
 
     @Test
@@ -138,7 +137,7 @@ public class ShortViewURLConstructorTest
     {
         final URLConstructor c = getConstructor(null );
 
-        Assertions.assertEquals( "/test/attach/Main/foo.txt", c.makeURL(WikiContext.ATTACH,"Main/foo.txt",null) );
+        Assertions.assertEquals( "/test/attach/Main/foo.txt", c.makeURL(ContextEnum.PAGE_ATTACH.getRequestContext(),"Main/foo.txt",null) );
     }
 
     @Test
@@ -147,7 +146,7 @@ public class ShortViewURLConstructorTest
     {
         final URLConstructor c = getConstructor(null );
 
-        Assertions.assertEquals( "/test/foo.jsp", c.makeURL(WikiContext.NONE,"foo.jsp",null) );
+        Assertions.assertEquals( "/test/foo.jsp", c.makeURL(ContextEnum.PAGE_NONE.getRequestContext(),"foo.jsp",null) );
     }
 
     @Test
@@ -156,7 +155,7 @@ public class ShortViewURLConstructorTest
     {
         final URLConstructor c = getConstructor(null );
 
-        Assertions.assertEquals( "/test/foo.jsp?a=1&amp;b=2", c.makeURL(WikiContext.NONE,"foo.jsp","a=1&amp;b=2") );
+        Assertions.assertEquals( "/test/foo.jsp?a=1&amp;b=2", c.makeURL(ContextEnum.PAGE_NONE.getRequestContext(),"foo.jsp","a=1&amp;b=2") );
     }
 
     @Test


Mime
View raw message