jspwiki-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From juanpa...@apache.org
Subject svn commit: r1551278 - in /jspwiki/trunk/jspwiki-war/src/main: java/org/apache/wiki/ java/org/apache/wiki/api/engine/ java/org/apache/wiki/plugin/ java/org/apache/wiki/util/ webapp/
Date Mon, 16 Dec 2013 17:39:19 GMT
Author: juanpablo
Date: Mon Dec 16 17:39:18 2013
New Revision: 1551278

URL: http://svn.apache.org/r1551278
Log:
 * removed WikiEngine#getRequiredProperty( Properties props, String key ) in favour of TextUtil#getRequiredProperty(
Properties props, String key )
 * moved WikiEngine.getPluginSearchPath() to PluginManager.getPluginSearchPath()
 * HttpUtil.createETag and HttpUtil.checkFor304 now receive String name, Date lastModified
instead of WikiPage ( wikipage.getName(), wikipage.getLastModified() )

Modified:
    jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/VariableManager.java
    jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/WikiEngine.java
    jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/api/engine/PluginManager.java
    jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/plugin/DefaultPluginManager.java
    jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/util/HttpUtil.java
    jspwiki/trunk/jspwiki-war/src/main/webapp/rss.jsp

Modified: jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/VariableManager.java
URL: http://svn.apache.org/viewvc/jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/VariableManager.java?rev=1551278&r1=1551277&r2=1551278&view=diff
==============================================================================
--- jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/VariableManager.java (original)
+++ jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/VariableManager.java Mon Dec 16
17:39:18 2013
@@ -454,10 +454,9 @@ public class VariableManager
             return res.toString();
         }
 
-        @SuppressWarnings("deprecation")
         public String getPluginpath()
         {
-            String s = m_context.getEngine().getPluginSearchPath();
+            String s = m_context.getEngine().getPluginManager().getPluginSearchPath();
 
             return (s == null) ? "-" : s;
         }

Modified: jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/WikiEngine.java
URL: http://svn.apache.org/viewvc/jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/WikiEngine.java?rev=1551278&r1=1551277&r2=1551278&view=diff
==============================================================================
--- jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/WikiEngine.java (original)
+++ jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/WikiEngine.java Mon Dec 16 17:39:18
2013
@@ -743,26 +743,6 @@ public class WikiEngine
         }
     }
 
-
-    /**
-     * Throws an exception if a property is not found.
-     *
-     * @param props A set of properties to search the key in.
-     * @param key   The key to look for.
-     * @return The required property
-     *
-     * @throws NoRequiredPropertyException If the search key is not
-     *         in the property set.
-     * @deprecated will be removed in 2.10 scope. Consider using {@link TextUtil#getRequiredProperty(Properties,
String)} 
-     * instead
-     */
-    @Deprecated
-    public static String getRequiredProperty( Properties props, String key )
-        throws NoRequiredPropertyException
-    {
-        return TextUtil.getRequiredProperty( props, key );
-    }
-
     /**
      *  Returns the set of properties that the WikiEngine was initialized
      *  with.  Note that this method returns a direct reference, so it's possible
@@ -789,18 +769,6 @@ public class WikiEngine
     }
 
     /**
-     *  Don't use.
-     *  @since 1.8.0
-     *  @deprecated
-     *  @return Something magical.
-     */
-    public String getPluginSearchPath()
-    {
-        // FIXME: This method should not be here, probably.
-        return TextUtil.getStringProperty( m_properties, PluginManager.PROP_SEARCHPATH, null
);
-    }
-
-    /**
      *  Returns the current template directory.
      *
      *  @since 1.9.20

Modified: jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/api/engine/PluginManager.java
URL: http://svn.apache.org/viewvc/jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/api/engine/PluginManager.java?rev=1551278&r1=1551277&r2=1551278&view=diff
==============================================================================
--- jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/api/engine/PluginManager.java
(original)
+++ jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/api/engine/PluginManager.java
Mon Dec 16 17:39:18 2013
@@ -76,7 +76,14 @@ public interface PluginManager {
      * 
      * @return plugin insert pattern.
      */
-    public Pattern getPluginPattern();
+    Pattern getPluginPattern();
+    
+    /**
+     * Returns plugins' search path.
+     * 
+     * @return plugins' search path.
+     */
+    String getPluginSearchPath();
 
     /**
      *  Executes a plugin class in the given context.

Modified: jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/plugin/DefaultPluginManager.java
URL: http://svn.apache.org/viewvc/jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/plugin/DefaultPluginManager.java?rev=1551278&r1=1551277&r2=1551278&view=diff
==============================================================================
--- jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/plugin/DefaultPluginManager.java
(original)
+++ jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/plugin/DefaultPluginManager.java
Mon Dec 16 17:39:18 2013
@@ -215,32 +215,32 @@ public class DefaultPluginManager extend
     }
 
     /**
-     * Enables or disables plugin execution.
-     * 
-     * @param enabled True, if plugins should be globally enabled; false, if disabled.
+     * {@inheritDoc}
      */
     public void enablePlugins( boolean enabled ) {
         m_pluginsEnabled = enabled;
     }
 
     /**
-     * Returns plugin execution status. If false, plugins are not executed when they are
encountered on a 
-     * WikiPage, and an empty string is returned in their place.
-     * 
-     * @return True, if plugins are enabled; false otherwise.
+     * {@inheritDoc}
      */
     public boolean pluginsEnabled() {
         return m_pluginsEnabled;
     }
 
     /**
-     * Returns plugin insert pattern.
-     * 
-     * @return plugin insert pattern.
+     * {@inheritDoc}
      */
     public Pattern getPluginPattern() {
 		return m_pluginPattern;
 	}
+    
+    /**
+     * {@inheritDoc}
+     */
+    public String getPluginSearchPath() {
+    	return TextUtil.getStringProperty( m_engine.getWikiProperties(), PROP_SEARCHPATH, null
);
+    }
 
 	/**
      *  Attempts to locate a plugin class from the class path set in the property file.

Modified: jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/util/HttpUtil.java
URL: http://svn.apache.org/viewvc/jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/util/HttpUtil.java?rev=1551278&r1=1551277&r2=1551278&view=diff
==============================================================================
--- jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/util/HttpUtil.java (original)
+++ jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/util/HttpUtil.java Mon Dec 16
17:39:18 2013
@@ -28,7 +28,6 @@ import javax.servlet.http.HttpServletReq
 
 import org.apache.commons.lang.StringUtils;
 import org.apache.log4j.Logger;
-import org.apache.wiki.WikiPage;
 
 
 /**
@@ -94,20 +93,22 @@ public final class HttpUtil {
      *  and version, so it can be used to check if the page has changed.  Do not
      *  assume that the ETag is in any particular format.
      *  
-     *  @param p  The page for which the ETag should be created.
+     *  @param pageName  The page name for which the ETag should be created.
+     *  @param lastModified  The page last modified date for which the ETag should be created.
      *  @return A String depiction of an ETag.
      */
-    public static String createETag( WikiPage p ) {
-        return Long.toString( p.getName().hashCode() ^ p.getLastModified().getTime() );
+    public static String createETag( String pageName, Date lastModified ) {
+        return Long.toString( pageName.hashCode() ^ lastModified.getTime() );
     }
     
     /**
      *  If returns true, then should return a 304 (HTTP_NOT_MODIFIED)
      *  @param req the HTTP request
-     *  @param page the wiki page to check for
+     *  @param pageName the wiki page name to check for
+     *  @param lastModified the last modified date of the wiki page to check for
      *  @return the result of the check
      */
-    public static boolean checkFor304( HttpServletRequest req, WikiPage page ) {
+    public static boolean checkFor304( HttpServletRequest req, String pageName, Date lastModified
) {
         //
         //  We'll do some handling for CONDITIONAL GET (and return a 304)
         //  If the client has set the following headers, do not try for a 304.
@@ -123,7 +124,7 @@ public final class HttpUtil {
             //
             //  HTTP 1.1 ETags go first
             //
-            String thisTag = createETag( page );
+            String thisTag = createETag( pageName, lastModified );
                         
             String eTag = req.getHeader( "If-None-Match" );
             
@@ -135,7 +136,6 @@ public final class HttpUtil {
             //  Next, try if-modified-since
             //
             DateFormat rfcDateFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z");
-            Date lastModified = page.getLastModified();
 
             try {
                 long ifModifiedSince = req.getDateHeader( "If-Modified-Since" );

Modified: jspwiki/trunk/jspwiki-war/src/main/webapp/rss.jsp
URL: http://svn.apache.org/viewvc/jspwiki/trunk/jspwiki-war/src/main/webapp/rss.jsp?rev=1551278&r1=1551277&r2=1551278&view=diff
==============================================================================
--- jspwiki/trunk/jspwiki-war/src/main/webapp/rss.jsp (original)
+++ jspwiki/trunk/jspwiki-war/src/main/webapp/rss.jsp Mon Dec 16 17:39:18 2013
@@ -19,9 +19,10 @@
 
 <?xml version="1.0" encoding="UTF-8"?>
 
-<%@ page import="java.util.*,org.apache.wiki.*" %>
+<%@ page import="java.util.*" %>
 <%@ page import="org.apache.log4j.*" %>
 <%@ page import="java.text.*" %>
+<%@ page import="org.apache.wiki.*" %>
 <%@ page import="org.apache.wiki.preferences.Preferences" %>
 <%@ page import="org.apache.wiki.rss.*" %>
 <%@ page import="org.apache.wiki.util.*" %>
@@ -94,8 +95,8 @@
     SimpleDateFormat iso8601fmt = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
 
     Properties properties = wiki.getWikiProperties();
-    String channelDescription = WikiEngine.getRequiredProperty( properties, RSSGenerator.PROP_CHANNEL_DESCRIPTION
);
-    String channelLanguage    = WikiEngine.getRequiredProperty( properties, RSSGenerator.PROP_CHANNEL_LANGUAGE
);
+    String channelDescription = TextUtil.getRequiredProperty( properties, RSSGenerator.PROP_CHANNEL_DESCRIPTION
);
+    String channelLanguage    = TextUtil.getRequiredProperty( properties, RSSGenerator.PROP_CHANNEL_LANGUAGE
);
 
     //
     //  Now, list items.
@@ -125,7 +126,7 @@
     {
         WikiPage p = (WikiPage) i.next();
 
-        if( !HttpUtil.checkFor304( request, p ) ) hasChanged = true;
+        if( !HttpUtil.checkFor304( request, p.getName(), p.getLastModified() ) ) hasChanged
= true;
         if( p.getLastModified().after( latest ) ) latest = p.getLastModified();
     }
 
@@ -137,7 +138,7 @@
     }
 
     response.addDateHeader("Last-Modified",latest.getTime());
-    response.addHeader("ETag", HttpUtil.createETag(wikipage) );
+    response.addHeader("ETag", HttpUtil.createETag( wikipage.getName(), wikipage.getLastModified()
) );
     
     //
     //  Try to get the RSS XML from the cache.  We build the hashkey



Mime
View raw message