Let components contribute state to URLs
---------------------------------------

                 Key: WICKET-197
                 URL: https://issues.apache.org/jira/browse/WICKET-197
             Project: Wicket
          Issue Type: New Feature
          Components: wicket
            Reporter: Eelco Hillenius
             Fix For: 2.0


The main purpose of this feature request is to let components expose state so 
that it gets carried with client. Such component can implement an interface 
like:

public interface UrlContributor {

  Map<String,String> getState();

  void setState(Map<String, String> m);
}

Wicket would handle the scoping e.g. by prefixing the key/ value pairs with 
something that ids the components.

The use case is that you get bookmarkable pages that can be statefull *on a 
component level* (rather than page level with PageParameters). For example:

class PageableFoo extends SomeComponent implements UrlContributor {

  private int currentPage = 0;
  ...

  public ValueMap<String,String> getState() {
    return new ValueMap("page=" + currentPage);
  }

  void setState(ValueMap<String, String> m) {
    currentPage = m.getInt("page", 0);
  }
}

Then, "somepath:page=n" would be carried in every URL that points back to the 
page. This combined with the stateless pages/ components functionality and 
issue WICKET-30 gives users of Wicket almost limitless ability of tweaking 
their applications for bookmarkability and server side memory usage.

To summarize: the goal of this proposal is to bring bookmarkability of state 
like we have with bookmarkable pages with page parameters to the component 
level.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to