You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Allen Gilbert <al...@doane.edu> on 2011/12/06 03:06:31 UTC

Hide page version query parameters

Is there a built-in way to hide page version parameters (e.g. ?12) in
Wicket 1.5?  If not, is it possible to write a custom IRequestMapper that
does so without screwing up proper request handling?

-Allen

Re: Hide page version query parameters

Posted by armhold <ar...@gmail.com>.
You can also add a <link rel="canonical"
href="http://example.com/your-canonical-url"/> to the head to instruct the
search engines to find the proper page.

(warning- video auto-plays on this google link:)

http://support.google.com/webmasters/bin/answer.py?hl=en&answer=139394



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Hide-page-version-query-parameters-tp4163099p4260728.html
Sent from the Users forum 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: Hide page version query parameters

Posted by Taneli Korri <tk...@gmail.com>.
On Tue, Jan 3, 2012 at 1:20 AM, Igor Vaynberg <ig...@gmail.com> wrote:
> add the nofollow attribute to such links.
>

All the links had it from the start. The crawlers from the big
companies (Google, Bing etc) obey it, but some smaller ones do not.

Anyways, I fixed the problem by filtering the bad parameters with
urlrewritefilter. So no more internal server errors.

Regards,
Taneli Korri

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


Re: Hide page version query parameters

Posted by Igor Vaynberg <ig...@gmail.com>.
add the nofollow attribute to such links.

-igor

On Mon, Jan 2, 2012 at 11:05 AM, Taneli Korri <tk...@gmail.com> wrote:
> On Mon, Jan 2, 2012 at 9:47 AM, Martin Grigorov <mg...@apache.org> wrote:
>> On Mon, Jan 2, 2012 at 8:18 AM, Taneli Korri <tk...@gmail.com> wrote:
>>> On Sat, Dec 31, 2011 at 4:31 PM, Martin Grigorov <mg...@apache.org> wrote:
>>>> On Sat, Dec 31, 2011 at 2:29 PM, Taneli Korri <tk...@gmail.com> wrote:
>>>>> On Sat, Dec 31, 2011 at 9:09 AM, Martin Grigorov <mg...@apache.org> wrote:
>>>>>> On Fri, Dec 30, 2011 at 11:43 PM, martin.dilger
>>>>>> <ma...@googlemail.com> wrote:
>>>>>>> hi,
>>>>>>> you could try to change your render strategy to redirect to render, that
>>>>>>> would dismiss the page
>>>>>>> parameters version.
>>>>>>
>>>>>> This is not correct.
>>>>>> The page id is encoded in the url only for stateful pages. Make your
>>>>>> page stateless and it wont be there.
>>>>>>
>>>>>
>>>>> OK, thanks for the info.
>>>>>
>>>>> If I remember correctly, in Wicket 1.4 stateful pages had also clean
>>>>> urls if the page was mounted to a certain path, i.e. the page version
>>>>> number was stored somewhere behind the scenes. I'm guessing this isn't
>>>>> possible anymore in Wicket 1.5?
>>>>
>>>> Everything is possible.
>>>> The new IRequestMapper are easily extensible and you can even use your own one.
>>>> By default this special parameter is set so when the user presses F5
>>>> (Refresh) the page Wicket will deliver the same version of the page.
>>>> Otherwise a new instance will be created without the knowledge of the
>>>> exact version.
>>>>
>>>> Why do you want to hide this parameter ?
>>>>
>>>
>>> Plain and simple, I like clean urls that can be bookmarked.
>>
>> The urls with the page id can be bookmarked. If the requested version
>> of the page is not available then a new version is created and
>> delivered.
>>
>
> Ok, I think I can live with that. :)
>
>>>
>>> Also some of the search engine bots save the crawled urls (with
>>> parameters) and try to access them at a later time. I found this out
>>> when I updated one of my sites and now I'm seeing a lot of 500
>>> Internal error responses in my web server logs.
>>
>> Can you paste the stacktrace of an exception caused by such request ?
>>
>
> I should have been more clear, this case wasn't directly related to
> the page version parameter, but to clean urls.
>
> The thing is that I had a few stateful links in the frontpage which
> changed the page stylesheet. Now when I have removed the links, I'm
> seeing some crawlers still trying to request them.
>
> For example, a get request to
> /?0-1.ILinkListener-stylechooser-style1&wicket:interface=:1:stylechooser:style2::ILinkListener::
> throws this with Wicket 1.5.3:
>
> ERROR org.apache.wicket.DefaultExceptionMapper  - Unexpected error occurred
> org.apache.wicket.request.handler.ComponentNotFoundException: Could
> not find component 'stylechooser:style1' on page 'class
> net.korri.www.page.blog.BlogPage
>        at org.apache.wicket.request.handler.PageAndComponentProvider.getComponent(PageAndComponentProvider.java:167)
>        at org.apache.wicket.request.handler.ListenerInterfaceRequestHandler.getComponent(ListenerInterfaceRequestHandler.java:92)
>        at org.apache.wicket.request.handler.ListenerInterfaceRequestHandler.invokeListener(ListenerInterfaceRequestHandler.java:248)
>        at org.apache.wicket.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:234)
>        at org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:750)
>        at org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
>        at org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:252)
>        at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:209)
>        at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:280)
>        at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:162)
>        at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:218)
>        at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:87)
>        at org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:176)
>        at org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145)
>        at org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92)
>        at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:381)
>        at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:87)
>        at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:187)
>        at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:265)
>        at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:273)
>        at com.caucho.server.port.TcpConnection.run(TcpConnection.java:682)
>        at com.caucho.util.ThreadPool$Item.runTasks(ThreadPool.java:743)
>        at com.caucho.util.ThreadPool$Item.run(ThreadPool.java:662)
>        at java.lang.Thread.run(Thread.java:662)
>
> The request was valid earlier, but now since I've changed the site
> there's no stylechooser component anymore.
>
> Regards,
> Taneli Korri
>
> ---------------------------------------------------------------------
> 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: Hide page version query parameters

Posted by Taneli Korri <tk...@gmail.com>.
On Mon, Jan 2, 2012 at 9:47 AM, Martin Grigorov <mg...@apache.org> wrote:
> On Mon, Jan 2, 2012 at 8:18 AM, Taneli Korri <tk...@gmail.com> wrote:
>> On Sat, Dec 31, 2011 at 4:31 PM, Martin Grigorov <mg...@apache.org> wrote:
>>> On Sat, Dec 31, 2011 at 2:29 PM, Taneli Korri <tk...@gmail.com> wrote:
>>>> On Sat, Dec 31, 2011 at 9:09 AM, Martin Grigorov <mg...@apache.org> wrote:
>>>>> On Fri, Dec 30, 2011 at 11:43 PM, martin.dilger
>>>>> <ma...@googlemail.com> wrote:
>>>>>> hi,
>>>>>> you could try to change your render strategy to redirect to render, that
>>>>>> would dismiss the page
>>>>>> parameters version.
>>>>>
>>>>> This is not correct.
>>>>> The page id is encoded in the url only for stateful pages. Make your
>>>>> page stateless and it wont be there.
>>>>>
>>>>
>>>> OK, thanks for the info.
>>>>
>>>> If I remember correctly, in Wicket 1.4 stateful pages had also clean
>>>> urls if the page was mounted to a certain path, i.e. the page version
>>>> number was stored somewhere behind the scenes. I'm guessing this isn't
>>>> possible anymore in Wicket 1.5?
>>>
>>> Everything is possible.
>>> The new IRequestMapper are easily extensible and you can even use your own one.
>>> By default this special parameter is set so when the user presses F5
>>> (Refresh) the page Wicket will deliver the same version of the page.
>>> Otherwise a new instance will be created without the knowledge of the
>>> exact version.
>>>
>>> Why do you want to hide this parameter ?
>>>
>>
>> Plain and simple, I like clean urls that can be bookmarked.
>
> The urls with the page id can be bookmarked. If the requested version
> of the page is not available then a new version is created and
> delivered.
>

Ok, I think I can live with that. :)

>>
>> Also some of the search engine bots save the crawled urls (with
>> parameters) and try to access them at a later time. I found this out
>> when I updated one of my sites and now I'm seeing a lot of 500
>> Internal error responses in my web server logs.
>
> Can you paste the stacktrace of an exception caused by such request ?
>

I should have been more clear, this case wasn't directly related to
the page version parameter, but to clean urls.

The thing is that I had a few stateful links in the frontpage which
changed the page stylesheet. Now when I have removed the links, I'm
seeing some crawlers still trying to request them.

For example, a get request to
/?0-1.ILinkListener-stylechooser-style1&wicket:interface=:1:stylechooser:style2::ILinkListener::
throws this with Wicket 1.5.3:

ERROR org.apache.wicket.DefaultExceptionMapper  - Unexpected error occurred
org.apache.wicket.request.handler.ComponentNotFoundException: Could
not find component 'stylechooser:style1' on page 'class
net.korri.www.page.blog.BlogPage
        at org.apache.wicket.request.handler.PageAndComponentProvider.getComponent(PageAndComponentProvider.java:167)
        at org.apache.wicket.request.handler.ListenerInterfaceRequestHandler.getComponent(ListenerInterfaceRequestHandler.java:92)
        at org.apache.wicket.request.handler.ListenerInterfaceRequestHandler.invokeListener(ListenerInterfaceRequestHandler.java:248)
        at org.apache.wicket.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:234)
        at org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:750)
        at org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
        at org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:252)
        at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:209)
        at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:280)
        at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:162)
        at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:218)
        at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:87)
        at org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:176)
        at org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145)
        at org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92)
        at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:381)
        at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:87)
        at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:187)
        at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:265)
        at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:273)
        at com.caucho.server.port.TcpConnection.run(TcpConnection.java:682)
        at com.caucho.util.ThreadPool$Item.runTasks(ThreadPool.java:743)
        at com.caucho.util.ThreadPool$Item.run(ThreadPool.java:662)
        at java.lang.Thread.run(Thread.java:662)

The request was valid earlier, but now since I've changed the site
there's no stylechooser component anymore.

Regards,
Taneli Korri

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


Re: Hide page version query parameters

Posted by Martin Grigorov <mg...@apache.org>.
On Mon, Jan 2, 2012 at 8:18 AM, Taneli Korri <tk...@gmail.com> wrote:
> On Sat, Dec 31, 2011 at 4:31 PM, Martin Grigorov <mg...@apache.org> wrote:
>> On Sat, Dec 31, 2011 at 2:29 PM, Taneli Korri <tk...@gmail.com> wrote:
>>> On Sat, Dec 31, 2011 at 9:09 AM, Martin Grigorov <mg...@apache.org> wrote:
>>>> On Fri, Dec 30, 2011 at 11:43 PM, martin.dilger
>>>> <ma...@googlemail.com> wrote:
>>>>> hi,
>>>>> you could try to change your render strategy to redirect to render, that
>>>>> would dismiss the page
>>>>> parameters version.
>>>>
>>>> This is not correct.
>>>> The page id is encoded in the url only for stateful pages. Make your
>>>> page stateless and it wont be there.
>>>>
>>>
>>> OK, thanks for the info.
>>>
>>> If I remember correctly, in Wicket 1.4 stateful pages had also clean
>>> urls if the page was mounted to a certain path, i.e. the page version
>>> number was stored somewhere behind the scenes. I'm guessing this isn't
>>> possible anymore in Wicket 1.5?
>>
>> Everything is possible.
>> The new IRequestMapper are easily extensible and you can even use your own one.
>> By default this special parameter is set so when the user presses F5
>> (Refresh) the page Wicket will deliver the same version of the page.
>> Otherwise a new instance will be created without the knowledge of the
>> exact version.
>>
>> Why do you want to hide this parameter ?
>>
>
> Plain and simple, I like clean urls that can be bookmarked.

The urls with the page id can be bookmarked. If the requested version
of the page is not available then a new version is created and
delivered.

>
> Also some of the search engine bots save the crawled urls (with
> parameters) and try to access them at a later time. I found this out
> when I updated one of my sites and now I'm seeing a lot of 500
> Internal error responses in my web server logs.

Can you paste the stacktrace of an exception caused by such request ?

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



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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


Re: Hide page version query parameters

Posted by Taneli Korri <tk...@gmail.com>.
On Sat, Dec 31, 2011 at 4:31 PM, Martin Grigorov <mg...@apache.org> wrote:
> On Sat, Dec 31, 2011 at 2:29 PM, Taneli Korri <tk...@gmail.com> wrote:
>> On Sat, Dec 31, 2011 at 9:09 AM, Martin Grigorov <mg...@apache.org> wrote:
>>> On Fri, Dec 30, 2011 at 11:43 PM, martin.dilger
>>> <ma...@googlemail.com> wrote:
>>>> hi,
>>>> you could try to change your render strategy to redirect to render, that
>>>> would dismiss the page
>>>> parameters version.
>>>
>>> This is not correct.
>>> The page id is encoded in the url only for stateful pages. Make your
>>> page stateless and it wont be there.
>>>
>>
>> OK, thanks for the info.
>>
>> If I remember correctly, in Wicket 1.4 stateful pages had also clean
>> urls if the page was mounted to a certain path, i.e. the page version
>> number was stored somewhere behind the scenes. I'm guessing this isn't
>> possible anymore in Wicket 1.5?
>
> Everything is possible.
> The new IRequestMapper are easily extensible and you can even use your own one.
> By default this special parameter is set so when the user presses F5
> (Refresh) the page Wicket will deliver the same version of the page.
> Otherwise a new instance will be created without the knowledge of the
> exact version.
>
> Why do you want to hide this parameter ?
>

Plain and simple, I like clean urls that can be bookmarked.

Also some of the search engine bots save the crawled urls (with
parameters) and try to access them at a later time. I found this out
when I updated one of my sites and now I'm seeing a lot of 500
Internal error responses in my web server logs.

Regards,
Taneli Korri

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


Re: Hide page version query parameters

Posted by "martin.dilger" <ma...@googlemail.com>.
Yes, thats right, stateless pages do not have version number,  
but normally it is not so easy to make pages stateless, we always had
problems with that.

But if you change your render strategy to redirect to render, the uri in the
browser does not change and you always have clean uris. Thats how we solved
the problem.

Just try this in your Applications init Method:
getRequestCycleSettings().setRenderStrategy(RenderStrategy.REDIRECT_TO_RENDER);

You should be aware of the side effects of different render strategies, just
look in Javadoc of RenderStrategy.

Regards

MArtin

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Hide-page-version-query-parameters-tp4163099p4251018.html
Sent from the Users forum 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: Hide page version query parameters

Posted by Martin Grigorov <mg...@apache.org>.
On Sat, Dec 31, 2011 at 2:29 PM, Taneli Korri <tk...@gmail.com> wrote:
> On Sat, Dec 31, 2011 at 9:09 AM, Martin Grigorov <mg...@apache.org> wrote:
>> On Fri, Dec 30, 2011 at 11:43 PM, martin.dilger
>> <ma...@googlemail.com> wrote:
>>> hi,
>>> you could try to change your render strategy to redirect to render, that
>>> would dismiss the page
>>> parameters version.
>>
>> This is not correct.
>> The page id is encoded in the url only for stateful pages. Make your
>> page stateless and it wont be there.
>>
>
> OK, thanks for the info.
>
> If I remember correctly, in Wicket 1.4 stateful pages had also clean
> urls if the page was mounted to a certain path, i.e. the page version
> number was stored somewhere behind the scenes. I'm guessing this isn't
> possible anymore in Wicket 1.5?

Everything is possible.
The new IRequestMapper are easily extensible and you can even use your own one.
By default this special parameter is set so when the user presses F5
(Refresh) the page Wicket will deliver the same version of the page.
Otherwise a new instance will be created without the knowledge of the
exact version.

Why do you want to hide this parameter ?

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



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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


Re: Hide page version query parameters

Posted by Taneli Korri <tk...@gmail.com>.
On Sat, Dec 31, 2011 at 9:09 AM, Martin Grigorov <mg...@apache.org> wrote:
> On Fri, Dec 30, 2011 at 11:43 PM, martin.dilger
> <ma...@googlemail.com> wrote:
>> hi,
>> you could try to change your render strategy to redirect to render, that
>> would dismiss the page
>> parameters version.
>
> This is not correct.
> The page id is encoded in the url only for stateful pages. Make your
> page stateless and it wont be there.
>

OK, thanks for the info.

If I remember correctly, in Wicket 1.4 stateful pages had also clean
urls if the page was mounted to a certain path, i.e. the page version
number was stored somewhere behind the scenes. I'm guessing this isn't
possible anymore in Wicket 1.5?

Regards,
Taneli Korri

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


Re: Hide page version query parameters

Posted by Martin Grigorov <mg...@apache.org>.
On Fri, Dec 30, 2011 at 11:43 PM, martin.dilger
<ma...@googlemail.com> wrote:
> hi,
> you could try to change your render strategy to redirect to render, that
> would dismiss the page
> parameters version.

This is not correct.
The page id is encoded in the url only for stateful pages. Make your
page stateless and it wont be there.

>
> regards
>
> martin dilger
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Hide-page-version-query-parameters-tp4163099p4246959.html
> Sent from the Users forum 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
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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


Re: Hide page version query parameters

Posted by "martin.dilger" <ma...@googlemail.com>.
hi,
you could try to change your render strategy to redirect to render, that
would dismiss the page
parameters version.

regards

martin dilger

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Hide-page-version-query-parameters-tp4163099p4246959.html
Sent from the Users forum 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: Hide page version query parameters

Posted by Taneli Korri <tk...@gmail.com>.
Allen wrote
> 
> Is there a built-in way to hide page version parameters (e.g. ?12) in
> Wicket 1.5?  If not, is it possible to write a custom IRequestMapper that
> does so without screwing up proper request handling?
> 
Hi,

Did you find a way to remove the page version parameter?

I'm also trying to figure out how to achieve that in Wicket 1.5. In 1.4 it
was easy since, mounting the page with mountBookmarkablePage was enough.

Regards
Taneli Korri

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Hide-page-version-query-parameters-tp4163099p4240312.html
Sent from the Users forum 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