struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lukaszlen...@apache.org
Subject svn commit: r1415524 - in /struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher: DefaultStaticContentLoader.java StaticContentLoader.java
Date Fri, 30 Nov 2012 07:25:54 GMT
Author: lukaszlenart
Date: Fri Nov 30 07:25:53 2012
New Revision: 1415524

URL: http://svn.apache.org/viewvc?rev=1415524&view=rev
Log:
WW-3930 updates JavaDocs about static content loader

Modified:
    struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/DefaultStaticContentLoader.java
    struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/StaticContentLoader.java

Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/DefaultStaticContentLoader.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/DefaultStaticContentLoader.java?rev=1415524&r1=1415523&r2=1415524&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/DefaultStaticContentLoader.java
(original)
+++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/DefaultStaticContentLoader.java
Fri Nov 30 07:25:53 2012
@@ -40,6 +40,26 @@ import java.util.Calendar;
 import java.util.List;
 import java.util.StringTokenizer;
 
+/**
+ * <b>Default implementation to server static content</b>
+ * <p/>
+ * This class is used to serve common static content needed when using various parts of Struts,
such as JavaScript
+ * files, CSS files, etc. It works by looking for requests to /struts/* (or /static/*), and
then mapping the value after "/struts/"
+ * to common packages in Struts and, optionally, in your class path. By default, the following
packages are
+ * automatically searched:
+ * <ul>
+ * <li>org.apache.struts2.static</li>
+ * <li>template</li>
+ * <li>static</li>
+ * </ul>
+ * <p/> This means that you can simply request /struts/xhtml/styles.css and the XHTML
UI theme's default stylesheet
+ * will be returned. Likewise, many of the AJAX UI components require various JavaScript
files, which are found in the
+ * org.apache.struts2.static package. If you wish to add additional packages to be searched,
you can add a comma
+ * separated (space, tab and new line will do as well) list in the filter init parameter
named "packages". <b>Be
+ * careful</b>, however, to expose any packages that may have sensitive information,
such as properties file with
+ * database access credentials.
+ * <p/>
+ */
 public class DefaultStaticContentLoader implements StaticContentLoader {
     /**
      * Provide a logging instance.

Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/StaticContentLoader.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/StaticContentLoader.java?rev=1415524&r1=1415523&r2=1415524&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/StaticContentLoader.java
(original)
+++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/StaticContentLoader.java
Fri Nov 30 07:25:53 2012
@@ -20,15 +20,20 @@
  */
 package org.apache.struts2.dispatcher;
 
-import java.io.IOException;
+import org.apache.struts2.dispatcher.ng.HostConfig;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-
-import org.apache.struts2.dispatcher.ng.HostConfig;
+import java.io.IOException;
 
 /**
- * Interface for loading static resources, based on a path
+ * Interface for loading static resources, based on a path. After implementing your own static
content loader
+ * you must tell the framework how to use it, eg.
+ *
+ * &lt;bean name="myContentLoader" type="org.apache.struts2.dispatcher" class="com.company.struts.MyContentLoader"/&gt;
+ * &lt;constant name="struts.staticContentLoader" value="myContentLoader"/&gt;
+ *
+ * Check {@link org.apache.struts2.config.BeanSelectionProvider} for more details.
  */
 public interface StaticContentLoader {
 



Mime
View raw message