Author: pete
Date: Wed Sep 14 12:06:37 2011
New Revision: 1170554

URL: http://svn.apache.org/viewvc?rev=1170554&view=rev
Log:
added javadoc to clarify usage of PackageResource#getResourceStream and 
PackageResource#getCacheableResourceStream

Modified:
    
wicket/trunk/wicket-core/src/main/java/org/apache/wicket/request/resource/PackageResource.java

Modified: 
wicket/trunk/wicket-core/src/main/java/org/apache/wicket/request/resource/PackageResource.java
URL: 
http://svn.apache.org/viewvc/wicket/trunk/wicket-core/src/main/java/org/apache/wicket/request/resource/PackageResource.java?rev=1170554&r1=1170553&r2=1170554&view=diff
==============================================================================
--- 
wicket/trunk/wicket-core/src/main/java/org/apache/wicket/request/resource/PackageResource.java
 (original)
+++ 
wicket/trunk/wicket-core/src/main/java/org/apache/wicket/request/resource/PackageResource.java
 Wed Sep 14 12:06:37 2011
@@ -174,6 +174,15 @@ public class PackageResource extends Abs
                return style != null ? style : Session.get().getStyle();
        }
 
+       /**
+        * be aware that method takes the current wicket session's locale 
+        * and style into account when locating the stream.
+        * 
+        * @return resource stream
+        *
+        * @see 
org.apache.wicket.request.resource.caching.IStaticCacheableResource#getCacheableResourceStream()
+        * @see #getResourceStream()
+        */
        public IResourceStream getCacheableResourceStream()
        {
                // get resource locator
@@ -337,6 +346,39 @@ public class PackageResource extends Abs
 
        /**
         * locate resource stream for current resource
+        * <p/>
+        * Unfortunately this method has changed from scope 'public' in wicket 
1.4 to scope 'protected'
+        * in wicket 1.5. We realized this too late and now changing it would 
break the api. So
+        * in case you need access to this method you have the following 
options:
+        * 
+        * <ul>
+        *     <li>
+        *         copy-paste the code in the method body of {@link 
#getResourceStream()} 
+        *         and wait for wicket 1.6
+        *     </li>
+        *     <li>
+        *         extend PackageResource, passing the package resources 
+        *         attributes and make {@link #getResourceStream()} public 
again:
+        *         
+        *       <pre>
+        *       public class MyPackageResource extends PackageResource
+        *       { 
+        *           public MyPackageResource(Class<?> scope, String name, 
Locale locale, String style,
+        *                 String variation)
+        *         {
+        *           super(scope, name, locale, style, variation);
+        *         }
+        *
+        *         // change access to public here
+        *         public IResourceStream getResourceStream()
+        *         {
+        *           return super.getResourceStream();
+        *         }
+        *       }
+        *       </pre>
+        *     </li>
+        * </ul>
+        * 
         * 
         * @return resource stream or <code>null</code> if not found
         */


Reply via email to