You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Andrew Lombardi <an...@mysticcoders.com> on 2011/01/20 18:32:03 UTC

Added parameters on the end of requests with wicket 1.5

I've been converting mysticpaste.com to using Wicket 1.5 with the help of Martin Grigorov :) - the source is available here - https://github.com/kinabalu/mysticpaste

99% of the way there, and the only remaining issue is that when you paste a URL with previous versions of Wicket, I properly get  /view/[paste-id] and that's it

With Wicket 1.5 however, it's appending the pagemap number?  So I get instead /view/[paste-id]?1  -- the page is not stateless, has some ajax components on it.  But it is important that the URL the users get is just /view/[paste-id]

Here's how I move the user to the view page right now:

                    params.add("0", Long.toString(pasteItem.getId()));
                    setResponsePage(ViewPublicPage.class, params);

And here's the mount in Application:

        mountPage("/view/${0}/${1}", ViewPublicPage.class);


the ${1} here is for highlighting specific lines

Thanks!


To our success!

Mystic Coders, LLC | Code Magic | www.mysticcoders.com

ANDREW LOMBARDI | andrew@mysticcoders.com
ofc: 714-352-0298
fax: 714-782-6024
cell: 714-697-8046
linked-in: http://www.linkedin.com/in/andrewlombardi
twitter: @kinabalu
facebook: http://www.facebook.com/lombardi
fan mystic: http://www.facebook.com/mysticcoders
flickr: http://www.flickr.com/photos/kinabalu

Eco-Tip: Printing e-mails is usually a waste.

--
If this message wasn't addressed to you, don't use, disclose, distribute, print or copy any part of this message


Re: Added parameters on the end of requests with wicket 1.5

Posted by "andrew@mysticcoders.com" <an...@mysticcoders.com>.
Awesome thanks Igor.

On Thu, Jan 20, 2011 at 2:13 PM, Igor Vaynberg <ig...@gmail.com>wrote:

> you should use replacehandler() instead of scheduleaftercurrent, since
> current will render the page.
>
> but to do it in 1.5 way you would mount a handler on
> /view/${pasteid}/download and one on /view/${pasteid}/text and
> implement streaming there instead of using the page as a switchboard.
>
> -igor
>
> On Thu, Jan 20, 2011 at 1:55 PM, Andrew Lombardi
> <an...@mysticcoders.com> wrote:
> > Url's look great now /view/[paste-id]
> >
> > Next issue.  We have 2 links, one for Raw and the other for Download
> which suffix the URL with /text and /download respectively like so:
> >
> > /view/[paste-id]/text
> > /view/[paste-id]/download
> >
> > in 1.4 I redirected to the SharedResourceReference and all worked dandy.
>  martin-g helped convert this to the 1.5 way, and the links don't seem to do
> anything anymore, and if you go to the URL directly, it tries to render the
> page instead of redirect to the resource straight away.  Here's the code at
> the top of the ctor:
> >
> >            if (params.get("1").toString().equals("text")) {
> >                getRequestCycle().scheduleRequestHandlerAfterCurrent(new
> ResourceReferenceRequestHandler(new
> SharedResourceReference("textPasteResource")));
> >                return;
> >            } else if (params.get("1").toString().equals("download")) {
> >                getRequestCycle().scheduleRequestHandlerAfterCurrent(new
> ResourceReferenceRequestHandler(new
> SharedResourceReference("downloadAsTextPasteResource")));
> >                return;
> >            }
> >
> > I understand why Wicket is trying to render the page since I'm
> effectively redirecting there, even if in 1.4 it worked.
> >
> > Is there a way to register a handler for URL's that suffix /text and
> /download to be served by the resources directly?
> >
> > On Jan 20, 2011, at 1:19 PM, Andrew Lombardi wrote:
> >
> >> Okay, got it.  I'll dump the ajax on that page, and convert it over.
>  Thanks!
> >>
> >> On Jan 20, 2011, at 1:00 PM, Igor Vaynberg wrote:
> >>
> >>> the onclick of the stateless link can redirect back to the
> >>> bookmarkable version, which will clean up the url
> >>>
> >>> -igor
> >>>
> >>> On Thu, Jan 20, 2011 at 12:22 PM, Martin Grigorov <
> mgrigorov@apache.org> wrote:
> >>>> On Thu, Jan 20, 2011 at 6:32 PM, Andrew Lombardi <
> andrew@mysticcoders.com>wrote:
> >>>>
> >>>>> I've been converting mysticpaste.com to using Wicket 1.5 with the
> help of
> >>>>> Martin Grigorov :) - the source is available here -
> >>>>> https://github.com/kinabalu/mysticpaste
> >>>>>
> >>>>> 99% of the way there, and the only remaining issue is that when you
> paste a
> >>>>> URL with previous versions of Wicket, I properly get
>  /view/[paste-id] and
> >>>>> that's it
> >>>>>
> >>>>> With Wicket 1.5 however, it's appending the pagemap number?  So I get
> >>>>> instead /view/[paste-id]?1  -- the page is not stateless, has some
> ajax
> >>>>> components on it.  But it is important that the URL the users get is
> just
> >>>>> /view/[paste-id]
> >>>>>
> >>>>> Here's how I move the user to the view page right now:
> >>>>>
> >>>>>                    params.add("0", Long.toString(pasteItem.getId()));
> >>>>>                    setResponsePage(ViewPublicPage.class, params);
> >>>>>
> >>>>> And here's the mount in Application:
> >>>>>
> >>>>>        mountPage("/view/${0}/${1}", ViewPublicPage.class);
> >>>>>
> >>>>>
> >>>>> the ${1} here is for highlighting specific lines
> >>>>>
> >>>>> Thanks!
> >>>>>
> >>>>> A brief conversation in IRC:
> >>>>
> >>>> (09:05:43 PM) ivaynberg: no way to get rid of ?1 for now
> >>>> (09:05:49 PM) ivaynberg: thats the page id i think
> >>>> (09:06:04 PM) martin-g: it is
> >>>> (09:06:07 PM) ivaynberg: urls work like hybrid ones in 1.4
> >>>> (09:06:19 PM) ivaynberg: its not pretty, but its safe to paste around
> >>>> (09:06:46 PM) ivaynberg: we do that so ajax works properly
> >>>> (09:06:53 PM) ivaynberg: (doesnt lose state when user presses refresh)
> >>>>
> >>>> To have the "clean" URL your page has to be stateless.
> >>>> In ViewPastePage you have two stateful components: Form and AjaxLink
> >>>> Replacing them with their stateless versions: StatessForm and
> StatelessLink
> >>>> leads to the following link when the user clicks "Mark as Spam" link:
> >>>> http://localhost:18081/view/4/?0-1.ILinkListener-markAbuseLink
> >>>>
> >>>> Choose which one you like better ;-)
> >>>>
> >>>>
> >>>>> To our success!
> >>>>>
> >>>>> Mystic Coders, LLC | Code Magic | www.mysticcoders.com
> >>>>>
> >>>>> ANDREW LOMBARDI | andrew@mysticcoders.com
> >>>>> ofc: 714-352-0298
> >>>>> fax: 714-782-6024
> >>>>> cell: 714-697-8046
> >>>>> linked-in: http://www.linkedin.com/in/andrewlombardi
> >>>>> twitter: @kinabalu
> >>>>> facebook: http://www.facebook.com/lombardi
> >>>>> fan mystic: http://www.facebook.com/mysticcoders
> >>>>> flickr: http://www.flickr.com/photos/kinabalu
> >>>>>
> >>>>> Eco-Tip: Printing e-mails is usually a waste.
> >>>>>
> >>>>> --
> >>>>> If this message wasn't addressed to you, don't use, disclose,
> distribute,
> >>>>> print or copy any part of this message
> >>>>>
> >>>>>
> >>>>
> >>>
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >>> For additional commands, e-mail: users-help@wicket.apache.org
> >>>
> >>
> >>
> >> To our success!
> >>
> >> Mystic Coders, LLC | Code Magic | www.mysticcoders.com
> >>
> >> ANDREW LOMBARDI | andrew@mysticcoders.com
> >> ofc: 714-352-0298
> >> fax: 714-782-6024
> >> cell: 714-697-8046
> >> linked-in: http://www.linkedin.com/in/andrewlombardi
> >> twitter: @kinabalu
> >> facebook: http://www.facebook.com/lombardi
> >> fan mystic: http://www.facebook.com/mysticcoders
> >> flickr: http://www.flickr.com/photos/kinabalu
> >>
> >> Eco-Tip: Printing e-mails is usually a waste.
> >>
> >> --
> >> If this message wasn't addressed to you, don't use, disclose,
> distribute, print or copy any part of this message
> >>
> >
> >
> > To our success!
> >
> > Mystic Coders, LLC | Code Magic | www.mysticcoders.com
> >
> > ANDREW LOMBARDI | andrew@mysticcoders.com
> > ofc: 714-352-0298
> > fax: 714-782-6024
> > cell: 714-697-8046
> > linked-in: http://www.linkedin.com/in/andrewlombardi
> > twitter: @kinabalu
> > facebook: http://www.facebook.com/lombardi
> > fan mystic: http://www.facebook.com/mysticcoders
> > flickr: http://www.flickr.com/photos/kinabalu
> >
> > Eco-Tip: Printing e-mails is usually a waste.
> >
> > --
> > If this message wasn't addressed to you, don't use, disclose, distribute,
> print or copy any part of this message
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Added parameters on the end of requests with wicket 1.5

Posted by Andrew Lombardi <an...@mysticcoders.com>.
So my fun with getting /view/{paste-id}/text to be served by a Resource instead of intercepted and using the page as a switchboard is almost 100% happy now.  In the WicketApplication I've done the following to ensure that the Resource is given a compatibilityScore which will rank it higher than the page if it has more segments (custom PriorityResourceMapper http://mysticpaste.com/view/4125)

So in the WicketApplication I have:

        getRootRequestMapperAsCompound().add(new PriorityResourceMapper("/view/${0}/text", new PasteAsTextResource()));

And now /view/{paste-id} goes to the Page, and /view/{paste-id}/text goes to the Resource.  Happy day.

I have a link on the View Paste page which is supposed to link to the resource

I've tried multiple ways of doing this, but none of them look like the mounted URL - which is the point

My last attempt at using the ResourceReference was the following:

        ResourceReference ref = Application.get().getResourceReferenceRegistry().getResourceReference(PasteAsTextResource.class, "pasteAsTextResource", Locale.ENGLISH, null, null, false, false);
        return new ResourceLink<Void>(id, ref, params) {
            @Override
            protected boolean getStatelessHint() {
                return true;
            }
        };

in WicketApplication NOTE: I've also registered the ResourceReference with the ResourceReferenceRegistry just like mountResource does.  But alas, the URL is still not like the mounted URL.

I've settled on for now the following:

        return new ExternalLink(id, "/view/"+params.get("0")+"/text");


The other problem, is any links on the page, for instance, the Report Abuse link, don't respond to click events, like they're disabled?  the resulting HTML looks like this for a StatelessLink

	<a href="?0-1.ILinkListener-markAbuseLink"><span id="markAbuseLabel1">Report Abuse</span></a>


Code is all here: https://github.com/kinabalu/mysticpaste/



Thanks again to marting and ivaynberg for getting me this far :)

On Jan 20, 2011, at 2:13 PM, Igor Vaynberg wrote:

> you should use replacehandler() instead of scheduleaftercurrent, since
> current will render the page.
> 
> but to do it in 1.5 way you would mount a handler on
> /view/${pasteid}/download and one on /view/${pasteid}/text and
> implement streaming there instead of using the page as a switchboard.
> 
> -igor
> 
> On Thu, Jan 20, 2011 at 1:55 PM, Andrew Lombardi
> <an...@mysticcoders.com> wrote:
>> Url's look great now /view/[paste-id]
>> 
>> Next issue.  We have 2 links, one for Raw and the other for Download which suffix the URL with /text and /download respectively like so:
>> 
>> /view/[paste-id]/text
>> /view/[paste-id]/download
>> 
>> in 1.4 I redirected to the SharedResourceReference and all worked dandy.  martin-g helped convert this to the 1.5 way, and the links don't seem to do anything anymore, and if you go to the URL directly, it tries to render the page instead of redirect to the resource straight away.  Here's the code at the top of the ctor:
>> 
>>            if (params.get("1").toString().equals("text")) {
>>                getRequestCycle().scheduleRequestHandlerAfterCurrent(new ResourceReferenceRequestHandler(new SharedResourceReference("textPasteResource")));
>>                return;
>>            } else if (params.get("1").toString().equals("download")) {
>>                getRequestCycle().scheduleRequestHandlerAfterCurrent(new ResourceReferenceRequestHandler(new SharedResourceReference("downloadAsTextPasteResource")));
>>                return;
>>            }
>> 
>> I understand why Wicket is trying to render the page since I'm effectively redirecting there, even if in 1.4 it worked.
>> 
>> Is there a way to register a handler for URL's that suffix /text and /download to be served by the resources directly?
>> 
>> On Jan 20, 2011, at 1:19 PM, Andrew Lombardi wrote:
>> 
>>> Okay, got it.  I'll dump the ajax on that page, and convert it over.  Thanks!
>>> 
>>> On Jan 20, 2011, at 1:00 PM, Igor Vaynberg wrote:
>>> 
>>>> the onclick of the stateless link can redirect back to the
>>>> bookmarkable version, which will clean up the url
>>>> 
>>>> -igor
>>>> 
>>>> On Thu, Jan 20, 2011 at 12:22 PM, Martin Grigorov <mg...@apache.org> wrote:
>>>>> On Thu, Jan 20, 2011 at 6:32 PM, Andrew Lombardi <an...@mysticcoders.com>wrote:
>>>>> 
>>>>>> I've been converting mysticpaste.com to using Wicket 1.5 with the help of
>>>>>> Martin Grigorov :) - the source is available here -
>>>>>> https://github.com/kinabalu/mysticpaste
>>>>>> 
>>>>>> 99% of the way there, and the only remaining issue is that when you paste a
>>>>>> URL with previous versions of Wicket, I properly get  /view/[paste-id] and
>>>>>> that's it
>>>>>> 
>>>>>> With Wicket 1.5 however, it's appending the pagemap number?  So I get
>>>>>> instead /view/[paste-id]?1  -- the page is not stateless, has some ajax
>>>>>> components on it.  But it is important that the URL the users get is just
>>>>>> /view/[paste-id]
>>>>>> 
>>>>>> Here's how I move the user to the view page right now:
>>>>>> 
>>>>>>                    params.add("0", Long.toString(pasteItem.getId()));
>>>>>>                    setResponsePage(ViewPublicPage.class, params);
>>>>>> 
>>>>>> And here's the mount in Application:
>>>>>> 
>>>>>>        mountPage("/view/${0}/${1}", ViewPublicPage.class);
>>>>>> 
>>>>>> 
>>>>>> the ${1} here is for highlighting specific lines
>>>>>> 
>>>>>> Thanks!
>>>>>> 
>>>>>> A brief conversation in IRC:
>>>>> 
>>>>> (09:05:43 PM) ivaynberg: no way to get rid of ?1 for now
>>>>> (09:05:49 PM) ivaynberg: thats the page id i think
>>>>> (09:06:04 PM) martin-g: it is
>>>>> (09:06:07 PM) ivaynberg: urls work like hybrid ones in 1.4
>>>>> (09:06:19 PM) ivaynberg: its not pretty, but its safe to paste around
>>>>> (09:06:46 PM) ivaynberg: we do that so ajax works properly
>>>>> (09:06:53 PM) ivaynberg: (doesnt lose state when user presses refresh)
>>>>> 
>>>>> To have the "clean" URL your page has to be stateless.
>>>>> In ViewPastePage you have two stateful components: Form and AjaxLink
>>>>> Replacing them with their stateless versions: StatessForm and StatelessLink
>>>>> leads to the following link when the user clicks "Mark as Spam" link:
>>>>> http://localhost:18081/view/4/?0-1.ILinkListener-markAbuseLink
>>>>> 
>>>>> Choose which one you like better ;-)
>>>>> 
>>>>> 
>>>>>> To our success!
>>>>>> 
>>>>>> Mystic Coders, LLC | Code Magic | www.mysticcoders.com
>>>>>> 
>>>>>> ANDREW LOMBARDI | andrew@mysticcoders.com
>>>>>> ofc: 714-352-0298
>>>>>> fax: 714-782-6024
>>>>>> cell: 714-697-8046
>>>>>> linked-in: http://www.linkedin.com/in/andrewlombardi
>>>>>> twitter: @kinabalu
>>>>>> facebook: http://www.facebook.com/lombardi
>>>>>> fan mystic: http://www.facebook.com/mysticcoders
>>>>>> flickr: http://www.flickr.com/photos/kinabalu
>>>>>> 
>>>>>> Eco-Tip: Printing e-mails is usually a waste.
>>>>>> 
>>>>>> --
>>>>>> If this message wasn't addressed to you, don't use, disclose, distribute,
>>>>>> print or copy any part of this message
>>>>>> 
>>>>>> 
>>>>> 
>>>> 
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>> 
>>> 
>>> 
>>> To our success!
>>> 
>>> Mystic Coders, LLC | Code Magic | www.mysticcoders.com
>>> 
>>> ANDREW LOMBARDI | andrew@mysticcoders.com
>>> ofc: 714-352-0298
>>> fax: 714-782-6024
>>> cell: 714-697-8046
>>> linked-in: http://www.linkedin.com/in/andrewlombardi
>>> twitter: @kinabalu
>>> facebook: http://www.facebook.com/lombardi
>>> fan mystic: http://www.facebook.com/mysticcoders
>>> flickr: http://www.flickr.com/photos/kinabalu
>>> 
>>> Eco-Tip: Printing e-mails is usually a waste.
>>> 
>>> --
>>> If this message wasn't addressed to you, don't use, disclose, distribute, print or copy any part of this message
>>> 
>> 
>> 
>> To our success!
>> 
>> Mystic Coders, LLC | Code Magic | www.mysticcoders.com
>> 
>> ANDREW LOMBARDI | andrew@mysticcoders.com
>> ofc: 714-352-0298
>> fax: 714-782-6024
>> cell: 714-697-8046
>> linked-in: http://www.linkedin.com/in/andrewlombardi
>> twitter: @kinabalu
>> facebook: http://www.facebook.com/lombardi
>> fan mystic: http://www.facebook.com/mysticcoders
>> flickr: http://www.flickr.com/photos/kinabalu
>> 
>> Eco-Tip: Printing e-mails is usually a waste.
>> 
>> --
>> If this message wasn't addressed to you, don't use, disclose, distribute, print or copy any part of this message
>> 
>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 


To our success!

Mystic Coders, LLC | Code Magic | www.mysticcoders.com

ANDREW LOMBARDI | andrew@mysticcoders.com
ofc: 714-352-0298
fax: 714-782-6024
cell: 714-697-8046
linked-in: http://www.linkedin.com/in/andrewlombardi
twitter: @kinabalu
facebook: http://www.facebook.com/lombardi
fan mystic: http://www.facebook.com/mysticcoders
flickr: http://www.flickr.com/photos/kinabalu

Eco-Tip: Printing e-mails is usually a waste.

--
If this message wasn't addressed to you, don't use, disclose, distribute, print or copy any part of this message


Re: Added parameters on the end of requests with wicket 1.5

Posted by Igor Vaynberg <ig...@gmail.com>.
you should use replacehandler() instead of scheduleaftercurrent, since
current will render the page.

but to do it in 1.5 way you would mount a handler on
/view/${pasteid}/download and one on /view/${pasteid}/text and
implement streaming there instead of using the page as a switchboard.

-igor

On Thu, Jan 20, 2011 at 1:55 PM, Andrew Lombardi
<an...@mysticcoders.com> wrote:
> Url's look great now /view/[paste-id]
>
> Next issue.  We have 2 links, one for Raw and the other for Download which suffix the URL with /text and /download respectively like so:
>
> /view/[paste-id]/text
> /view/[paste-id]/download
>
> in 1.4 I redirected to the SharedResourceReference and all worked dandy.  martin-g helped convert this to the 1.5 way, and the links don't seem to do anything anymore, and if you go to the URL directly, it tries to render the page instead of redirect to the resource straight away.  Here's the code at the top of the ctor:
>
>            if (params.get("1").toString().equals("text")) {
>                getRequestCycle().scheduleRequestHandlerAfterCurrent(new ResourceReferenceRequestHandler(new SharedResourceReference("textPasteResource")));
>                return;
>            } else if (params.get("1").toString().equals("download")) {
>                getRequestCycle().scheduleRequestHandlerAfterCurrent(new ResourceReferenceRequestHandler(new SharedResourceReference("downloadAsTextPasteResource")));
>                return;
>            }
>
> I understand why Wicket is trying to render the page since I'm effectively redirecting there, even if in 1.4 it worked.
>
> Is there a way to register a handler for URL's that suffix /text and /download to be served by the resources directly?
>
> On Jan 20, 2011, at 1:19 PM, Andrew Lombardi wrote:
>
>> Okay, got it.  I'll dump the ajax on that page, and convert it over.  Thanks!
>>
>> On Jan 20, 2011, at 1:00 PM, Igor Vaynberg wrote:
>>
>>> the onclick of the stateless link can redirect back to the
>>> bookmarkable version, which will clean up the url
>>>
>>> -igor
>>>
>>> On Thu, Jan 20, 2011 at 12:22 PM, Martin Grigorov <mg...@apache.org> wrote:
>>>> On Thu, Jan 20, 2011 at 6:32 PM, Andrew Lombardi <an...@mysticcoders.com>wrote:
>>>>
>>>>> I've been converting mysticpaste.com to using Wicket 1.5 with the help of
>>>>> Martin Grigorov :) - the source is available here -
>>>>> https://github.com/kinabalu/mysticpaste
>>>>>
>>>>> 99% of the way there, and the only remaining issue is that when you paste a
>>>>> URL with previous versions of Wicket, I properly get  /view/[paste-id] and
>>>>> that's it
>>>>>
>>>>> With Wicket 1.5 however, it's appending the pagemap number?  So I get
>>>>> instead /view/[paste-id]?1  -- the page is not stateless, has some ajax
>>>>> components on it.  But it is important that the URL the users get is just
>>>>> /view/[paste-id]
>>>>>
>>>>> Here's how I move the user to the view page right now:
>>>>>
>>>>>                    params.add("0", Long.toString(pasteItem.getId()));
>>>>>                    setResponsePage(ViewPublicPage.class, params);
>>>>>
>>>>> And here's the mount in Application:
>>>>>
>>>>>        mountPage("/view/${0}/${1}", ViewPublicPage.class);
>>>>>
>>>>>
>>>>> the ${1} here is for highlighting specific lines
>>>>>
>>>>> Thanks!
>>>>>
>>>>> A brief conversation in IRC:
>>>>
>>>> (09:05:43 PM) ivaynberg: no way to get rid of ?1 for now
>>>> (09:05:49 PM) ivaynberg: thats the page id i think
>>>> (09:06:04 PM) martin-g: it is
>>>> (09:06:07 PM) ivaynberg: urls work like hybrid ones in 1.4
>>>> (09:06:19 PM) ivaynberg: its not pretty, but its safe to paste around
>>>> (09:06:46 PM) ivaynberg: we do that so ajax works properly
>>>> (09:06:53 PM) ivaynberg: (doesnt lose state when user presses refresh)
>>>>
>>>> To have the "clean" URL your page has to be stateless.
>>>> In ViewPastePage you have two stateful components: Form and AjaxLink
>>>> Replacing them with their stateless versions: StatessForm and StatelessLink
>>>> leads to the following link when the user clicks "Mark as Spam" link:
>>>> http://localhost:18081/view/4/?0-1.ILinkListener-markAbuseLink
>>>>
>>>> Choose which one you like better ;-)
>>>>
>>>>
>>>>> To our success!
>>>>>
>>>>> Mystic Coders, LLC | Code Magic | www.mysticcoders.com
>>>>>
>>>>> ANDREW LOMBARDI | andrew@mysticcoders.com
>>>>> ofc: 714-352-0298
>>>>> fax: 714-782-6024
>>>>> cell: 714-697-8046
>>>>> linked-in: http://www.linkedin.com/in/andrewlombardi
>>>>> twitter: @kinabalu
>>>>> facebook: http://www.facebook.com/lombardi
>>>>> fan mystic: http://www.facebook.com/mysticcoders
>>>>> flickr: http://www.flickr.com/photos/kinabalu
>>>>>
>>>>> Eco-Tip: Printing e-mails is usually a waste.
>>>>>
>>>>> --
>>>>> If this message wasn't addressed to you, don't use, disclose, distribute,
>>>>> print or copy any part of this message
>>>>>
>>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>
>>
>> To our success!
>>
>> Mystic Coders, LLC | Code Magic | www.mysticcoders.com
>>
>> ANDREW LOMBARDI | andrew@mysticcoders.com
>> ofc: 714-352-0298
>> fax: 714-782-6024
>> cell: 714-697-8046
>> linked-in: http://www.linkedin.com/in/andrewlombardi
>> twitter: @kinabalu
>> facebook: http://www.facebook.com/lombardi
>> fan mystic: http://www.facebook.com/mysticcoders
>> flickr: http://www.flickr.com/photos/kinabalu
>>
>> Eco-Tip: Printing e-mails is usually a waste.
>>
>> --
>> If this message wasn't addressed to you, don't use, disclose, distribute, print or copy any part of this message
>>
>
>
> To our success!
>
> Mystic Coders, LLC | Code Magic | www.mysticcoders.com
>
> ANDREW LOMBARDI | andrew@mysticcoders.com
> ofc: 714-352-0298
> fax: 714-782-6024
> cell: 714-697-8046
> linked-in: http://www.linkedin.com/in/andrewlombardi
> twitter: @kinabalu
> facebook: http://www.facebook.com/lombardi
> fan mystic: http://www.facebook.com/mysticcoders
> flickr: http://www.flickr.com/photos/kinabalu
>
> Eco-Tip: Printing e-mails is usually a waste.
>
> --
> If this message wasn't addressed to you, don't use, disclose, distribute, print or copy any part of this message
>
>

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


Re: Added parameters on the end of requests with wicket 1.5

Posted by Andrew Lombardi <an...@mysticcoders.com>.
Url's look great now /view/[paste-id]

Next issue.  We have 2 links, one for Raw and the other for Download which suffix the URL with /text and /download respectively like so:

/view/[paste-id]/text
/view/[paste-id]/download

in 1.4 I redirected to the SharedResourceReference and all worked dandy.  martin-g helped convert this to the 1.5 way, and the links don't seem to do anything anymore, and if you go to the URL directly, it tries to render the page instead of redirect to the resource straight away.  Here's the code at the top of the ctor:

            if (params.get("1").toString().equals("text")) {
                getRequestCycle().scheduleRequestHandlerAfterCurrent(new ResourceReferenceRequestHandler(new SharedResourceReference("textPasteResource")));
                return;
            } else if (params.get("1").toString().equals("download")) {
                getRequestCycle().scheduleRequestHandlerAfterCurrent(new ResourceReferenceRequestHandler(new SharedResourceReference("downloadAsTextPasteResource")));
                return;
            }

I understand why Wicket is trying to render the page since I'm effectively redirecting there, even if in 1.4 it worked.

Is there a way to register a handler for URL's that suffix /text and /download to be served by the resources directly?  

On Jan 20, 2011, at 1:19 PM, Andrew Lombardi wrote:

> Okay, got it.  I'll dump the ajax on that page, and convert it over.  Thanks!
> 
> On Jan 20, 2011, at 1:00 PM, Igor Vaynberg wrote:
> 
>> the onclick of the stateless link can redirect back to the
>> bookmarkable version, which will clean up the url
>> 
>> -igor
>> 
>> On Thu, Jan 20, 2011 at 12:22 PM, Martin Grigorov <mg...@apache.org> wrote:
>>> On Thu, Jan 20, 2011 at 6:32 PM, Andrew Lombardi <an...@mysticcoders.com>wrote:
>>> 
>>>> I've been converting mysticpaste.com to using Wicket 1.5 with the help of
>>>> Martin Grigorov :) - the source is available here -
>>>> https://github.com/kinabalu/mysticpaste
>>>> 
>>>> 99% of the way there, and the only remaining issue is that when you paste a
>>>> URL with previous versions of Wicket, I properly get  /view/[paste-id] and
>>>> that's it
>>>> 
>>>> With Wicket 1.5 however, it's appending the pagemap number?  So I get
>>>> instead /view/[paste-id]?1  -- the page is not stateless, has some ajax
>>>> components on it.  But it is important that the URL the users get is just
>>>> /view/[paste-id]
>>>> 
>>>> Here's how I move the user to the view page right now:
>>>> 
>>>>                    params.add("0", Long.toString(pasteItem.getId()));
>>>>                    setResponsePage(ViewPublicPage.class, params);
>>>> 
>>>> And here's the mount in Application:
>>>> 
>>>>        mountPage("/view/${0}/${1}", ViewPublicPage.class);
>>>> 
>>>> 
>>>> the ${1} here is for highlighting specific lines
>>>> 
>>>> Thanks!
>>>> 
>>>> A brief conversation in IRC:
>>> 
>>> (09:05:43 PM) ivaynberg: no way to get rid of ?1 for now
>>> (09:05:49 PM) ivaynberg: thats the page id i think
>>> (09:06:04 PM) martin-g: it is
>>> (09:06:07 PM) ivaynberg: urls work like hybrid ones in 1.4
>>> (09:06:19 PM) ivaynberg: its not pretty, but its safe to paste around
>>> (09:06:46 PM) ivaynberg: we do that so ajax works properly
>>> (09:06:53 PM) ivaynberg: (doesnt lose state when user presses refresh)
>>> 
>>> To have the "clean" URL your page has to be stateless.
>>> In ViewPastePage you have two stateful components: Form and AjaxLink
>>> Replacing them with their stateless versions: StatessForm and StatelessLink
>>> leads to the following link when the user clicks "Mark as Spam" link:
>>> http://localhost:18081/view/4/?0-1.ILinkListener-markAbuseLink
>>> 
>>> Choose which one you like better ;-)
>>> 
>>> 
>>>> To our success!
>>>> 
>>>> Mystic Coders, LLC | Code Magic | www.mysticcoders.com
>>>> 
>>>> ANDREW LOMBARDI | andrew@mysticcoders.com
>>>> ofc: 714-352-0298
>>>> fax: 714-782-6024
>>>> cell: 714-697-8046
>>>> linked-in: http://www.linkedin.com/in/andrewlombardi
>>>> twitter: @kinabalu
>>>> facebook: http://www.facebook.com/lombardi
>>>> fan mystic: http://www.facebook.com/mysticcoders
>>>> flickr: http://www.flickr.com/photos/kinabalu
>>>> 
>>>> Eco-Tip: Printing e-mails is usually a waste.
>>>> 
>>>> --
>>>> If this message wasn't addressed to you, don't use, disclose, distribute,
>>>> print or copy any part of this message
>>>> 
>>>> 
>>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>> 
> 
> 
> To our success!
> 
> Mystic Coders, LLC | Code Magic | www.mysticcoders.com
> 
> ANDREW LOMBARDI | andrew@mysticcoders.com
> ofc: 714-352-0298
> fax: 714-782-6024
> cell: 714-697-8046
> linked-in: http://www.linkedin.com/in/andrewlombardi
> twitter: @kinabalu
> facebook: http://www.facebook.com/lombardi
> fan mystic: http://www.facebook.com/mysticcoders
> flickr: http://www.flickr.com/photos/kinabalu
> 
> Eco-Tip: Printing e-mails is usually a waste.
> 
> --
> If this message wasn't addressed to you, don't use, disclose, distribute, print or copy any part of this message
> 


To our success!

Mystic Coders, LLC | Code Magic | www.mysticcoders.com

ANDREW LOMBARDI | andrew@mysticcoders.com
ofc: 714-352-0298
fax: 714-782-6024
cell: 714-697-8046
linked-in: http://www.linkedin.com/in/andrewlombardi
twitter: @kinabalu
facebook: http://www.facebook.com/lombardi
fan mystic: http://www.facebook.com/mysticcoders
flickr: http://www.flickr.com/photos/kinabalu

Eco-Tip: Printing e-mails is usually a waste.

--
If this message wasn't addressed to you, don't use, disclose, distribute, print or copy any part of this message


Re: Added parameters on the end of requests with wicket 1.5

Posted by Andrew Lombardi <an...@mysticcoders.com>.
Okay, got it.  I'll dump the ajax on that page, and convert it over.  Thanks!

On Jan 20, 2011, at 1:00 PM, Igor Vaynberg wrote:

> the onclick of the stateless link can redirect back to the
> bookmarkable version, which will clean up the url
> 
> -igor
> 
> On Thu, Jan 20, 2011 at 12:22 PM, Martin Grigorov <mg...@apache.org> wrote:
>> On Thu, Jan 20, 2011 at 6:32 PM, Andrew Lombardi <an...@mysticcoders.com>wrote:
>> 
>>> I've been converting mysticpaste.com to using Wicket 1.5 with the help of
>>> Martin Grigorov :) - the source is available here -
>>> https://github.com/kinabalu/mysticpaste
>>> 
>>> 99% of the way there, and the only remaining issue is that when you paste a
>>> URL with previous versions of Wicket, I properly get  /view/[paste-id] and
>>> that's it
>>> 
>>> With Wicket 1.5 however, it's appending the pagemap number?  So I get
>>> instead /view/[paste-id]?1  -- the page is not stateless, has some ajax
>>> components on it.  But it is important that the URL the users get is just
>>> /view/[paste-id]
>>> 
>>> Here's how I move the user to the view page right now:
>>> 
>>>                    params.add("0", Long.toString(pasteItem.getId()));
>>>                    setResponsePage(ViewPublicPage.class, params);
>>> 
>>> And here's the mount in Application:
>>> 
>>>        mountPage("/view/${0}/${1}", ViewPublicPage.class);
>>> 
>>> 
>>> the ${1} here is for highlighting specific lines
>>> 
>>> Thanks!
>>> 
>>> A brief conversation in IRC:
>> 
>> (09:05:43 PM) ivaynberg: no way to get rid of ?1 for now
>> (09:05:49 PM) ivaynberg: thats the page id i think
>> (09:06:04 PM) martin-g: it is
>> (09:06:07 PM) ivaynberg: urls work like hybrid ones in 1.4
>> (09:06:19 PM) ivaynberg: its not pretty, but its safe to paste around
>> (09:06:46 PM) ivaynberg: we do that so ajax works properly
>> (09:06:53 PM) ivaynberg: (doesnt lose state when user presses refresh)
>> 
>> To have the "clean" URL your page has to be stateless.
>> In ViewPastePage you have two stateful components: Form and AjaxLink
>> Replacing them with their stateless versions: StatessForm and StatelessLink
>> leads to the following link when the user clicks "Mark as Spam" link:
>> http://localhost:18081/view/4/?0-1.ILinkListener-markAbuseLink
>> 
>> Choose which one you like better ;-)
>> 
>> 
>>> To our success!
>>> 
>>> Mystic Coders, LLC | Code Magic | www.mysticcoders.com
>>> 
>>> ANDREW LOMBARDI | andrew@mysticcoders.com
>>> ofc: 714-352-0298
>>> fax: 714-782-6024
>>> cell: 714-697-8046
>>> linked-in: http://www.linkedin.com/in/andrewlombardi
>>> twitter: @kinabalu
>>> facebook: http://www.facebook.com/lombardi
>>> fan mystic: http://www.facebook.com/mysticcoders
>>> flickr: http://www.flickr.com/photos/kinabalu
>>> 
>>> Eco-Tip: Printing e-mails is usually a waste.
>>> 
>>> --
>>> If this message wasn't addressed to you, don't use, disclose, distribute,
>>> print or copy any part of this message
>>> 
>>> 
>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 


To our success!

Mystic Coders, LLC | Code Magic | www.mysticcoders.com

ANDREW LOMBARDI | andrew@mysticcoders.com
ofc: 714-352-0298
fax: 714-782-6024
cell: 714-697-8046
linked-in: http://www.linkedin.com/in/andrewlombardi
twitter: @kinabalu
facebook: http://www.facebook.com/lombardi
fan mystic: http://www.facebook.com/mysticcoders
flickr: http://www.flickr.com/photos/kinabalu

Eco-Tip: Printing e-mails is usually a waste.

--
If this message wasn't addressed to you, don't use, disclose, distribute, print or copy any part of this message


Re: Added parameters on the end of requests with wicket 1.5

Posted by Igor Vaynberg <ig...@gmail.com>.
the onclick of the stateless link can redirect back to the
bookmarkable version, which will clean up the url

-igor

On Thu, Jan 20, 2011 at 12:22 PM, Martin Grigorov <mg...@apache.org> wrote:
> On Thu, Jan 20, 2011 at 6:32 PM, Andrew Lombardi <an...@mysticcoders.com>wrote:
>
>> I've been converting mysticpaste.com to using Wicket 1.5 with the help of
>> Martin Grigorov :) - the source is available here -
>> https://github.com/kinabalu/mysticpaste
>>
>> 99% of the way there, and the only remaining issue is that when you paste a
>> URL with previous versions of Wicket, I properly get  /view/[paste-id] and
>> that's it
>>
>> With Wicket 1.5 however, it's appending the pagemap number?  So I get
>> instead /view/[paste-id]?1  -- the page is not stateless, has some ajax
>> components on it.  But it is important that the URL the users get is just
>> /view/[paste-id]
>>
>> Here's how I move the user to the view page right now:
>>
>>                    params.add("0", Long.toString(pasteItem.getId()));
>>                    setResponsePage(ViewPublicPage.class, params);
>>
>> And here's the mount in Application:
>>
>>        mountPage("/view/${0}/${1}", ViewPublicPage.class);
>>
>>
>> the ${1} here is for highlighting specific lines
>>
>> Thanks!
>>
>> A brief conversation in IRC:
>
> (09:05:43 PM) ivaynberg: no way to get rid of ?1 for now
> (09:05:49 PM) ivaynberg: thats the page id i think
> (09:06:04 PM) martin-g: it is
> (09:06:07 PM) ivaynberg: urls work like hybrid ones in 1.4
> (09:06:19 PM) ivaynberg: its not pretty, but its safe to paste around
> (09:06:46 PM) ivaynberg: we do that so ajax works properly
> (09:06:53 PM) ivaynberg: (doesnt lose state when user presses refresh)
>
> To have the "clean" URL your page has to be stateless.
> In ViewPastePage you have two stateful components: Form and AjaxLink
> Replacing them with their stateless versions: StatessForm and StatelessLink
> leads to the following link when the user clicks "Mark as Spam" link:
> http://localhost:18081/view/4/?0-1.ILinkListener-markAbuseLink
>
> Choose which one you like better ;-)
>
>
>> To our success!
>>
>> Mystic Coders, LLC | Code Magic | www.mysticcoders.com
>>
>> ANDREW LOMBARDI | andrew@mysticcoders.com
>> ofc: 714-352-0298
>> fax: 714-782-6024
>> cell: 714-697-8046
>> linked-in: http://www.linkedin.com/in/andrewlombardi
>> twitter: @kinabalu
>> facebook: http://www.facebook.com/lombardi
>> fan mystic: http://www.facebook.com/mysticcoders
>> flickr: http://www.flickr.com/photos/kinabalu
>>
>> Eco-Tip: Printing e-mails is usually a waste.
>>
>> --
>> If this message wasn't addressed to you, don't use, disclose, distribute,
>> print or copy any part of this message
>>
>>
>

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


Re: Added parameters on the end of requests with wicket 1.5

Posted by Martin Grigorov <mg...@apache.org>.
On Thu, Jan 20, 2011 at 6:32 PM, Andrew Lombardi <an...@mysticcoders.com>wrote:

> I've been converting mysticpaste.com to using Wicket 1.5 with the help of
> Martin Grigorov :) - the source is available here -
> https://github.com/kinabalu/mysticpaste
>
> 99% of the way there, and the only remaining issue is that when you paste a
> URL with previous versions of Wicket, I properly get  /view/[paste-id] and
> that's it
>
> With Wicket 1.5 however, it's appending the pagemap number?  So I get
> instead /view/[paste-id]?1  -- the page is not stateless, has some ajax
> components on it.  But it is important that the URL the users get is just
> /view/[paste-id]
>
> Here's how I move the user to the view page right now:
>
>                    params.add("0", Long.toString(pasteItem.getId()));
>                    setResponsePage(ViewPublicPage.class, params);
>
> And here's the mount in Application:
>
>        mountPage("/view/${0}/${1}", ViewPublicPage.class);
>
>
> the ${1} here is for highlighting specific lines
>
> Thanks!
>
> A brief conversation in IRC:

(09:05:43 PM) ivaynberg: no way to get rid of ?1 for now
(09:05:49 PM) ivaynberg: thats the page id i think
(09:06:04 PM) martin-g: it is
(09:06:07 PM) ivaynberg: urls work like hybrid ones in 1.4
(09:06:19 PM) ivaynberg: its not pretty, but its safe to paste around
(09:06:46 PM) ivaynberg: we do that so ajax works properly
(09:06:53 PM) ivaynberg: (doesnt lose state when user presses refresh)

To have the "clean" URL your page has to be stateless.
In ViewPastePage you have two stateful components: Form and AjaxLink
Replacing them with their stateless versions: StatessForm and StatelessLink
leads to the following link when the user clicks "Mark as Spam" link:
http://localhost:18081/view/4/?0-1.ILinkListener-markAbuseLink

Choose which one you like better ;-)


> To our success!
>
> Mystic Coders, LLC | Code Magic | www.mysticcoders.com
>
> ANDREW LOMBARDI | andrew@mysticcoders.com
> ofc: 714-352-0298
> fax: 714-782-6024
> cell: 714-697-8046
> linked-in: http://www.linkedin.com/in/andrewlombardi
> twitter: @kinabalu
> facebook: http://www.facebook.com/lombardi
> fan mystic: http://www.facebook.com/mysticcoders
> flickr: http://www.flickr.com/photos/kinabalu
>
> Eco-Tip: Printing e-mails is usually a waste.
>
> --
> If this message wasn't addressed to you, don't use, disclose, distribute,
> print or copy any part of this message
>
>