You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Peter Ertl (JIRA)" <ji...@apache.org> on 2008/12/30 17:30:44 UTC

[jira] Closed: (WICKET-1666) contribution: provide indexed urls for shared resources (with optional query string parameters)

     [ https://issues.apache.org/jira/browse/WICKET-1666?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Peter Ertl closed WICKET-1666.
------------------------------


thanks for applying! :-)

> contribution: provide indexed urls for shared resources (with optional query string parameters)
> -----------------------------------------------------------------------------------------------
>
>                 Key: WICKET-1666
>                 URL: https://issues.apache.org/jira/browse/WICKET-1666
>             Project: Wicket
>          Issue Type: New Feature
>          Components: wicket
>            Reporter: Peter Ertl
>            Assignee: Juergen Donnerstag
>             Fix For: 1.4-RC2
>
>         Attachments: IndexedSharedResourceCodingStrategy-wicket-1.3.patch, IndexedSharedResourceCodingStrategy-wicket-1.4.patch
>
>
> I attached a patch for wicket-1.3.x and wicket.1.4.x to support indexed url encoding + query parameters for shared resources (somehow similar the way it is done with pages already). It contains javadoc and a WicketTestCase for regression tests.
> the main class is 
>    org.apache.wicket.request.target.coding.IndexedSharedResourceCodingStrategy
> and can be used in WebApplication like this:
>   mount(new IndexedSharedResourceCodingStrategy(path, sharedResourceKey);
> here an example:
>  for this url
>    /mountpath/foo/bar/123?name=joe&languages=java&languages=scala
>  the parameters value map will be
>     key           value
>    ---------------------------------------------
>     "0"           "foo"
>     "1"           "bar"
>     "2"           "123"
>    "name"         "joe"
>    "languages"    String[] { "java", "scala" }
> accessing these is trivial:
>   public class TestResource extends Resource
>   {
>     @Override
>     public IResourceStream getResourceStream()
>     {
>       long value = getParameters().getAsLong("2");
>       String name = getParameters().getString("name");
>       String[] languages = getParameters().getStringArray("languages");
>     
>       // create some custom resource stream based upon the parameters here
>     }
>   }
> so you can have urls like these
>   /images/{imagename}.{format}
>   /blog/2008/05/12/47-test-blog-entry.html
> with absolutely no effort.
> the greatest benefit is that shared resource urls look like static resources for the browser. this comes especially handy when utilizing browser caching. Also, the user will not realize the resources are served dynamically and bookmarking is easy. also, at least in my opinion, the urls are just "pretty" :-)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.