You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by "Mathias P.W Nilsson" <ma...@snyltarna.se> on 2008/07/01 11:50:54 UTC

More on wicket url stratergy

In my itemList class I set the response page like this. 

setResponsePage(  new ItemPage( parameters, ItemListPage.this ) );

Now the ItemListPage.this is for back travelling and to get the background
from the list class. Is it possible to make the itemPage bookmarkable?
-- 
View this message in context: http://www.nabble.com/More-on-wicket-url-stratergy-tp18212748p18212748.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: More on wicket url stratergy

Posted by Erik van Oosten <e....@grons.nl>.
Ok, here is my code. Perhaps the way I (ab)use HybridUrlCodingStrategy
is what made the URLs change.

In the ctor of ChangePasswordPage:

Form<PasswordObject> form = new Form<PasswordObject>("form", new CompoundPropertyModel<PasswordObject>(passwordObject)) {
  protected void onSubmit() {
    try {
      getSession().authenticateMemberByCredentials(me.getEmail(), passwordObject.getPassword(), true);
      ... update password ...
      info(getLocalizer().getString("form.info.password.changed", this));
      setResponsePage(new AccountPage());
    } catch (AuthenticationFailure authenticationFailure) {
      error(getLocalizer().getString("form.error.wrongpassword", this));
    }
  }
};

and in Application#init():

mount(new NonVersionedHybridUrlCodingStrategy("settings/account", AccountPage.class));
mount(new NonVersionedHybridUrlCodingStrategy("settings/account/password", ChangePasswordPage.class));

NonVersionedHybridUrlCodingStrategy looks like this:

    /**
     * Variant of Wicket's HybridUrlCodingStrategy.
     * Use this URL coding strategy in the frontend for non versioned pages
     * (call setVersioned(false) in the constructor) that have some kind of
     * feedback (e.g. a form submit).
     */
    private static class NonVersionedHybridUrlCodingStrategy extends HybridUrlCodingStrategy {

        public NonVersionedHybridUrlCodingStrategy(String mountPath, Class<? extends Page> pageClass) {
            super(mountPath, pageClass);
        }

        @Override
        protected String addPageInfo(String url, PageInfo pageInfo) {
            // Do not add the version number as super.addPageInfo would do.
            return url;
        }
    }


Regards,
     Erik.



Mathias P.W Nilsson wrote:
> Can you please elaborate. 
>
> I have this Link in my List class
> Link itemLink = new Link( "itemLink", listItem.getModel() ){
>   @Override
>   public void onClick() {
>     PageParameters parameters = new PageParameters();
>     parameters.add( "ItemId", ((Item)getModelObject()).getId().toString());
>     ItemPage itemPage = new  ItemPage( parameters, ItemListPage.this );
>     itemPage.setRedirect( true );
>     setResponsePage( itemPage  );
>   }
> };
> This will produce url like wicket:interface=:2::::
>
> In My application class I have tried a number of mounting but without
> success. Any more pointers?
> I use the reference for the ItemListPage to go back from ItemPage to
> ItemListPage plus I use the same background as in the ItemListPage.
>
> If a google spider where to index this it would not be successful so I need
> a way to get this to be bookmarkable.
>   

-- 

--
Erik van Oosten
http://day-to-day-stuff.blogspot.com/



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: More on wicket url stratergy

Posted by "Mathias P.W Nilsson" <ma...@snyltarna.se>.
Can you please elaborate. 

I have this Link in my List class
Link itemLink = new Link( "itemLink", listItem.getModel() ){
  @Override
  public void onClick() {
    PageParameters parameters = new PageParameters();
    parameters.add( "ItemId", ((Item)getModelObject()).getId().toString());
    ItemPage itemPage = new  ItemPage( parameters, ItemListPage.this );
    itemPage.setRedirect( true );
    setResponsePage( itemPage  );
  }
};
This will produce url like wicket:interface=:2::::

In My application class I have tried a number of mounting but without
success. Any more pointers?
I use the reference for the ItemListPage to go back from ItemPage to
ItemListPage plus I use the same background as in the ItemListPage.

If a google spider where to index this it would not be successful so I need
a way to get this to be bookmarkable.
-- 
View this message in context: http://www.nabble.com/More-on-wicket-url-stratergy-tp18212748p18239900.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: More on wicket url stratergy

Posted by "Mathias P.W Nilsson" <ma...@snyltarna.se>.
https://localhost/hairless-web/?wicket:interface=:2:itemRepeater:3:itemLink::ILinkListener::

// Mathias
-- 
View this message in context: http://www.nabble.com/More-on-wicket-url-stratergy-tp18212748p18240461.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: More on wicket url stratergy

Posted by Igor Vaynberg <ig...@gmail.com>.
what does the url look like?

-igor

On Wed, Jul 2, 2008 at 7:56 AM, Erik van Oosten <e....@grons.nl> wrote:
>
> Yes, I am pretty sure I did this about a month ago.
>
> The funny thing is that we did it this way because this way flash (component
> error messages) are preserved. We wanted to show a succes message on the
> page we forwarded to.
>
> ... looking up the code now...
>
> Yep, correct. Though we did not call setRedirect(true) as the code runs from
> a Form#onSubmit callback which always redirects anyway.
>
> Regards,
>   Erik.
>
>
> Igor Vaynberg wrote:
>>
>> have you tried this eric? setting a page instance does not produce a
>> bookmarkable url, you would have to
>> setresponsepage(itemlistpage.class)
>>
>> -igor
>>
>> On Wed, Jul 2, 2008 at 6:41 AM, Erik van Oosten <e....@grons.nl>
>> wrote:
>>
>>>
>>> No, not true.
>>>
>>> You /can/ do setResponsePage(new ItemListPage(...)), /and/ make it
>>> bookmarkable. The trick is to call setRedirect(true) together with the
>>> call
>>> to setResponsePage. Furthermore you need to mount ItemListPage in your
>>> application#init method (see method Application#mount()).
>>>
>>> Regards,
>>>  Erik.
>>>
>>>
>>> David Leangen wrote:
>>>
>>>>
>>>> On Tue, 2008-07-01 at 02:50 -0700, Mathias P.W Nilsson wrote:
>>>>
>>>>
>>>>>
>>>>> In my itemList class I set the response page like this.
>>>>> setResponsePage(  new ItemPage( parameters, ItemListPage.this ) );
>>>>>
>>>>> Now the ItemListPage.this is for back travelling and to get the
>>>>> background
>>>>> from the list class. Is it possible to make the itemPage bookmarkable?
>>>>>
>>>>>
>>>>
>>>> Sure, but you can no longer construct the object yourself. You'll need
>>>> to do this instead:
>>>>
>>>>  setResponsePage( ItemListPage.class, parameters );
>>>>
>>>>
>>>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: More on wicket url stratergy

Posted by Erik van Oosten <e....@grons.nl>.
Yes, I am pretty sure I did this about a month ago.

The funny thing is that we did it this way because this way flash 
(component error messages) are preserved. We wanted to show a succes 
message on the page we forwarded to.

... looking up the code now...

Yep, correct. Though we did not call setRedirect(true) as the code runs 
from a Form#onSubmit callback which always redirects anyway.

Regards,
    Erik.


Igor Vaynberg wrote:
> have you tried this eric? setting a page instance does not produce a
> bookmarkable url, you would have to
> setresponsepage(itemlistpage.class)
>
> -igor
>
> On Wed, Jul 2, 2008 at 6:41 AM, Erik van Oosten <e....@grons.nl> wrote:
>   
>> No, not true.
>>
>> You /can/ do setResponsePage(new ItemListPage(...)), /and/ make it
>> bookmarkable. The trick is to call setRedirect(true) together with the call
>> to setResponsePage. Furthermore you need to mount ItemListPage in your
>> application#init method (see method Application#mount()).
>>
>> Regards,
>>   Erik.
>>
>>
>> David Leangen wrote:
>>     
>>> On Tue, 2008-07-01 at 02:50 -0700, Mathias P.W Nilsson wrote:
>>>
>>>       
>>>> In my itemList class I set the response page like this.
>>>> setResponsePage(  new ItemPage( parameters, ItemListPage.this ) );
>>>>
>>>> Now the ItemListPage.this is for back travelling and to get the
>>>> background
>>>> from the list class. Is it possible to make the itemPage bookmarkable?
>>>>
>>>>         
>>> Sure, but you can no longer construct the object yourself. You'll need
>>> to do this instead:
>>>
>>>  setResponsePage( ItemListPage.class, parameters );
>>>
>>>
>>>       


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: More on wicket url stratergy

Posted by Igor Vaynberg <ig...@gmail.com>.
have you tried this eric? setting a page instance does not produce a
bookmarkable url, you would have to
setresponsepage(itemlistpage.class)

-igor

On Wed, Jul 2, 2008 at 6:41 AM, Erik van Oosten <e....@grons.nl> wrote:
> No, not true.
>
> You /can/ do setResponsePage(new ItemListPage(...)), /and/ make it
> bookmarkable. The trick is to call setRedirect(true) together with the call
> to setResponsePage. Furthermore you need to mount ItemListPage in your
> application#init method (see method Application#mount()).
>
> Regards,
>   Erik.
>
>
> David Leangen wrote:
>>
>> On Tue, 2008-07-01 at 02:50 -0700, Mathias P.W Nilsson wrote:
>>
>>>
>>> In my itemList class I set the response page like this.
>>> setResponsePage(  new ItemPage( parameters, ItemListPage.this ) );
>>>
>>> Now the ItemListPage.this is for back travelling and to get the
>>> background
>>> from the list class. Is it possible to make the itemPage bookmarkable?
>>>
>>
>> Sure, but you can no longer construct the object yourself. You'll need
>> to do this instead:
>>
>>  setResponsePage( ItemListPage.class, parameters );
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: More on wicket url stratergy

Posted by Erik van Oosten <e....@grons.nl>.
No, not true.

You /can/ do setResponsePage(new ItemListPage(...)), /and/ make it 
bookmarkable. The trick is to call setRedirect(true) together with the 
call to setResponsePage. Furthermore you need to mount ItemListPage in 
your application#init method (see method Application#mount()).

Regards,
    Erik.


David Leangen wrote:
> On Tue, 2008-07-01 at 02:50 -0700, Mathias P.W Nilsson wrote:
>   
>> In my itemList class I set the response page like this. 
>>
>> setResponsePage(  new ItemPage( parameters, ItemListPage.this ) );
>>
>> Now the ItemListPage.this is for back travelling and to get the background
>> from the list class. Is it possible to make the itemPage bookmarkable?
>>     
>
> Sure, but you can no longer construct the object yourself. You'll need
> to do this instead:
>
>   setResponsePage( ItemListPage.class, parameters );
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: More on wicket url stratergy

Posted by "Mathias P.W Nilsson" <ma...@snyltarna.se>.
Thanks, but this what not what I meant


My ItemPage takes the ItemListPage as a parameter in the constructor so that
I can go back to the
exact location I were before.

Now If I want to use the Item as a bookmarkable page, how can this be
achieved with a reference to ItemListPage?
-- 
View this message in context: http://www.nabble.com/More-on-wicket-url-stratergy-tp18212748p18214136.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: More on wicket url stratergy

Posted by David Leangen <wi...@leangen.net>.
On Tue, 2008-07-01 at 02:50 -0700, Mathias P.W Nilsson wrote:
> In my itemList class I set the response page like this. 
> 
> setResponsePage(  new ItemPage( parameters, ItemListPage.this ) );
> 
> Now the ItemListPage.this is for back travelling and to get the background
> from the list class. Is it possible to make the itemPage bookmarkable?

Sure, but you can no longer construct the object yourself. You'll need
to do this instead:

  setResponsePage( ItemListPage.class, parameters );




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org