You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Matthew Welch <ma...@welchkin.net> on 2009/04/23 04:25:31 UTC

AjaxLink causing a redirect

I've been playing around with URL rewriting a bit and have run across some
promising techniques. While testing these techniques, I've been slowly
loading up my pages with a number of different kinds of actions and links.
Everything was working pretty smoothly until I got put my first AjaxLink on
the page. For some reason, just the presence of an AjaxLink causes a
redirect during the processing of the page. Remove the AjaxLink; no
redirect.

I'm not questioning the necessity of this as I'm sure there's a good reason.
I am curious though. Why does this happen?

Matt

Re: AjaxLink causing a redirect

Posted by Matt Welch <ma...@welchkin.net>.


Liam Clarke-Hutchinson-3 wrote:
> 
> What do you mean by processing? Form processing? Normal rendering?
> 
Normal rendering, but as I mentioned later in the thread, even though it was
Wicket issuing the redirect, it was somehow being caused by my attempts at
URL rewriting and the redirects do not occur if the URL manipulation is
disabled. 

-- 
View this message in context: http://www.nabble.com/AjaxLink-causing-a-redirect-tp23189186p23196451.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: AjaxLink causing a redirect

Posted by Liam Clarke-Hutchinson <li...@steelsky.co.nz>.
What do you mean by processing? Form processing? Normal rendering?

On Thu, Apr 23, 2009 at 2:25 PM, Matthew Welch <ma...@welchkin.net> wrote:
> I've been playing around with URL rewriting a bit and have run across some
> promising techniques. While testing these techniques, I've been slowly
> loading up my pages with a number of different kinds of actions and links.
> Everything was working pretty smoothly until I got put my first AjaxLink on
> the page. For some reason, just the presence of an AjaxLink causes a
> redirect during the processing of the page. Remove the AjaxLink; no
> redirect.
>
> I'm not questioning the necessity of this as I'm sure there's a good reason.
> I am curious though. Why does this happen?
>
> Matt
>

<div><br></div>

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


Re: AjaxLink causing a redirect

Posted by Matt Welch <ma...@welchkin.net>.

Jeremy Thomerson-5 wrote:
> 
> Bummer - if you didn't throw in the towel, I'd be interested in seeing
> the result.  All session-relative wicket links are going to have a
> very distinct pattern that should be fairly easy [sic] to get in the
> pattern and not rewrite.
> 
> Mind posting your rewrite code and maybe somebody can help with the
> regex?  I may not be able to help, but I have put together some pretty
> hideous regex in my time.
> 

Here's the link to the quickstart:
http://www.nabble.com/file/p23208312/myproject.zip myproject.zip 

Some notes:
1) This won't work as written in Jetty. Jetty uses an unmodifiable map for
request parameters so to make it work in Jetty, one would need to change the
rewrite rule to set a request attribute instead of a request parameter.

2) I had to include the jar for the 3.2.0 version of the URL Rewrite filter
as it isn't in the central Maven repo yet. 

3) Instead of launching to the start page of the app I would recommend going
straight to "http://localhost:8080/whateveryouwant/testpage1". Replace 
"whateveryouwant" with anything. That's the value that will be rewritten out
of the URL and set as a request parameter with the name "organization". 

4) I'm using the HybridUrlCodingStrategy for URLs. You should be able to use
any URL coding stratgy, but since this is what I'm using in my main app,
it's what I've configured the rule for.


-Matt

-- 
View this message in context: http://www.nabble.com/AjaxLink-causing-a-redirect-tp23189186p23208312.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: AjaxLink causing a redirect

Posted by Matt Welch <ma...@welchkin.net>.


Jeremy Thomerson-5 wrote:
> 
> Bummer - if you didn't throw in the towel, I'd be interested in seeing
> the result.  All session-relative wicket links are going to have a
> very distinct pattern that should be fairly easy [sic] to get in the
> pattern and not rewrite.
> 
> Mind posting your rewrite code and maybe somebody can help with the
> regex?  I may not be able to help, but I have put together some pretty
> hideous regex in my time.
> 
Sure. When I get home today I'll attach or host a quickstart with my results
so far.

-Matt

-- 
View this message in context: http://www.nabble.com/AjaxLink-causing-a-redirect-tp23189186p23196413.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: AjaxLink causing a redirect

Posted by Jeremy Thomerson <je...@wickettraining.com>.
Bummer - if you didn't throw in the towel, I'd be interested in seeing
the result.  All session-relative wicket links are going to have a
very distinct pattern that should be fairly easy [sic] to get in the
pattern and not rewrite.

Mind posting your rewrite code and maybe somebody can help with the
regex?  I may not be able to help, but I have put together some pretty
hideous regex in my time.

--
Jeremy Thomerson
http://www.wickettraining.com




On Wed, Apr 22, 2009 at 11:44 PM, Matt Welch <ma...@welchkin.net> wrote:
>
> Hmmm.... perhaps it was a byproduct of the URL rewriting. As it turns out,
> even with normal PageLinks this redirect occurs. BookmarkablePageLinks do
> not cause the redirect. What's odd is that the redirect doesn't actually
> change anything.
>
> With the URL rewriting disabled, there are no redirects.
>
> Anyway it's no big deal. I think I'm going to have to give up on this URL
> rewriting stuff anyway. I was trying out URL Rewrite Filter
> (http://tuckey.org/urlrewrite/) and I was getting pretty close to what I
> needed (see my original thread on this topic:
> http://www.nabble.com/Custom-URL-Handling-to23130367.html which you actually
> responded too. You're a busy fellow!). It rewrites both incoming and
> outgoing URLs. The incoming rewrites are fairly obvious, but the outbound
> ones are done by embedding itself as part of the response.encodeURL() call.
>
> I managed to get the incoming URL rewrites working perfectly but some of the
> outbound URLs refuse to cooperate. Things like Wicket ajax calls and these
> redirects were popping up as obstacles. Maybe if I were a little more of a
> regex expert I could get this to work, but I'm close to throwing in the
> towel at this point.
>
> -Matt
>
>
>
>
>
> Jeremy Thomerson-5 wrote:
>>
>> Do you mean while loading a page that has an ajax link you are
>> redirected to another?  Please provide example (URLs and code).
>>
>> --
>> Jeremy Thomerson
>> http://www.wickettraining.com
>>
>>
>>
>>
>> On Wed, Apr 22, 2009 at 9:25 PM, Matthew Welch <ma...@welchkin.net>
>> wrote:
>>> I've been playing around with URL rewriting a bit and have run across
>>> some
>>> promising techniques. While testing these techniques, I've been slowly
>>> loading up my pages with a number of different kinds of actions and
>>> links.
>>> Everything was working pretty smoothly until I got put my first AjaxLink
>>> on
>>> the page. For some reason, just the presence of an AjaxLink causes a
>>> redirect during the processing of the page. Remove the AjaxLink; no
>>> redirect.
>>>
>>> I'm not questioning the necessity of this as I'm sure there's a good
>>> reason.
>>> I am curious though. Why does this happen?
>>>
>>> Matt
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/AjaxLink-causing-a-redirect-tp23189186p23189693.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
>
>

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


Re: AjaxLink causing a redirect

Posted by Matt Welch <ma...@welchkin.net>.
Hmmm.... perhaps it was a byproduct of the URL rewriting. As it turns out,
even with normal PageLinks this redirect occurs. BookmarkablePageLinks do
not cause the redirect. What's odd is that the redirect doesn't actually
change anything. 

With the URL rewriting disabled, there are no redirects. 

Anyway it's no big deal. I think I'm going to have to give up on this URL
rewriting stuff anyway. I was trying out URL Rewrite Filter
(http://tuckey.org/urlrewrite/) and I was getting pretty close to what I
needed (see my original thread on this topic:
http://www.nabble.com/Custom-URL-Handling-to23130367.html which you actually
responded too. You're a busy fellow!). It rewrites both incoming and
outgoing URLs. The incoming rewrites are fairly obvious, but the outbound
ones are done by embedding itself as part of the response.encodeURL() call. 

I managed to get the incoming URL rewrites working perfectly but some of the
outbound URLs refuse to cooperate. Things like Wicket ajax calls and these
redirects were popping up as obstacles. Maybe if I were a little more of a
regex expert I could get this to work, but I'm close to throwing in the
towel at this point.

-Matt





Jeremy Thomerson-5 wrote:
> 
> Do you mean while loading a page that has an ajax link you are
> redirected to another?  Please provide example (URLs and code).
> 
> --
> Jeremy Thomerson
> http://www.wickettraining.com
> 
> 
> 
> 
> On Wed, Apr 22, 2009 at 9:25 PM, Matthew Welch <ma...@welchkin.net>
> wrote:
>> I've been playing around with URL rewriting a bit and have run across
>> some
>> promising techniques. While testing these techniques, I've been slowly
>> loading up my pages with a number of different kinds of actions and
>> links.
>> Everything was working pretty smoothly until I got put my first AjaxLink
>> on
>> the page. For some reason, just the presence of an AjaxLink causes a
>> redirect during the processing of the page. Remove the AjaxLink; no
>> redirect.
>>
>> I'm not questioning the necessity of this as I'm sure there's a good
>> reason.
>> I am curious though. Why does this happen?
>>
>> Matt
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/AjaxLink-causing-a-redirect-tp23189186p23189693.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: AjaxLink causing a redirect

Posted by Jeremy Thomerson <je...@wickettraining.com>.
Do you mean while loading a page that has an ajax link you are
redirected to another?  Please provide example (URLs and code).

--
Jeremy Thomerson
http://www.wickettraining.com




On Wed, Apr 22, 2009 at 9:25 PM, Matthew Welch <ma...@welchkin.net> wrote:
> I've been playing around with URL rewriting a bit and have run across some
> promising techniques. While testing these techniques, I've been slowly
> loading up my pages with a number of different kinds of actions and links.
> Everything was working pretty smoothly until I got put my first AjaxLink on
> the page. For some reason, just the presence of an AjaxLink causes a
> redirect during the processing of the page. Remove the AjaxLink; no
> redirect.
>
> I'm not questioning the necessity of this as I'm sure there's a good reason.
> I am curious though. Why does this happen?
>
> Matt
>

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