Return-Path: X-Original-To: apmail-struts-commits-archive@minotaur.apache.org Delivered-To: apmail-struts-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 77B0CD983 for ; Fri, 30 Nov 2012 07:26:28 +0000 (UTC) Received: (qmail 5906 invoked by uid 500); 30 Nov 2012 07:26:28 -0000 Delivered-To: apmail-struts-commits-archive@struts.apache.org Received: (qmail 5418 invoked by uid 500); 30 Nov 2012 07:26:21 -0000 Mailing-List: contact commits-help@struts.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@struts.apache.org Delivered-To: mailing list commits@struts.apache.org Received: (qmail 5382 invoked by uid 99); 30 Nov 2012 07:26:19 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 30 Nov 2012 07:26:19 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 30 Nov 2012 07:26:16 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 300E2238896F; Fri, 30 Nov 2012 07:25:55 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@struts.apache.org From: lukaszlenart@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20121130072555.300E2238896F@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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; +/** + * Default implementation to server static content + *

+ * 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: + *

    + *
  • org.apache.struts2.static
  • + *
  • template
  • + *
  • static
  • + *
+ *

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". Be + * careful, however, to expose any packages that may have sensitive information, such as properties file with + * database access credentials. + *

+ */ 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. + * + * <bean name="myContentLoader" type="org.apache.struts2.dispatcher" class="com.company.struts.MyContentLoader"/> + * <constant name="struts.staticContentLoader" value="myContentLoader"/> + * + * Check {@link org.apache.struts2.config.BeanSelectionProvider} for more details. */ public interface StaticContentLoader {