Hi Andrea,

On Tue, Jun 9, 2015 at 7:39 PM, <adelb...@apache.org> wrote:

> Repository: wicket
> Updated Branches:
>   refs/heads/WICKET-5906-7.x 5b30073a8 -> d64655987
>
>
> PackageResource#getResourceStream() removed and replaced by
> PackageResource#getCacheableResourceStream()
>
>
> Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
> Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/d6465598
> Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/d6465598
> Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/d6465598
>
> Branch: refs/heads/WICKET-5906-7.x
> Commit: d6465598790c24e210a7ea07f935cf4e978ad910
> Parents: 5b30073
> Author: Andrea Del Bene <“adelb...@apache.org”>
> Authored: Tue Jun 9 18:38:17 2015 +0200
> Committer: Andrea Del Bene <“adelb...@apache.org”>
> Committed: Tue Jun 9 18:38:17 2015 +0200
>
> ----------------------------------------------------------------------
>  .../apache/wicket/markup/html/media/Source.java  |  2 +-
>  .../wicket/request/resource/PackageResource.java | 19 ++++---------------
>  .../org/apache/wicket/util/image/ImageUtil.java  |  2 +-
>  .../request/resource/CssPackageResourceTest.java |  5 ++++-
>  .../resource/JavaScriptPackageResourceTest.java  |  5 +++--
>  5 files changed, 13 insertions(+), 20 deletions(-)
> ----------------------------------------------------------------------
>
>
>
> http://git-wip-us.apache.org/repos/asf/wicket/blob/d6465598/wicket-core/src/main/java/org/apache/wicket/markup/html/media/Source.java
> ----------------------------------------------------------------------
> diff --git
> a/wicket-core/src/main/java/org/apache/wicket/markup/html/media/Source.java
> b/wicket-core/src/main/java/org/apache/wicket/markup/html/media/Source.java
> index 4abdca9..1621365 100755
> ---
> a/wicket-core/src/main/java/org/apache/wicket/markup/html/media/Source.java
> +++
> b/wicket-core/src/main/java/org/apache/wicket/markup/html/media/Source.java
> @@ -196,7 +196,7 @@ public class Source extends WebMarkupContainer
>                         else if (resourceReference != null)
>                         {
>                                 PackageResource resource =
> resourceReference.getResource();
> -                               IResourceStream resourceStream =
> resource.getResourceStream();
> +                               IResourceStream resourceStream =
> resource.getCacheableResourceStream();
>                                 String contentType =
> resourceStream.getContentType();
>                                 tag.put("type", contentType);
>                         }
>
>
> http://git-wip-us.apache.org/repos/asf/wicket/blob/d6465598/wicket-core/src/main/java/org/apache/wicket/request/resource/PackageResource.java
> ----------------------------------------------------------------------
> diff --git
> a/wicket-core/src/main/java/org/apache/wicket/request/resource/PackageResource.java
> b/wicket-core/src/main/java/org/apache/wicket/request/resource/PackageResource.java
> index 2253446..85e2911 100644
> ---
> a/wicket-core/src/main/java/org/apache/wicket/request/resource/PackageResource.java
> +++
> b/wicket-core/src/main/java/org/apache/wicket/request/resource/PackageResource.java
> @@ -299,7 +299,7 @@ public class PackageResource extends AbstractResource
> implements IStaticCacheabl
>         {
>                 final ResourceResponse resourceResponse = new
> ResourceResponse();
>
> -               final IResourceStream resourceStream = getResourceStream();
> +               final IResourceStream resourceStream =
> getCacheableResourceStream();
>
>                 // bail out if resource stream could not be found
>                 if (resourceStream == null)
> @@ -431,13 +431,12 @@ public class PackageResource extends
> AbstractResource implements IStaticCacheabl
>
>
>         /**
> -        * be aware that method takes the current wicket session's locale
> and style into account when
> -        * locating the stream.
> +        * Locate resource stream for current resource. Be aware that
> method takes the current wicket session's
> +        * locale and style into account when locating the stream.
>          *
> -        * @return resource stream
> +        * @return resource stream or <code>null</code> if not found
>          *
>          * @see
> org.apache.wicket.request.resource.caching.IStaticCacheableResource#getCacheableResourceStream()
> -        * @see #getResourceStream()
>          */
>         @Override
>         public IResourceStream getCacheableResourceStream()
> @@ -446,16 +445,6 @@ public class PackageResource extends AbstractResource
> implements IStaticCacheabl
>         }
>
>         /**
> -        * locate resource stream for current resource
> -        *
> -        * @return resource stream or <code>null</code> if not found
> -        */
> -       public IResourceStream getResourceStream()
>

Thanks for doing this change!
I think it would be better to keep the method as deprecated until Wicket
8.x, for easier migration. Its new impl should just forward the call to
#getCacheableResourceStream().


> -       {
> -               return internalGetResourceStream(style, locale);
> -       }
> -
> -       /**
>          * @return whether {@link
> org.apache.wicket.resource.ITextResourceCompressor} can be used to
>          *         compress the resource.
>          */
>
>
> http://git-wip-us.apache.org/repos/asf/wicket/blob/d6465598/wicket-core/src/main/java/org/apache/wicket/util/image/ImageUtil.java
> ----------------------------------------------------------------------
> diff --git
> a/wicket-core/src/main/java/org/apache/wicket/util/image/ImageUtil.java
> b/wicket-core/src/main/java/org/apache/wicket/util/image/ImageUtil.java
> index 6c14867..39e4cc4 100644
> --- a/wicket-core/src/main/java/org/apache/wicket/util/image/ImageUtil.java
> +++ b/wicket-core/src/main/java/org/apache/wicket/util/image/ImageUtil.java
> @@ -51,7 +51,7 @@ public class ImageUtil
>         public static CharSequence
> createBase64EncodedImage(PackageResourceReference imageReference,
>                 boolean removeWhitespaces) throws
> ResourceStreamNotFoundException, IOException
>         {
> -               IResourceStream resourceStream =
> imageReference.getResource().getResourceStream();
> +               IResourceStream resourceStream =
> imageReference.getResource().getCacheableResourceStream();
>                 InputStream inputStream = resourceStream.getInputStream();
>                 try
>                 {
>
>
> http://git-wip-us.apache.org/repos/asf/wicket/blob/d6465598/wicket-core/src/test/java/org/apache/wicket/request/resource/CssPackageResourceTest.java
> ----------------------------------------------------------------------
> diff --git
> a/wicket-core/src/test/java/org/apache/wicket/request/resource/CssPackageResourceTest.java
> b/wicket-core/src/test/java/org/apache/wicket/request/resource/CssPackageResourceTest.java
> index 06a6f44..560bc3e 100644
> ---
> a/wicket-core/src/test/java/org/apache/wicket/request/resource/CssPackageResourceTest.java
> +++
> b/wicket-core/src/test/java/org/apache/wicket/request/resource/CssPackageResourceTest.java
> @@ -16,6 +16,8 @@
>   */
>  package org.apache.wicket.request.resource;
>
> +import java.util.Locale;
> +
>  import org.apache.wicket.WicketTestCase;
>  import org.apache.wicket.css.ICssCompressor;
>  import org.apache.wicket.markup.html.PackageResourceTest;
> @@ -108,7 +110,8 @@ public class CssPackageResourceTest extends
> WicketTestCase
>         {
>                 CssPackageResource resource = new
> CssPackageResource(PackageResourceTest.class,
>                         "packaged1.txt", null, null, null);
> -
> +
> +               tester.getSession().setLocale(Locale.ROOT);
>
> tester.getApplication().getResourceSettings().setCssCompressor(null);
>                 tester.startResource(resource);
>                 assertEquals("TEST", tester.getLastResponseAsString());
>
>
> http://git-wip-us.apache.org/repos/asf/wicket/blob/d6465598/wicket-core/src/test/java/org/apache/wicket/request/resource/JavaScriptPackageResourceTest.java
> ----------------------------------------------------------------------
> diff --git
> a/wicket-core/src/test/java/org/apache/wicket/request/resource/JavaScriptPackageResourceTest.java
> b/wicket-core/src/test/java/org/apache/wicket/request/resource/JavaScriptPackageResourceTest.java
> index 39fd9c6..45cb49f 100644
> ---
> a/wicket-core/src/test/java/org/apache/wicket/request/resource/JavaScriptPackageResourceTest.java
> +++
> b/wicket-core/src/test/java/org/apache/wicket/request/resource/JavaScriptPackageResourceTest.java
> @@ -18,6 +18,7 @@ package org.apache.wicket.request.resource;
>
>  import java.io.IOException;
>  import java.io.InputStream;
> +import java.util.Locale;
>
>  import org.apache.wicket.WicketTestCase;
>  import org.apache.wicket.javascript.IJavaScriptCompressor;
> @@ -122,7 +123,7 @@ public class JavaScriptPackageResourceTest extends
> WicketTestCase
>                 tester.startResource(resource);
>                 assertEquals(RESOURCE_COMPRESSED,
> tester.getLastResponseAsString());
>                 InputStream cacheableStream =
> resource.getCacheableResourceStream().getInputStream();
> -               InputStream stream =
> resource.getResourceStream().getInputStream();
> +               InputStream stream =
> resource.getCacheableResourceStream().getInputStream();
>                 assertEquals(IOUtils.toString(cacheableStream),
> IOUtils.toString(stream));
>         }
>
> @@ -149,7 +150,7 @@ public class JavaScriptPackageResourceTest extends
> WicketTestCase
>         {
>                 JavaScriptPackageResource resource = new
> JavaScriptPackageResource(
>                         PackageResourceTest.class, "packaged1.txt", null,
> null, null);
> -
> +               tester.getSession().setLocale(Locale.ROOT);
>
> tester.getApplication().getResourceSettings().setJavaScriptCompressor(null);
>                 tester.startResource(resource);
>                 assertEquals("TEST", tester.getLastResponseAsString());
>
>

Reply via email to