More on wicket url stratergy

View: New views
11 Messages — Rating Filter:   Alert me  

More on wicket url stratergy

by Mathias P.W Nilsson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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?

Re: More on wicket url stratergy

by David Leangen-8 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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@...
For additional commands, e-mail: users-help@...


Re: More on wicket url stratergy

by Mathias P.W Nilsson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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?

Re: More on wicket url stratergy

by Erik van Oosten :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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@...
For additional commands, e-mail: users-help@...


Re: More on wicket url stratergy

by igor.vaynberg :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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.vanoosten@...> 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@...
> For additional commands, e-mail: users-help@...
>
>

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


Re: More on wicket url stratergy

by Erik van Oosten :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


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.vanoosten@...> 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@...
For additional commands, e-mail: users-help@...


Parent Message unknown Re: More on wicket url stratergy

by Antoine Angénieux :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Téléphone Ben : 06 14 07 53 63

 Le mer  2/07/08 16:56, Erik van Oosten e.vanoosten@... a écrit:

>
> 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.vanoos
> ten@...> 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@...
For additional commands, e-mail:
> users-help@...
>
>
>


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


Re: More on wicket url stratergy

by Mathias P.W Nilsson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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.

Re: More on wicket url stratergy

by igor.vaynberg :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

what does the url look like?

-igor

On Wed, Jul 2, 2008 at 7:56 AM, Erik van Oosten <e.vanoosten@...> 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.vanoosten@...>
>> 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@...
> For additional commands, e-mail: users-help@...
>
>

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


Re: More on wicket url stratergy

by Mathias P.W Nilsson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Re: More on wicket url stratergy

by Erik van Oosten :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


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@...
For additional commands, e-mail: users-help@...

LightInTheBox - Buy quality products at wholesale price!