Re: wicket 302 redirect loop

2011-11-18 Thread thomas willomitzer
Thanks Martin,

Guess the tomcat people forgot to put that into 7.0.18 - I'm using 7.0.22
and still have the problem.

On Fri, Nov 18, 2011 at 10:16 AM, Martin Grigorov wrote:

> On Fri, Nov 18, 2011 at 11:10 AM, thomas willomitzer 
> wrote:
> > Good question. I guess I'll hassle the people at the tomcat users list.
> > It's not a wicket issue as you pointed out.
> > Using ONE_PASS_RENDER is fine as a workaround ...
>
> Another workaround is to use a filter path, i.e. WicketFilter to
> listen at /app/* instead of /*.
> But this issue looks like
> https://issues.apache.org/jira/browse/WICKET-3841 and this problem has
> been fixed in Tomcat 7.0.18
>
> >
> > Thanks
> > Willo
> >
> > On Thu, Nov 17, 2011 at 9:47 PM, Igor Vaynberg  >wrote:
> >
> >> so what do we need to do to fix it on our end?
> >>
> >> -igor
> >>
> >> On Thu, Nov 17, 2011 at 11:34 AM, thomas willomitzer 
> >> wrote:
> >> > No I'm afraid ... just tried
> >> >
> >> > On Thu, Nov 17, 2011 at 8:19 PM, Igor Vaynberg <
> igor.vaynb...@gmail.com
> >> >wrote:
> >> >
> >> >> would adding a bogus query param help there? so the url will look
> like
> >> >> this: localhost/?1&bogus=1
> >> >>
> >> >> -igor
> >> >>
> >> >> On Thu, Nov 17, 2011 at 10:21 AM, thomas willomitzer 
> >> >> wrote:
> >> >> > Fair enough ...
> >> >> >
> >> >> > Looking at org.apache.catalina.connector.Response a url of e.g.
> >> >> > http://localhost/?1 results in a path of length 0 which doesn't
> >> append
> >> >> the
> >> >> > jsessionid.
> >> >> >
> >> >> > if( sb.length() > 0 ) { // jsessionid can't be first.
> >> >> >
> >> >> > It's obviously a tomcat issue ... but given the fact that tomcat is
> >> >> widely
> >> >> > used ... can't we do something about that?
> >> >> > Well I did by using ONE_PASS_RENDER ;)
> >> >> >
> >> >> > Thanks
> >> >> > Willo
> >> >> >
> >> >> >/**
> >> >> > * Return the specified URL with the specified session
> identifier
> >> >> > * suitably encoded.
> >> >> > *
> >> >> > * @param url URL to be encoded with the session id
> >> >> > * @param sessionId Session id to be included in the encoded URL
> >> >> > */
> >> >> >protected String toEncoded(String url, String sessionId) {
> >> >> >
> >> >> >if ((url == null) || (sessionId == null))
> >> >> >return (url);
> >> >> >
> >> >> >String path = url;
> >> >> >String query = "";
> >> >> >String anchor = "";
> >> >> >int question = url.indexOf('?');
> >> >> >if (question >= 0) {
> >> >> >path = url.substring(0, question);
> >> >> >query = url.substring(question);
> >> >> >}
> >> >> >int pound = path.indexOf('#');
> >> >> >    if (pound >= 0) {
> >> >> >anchor = path.substring(pound);
> >> >> >path = path.substring(0, pound);
> >> >> >}
> >> >> >StringBuilder sb = new StringBuilder(path);
> >> >> >if( sb.length() > 0 ) { // jsessionid can't be first.
> >> >> >sb.append(";");
> >> >> >
> >> >>  sb.append(ApplicationSessionCookieConfig.getSessionUriParamName(
> >> >> >request.getContext()));
> >> >> >sb.append("=");
> >> >> >sb.append(sessionId);
> >> >> >}
> >> >> >sb.append(anchor);
> >> >> >sb.append(query);
> >> >> >return (sb.toString());
> >> >> >
> >> >> >}
> >> >> >
> >> >> >
> >> >> > On Thu, Nov 17, 2011 at 6:52 PM, Igor Vaynberg <
> >> igor.v

Re: wicket 302 redirect loop

2011-11-18 Thread thomas willomitzer
Good question. I guess I'll hassle the people at the tomcat users list.
It's not a wicket issue as you pointed out.
Using ONE_PASS_RENDER is fine as a workaround ...

Thanks
Willo

On Thu, Nov 17, 2011 at 9:47 PM, Igor Vaynberg wrote:

> so what do we need to do to fix it on our end?
>
> -igor
>
> On Thu, Nov 17, 2011 at 11:34 AM, thomas willomitzer 
> wrote:
> > No I'm afraid ... just tried
> >
> > On Thu, Nov 17, 2011 at 8:19 PM, Igor Vaynberg  >wrote:
> >
> >> would adding a bogus query param help there? so the url will look like
> >> this: localhost/?1&bogus=1
> >>
> >> -igor
> >>
> >> On Thu, Nov 17, 2011 at 10:21 AM, thomas willomitzer 
> >> wrote:
> >> > Fair enough ...
> >> >
> >> > Looking at org.apache.catalina.connector.Response a url of e.g.
> >> > http://localhost/?1 results in a path of length 0 which doesn't
> append
> >> the
> >> > jsessionid.
> >> >
> >> > if( sb.length() > 0 ) { // jsessionid can't be first.
> >> >
> >> > It's obviously a tomcat issue ... but given the fact that tomcat is
> >> widely
> >> > used ... can't we do something about that?
> >> > Well I did by using ONE_PASS_RENDER ;)
> >> >
> >> > Thanks
> >> > Willo
> >> >
> >> >/**
> >> > * Return the specified URL with the specified session identifier
> >> > * suitably encoded.
> >> > *
> >> > * @param url URL to be encoded with the session id
> >> > * @param sessionId Session id to be included in the encoded URL
> >> > */
> >> >protected String toEncoded(String url, String sessionId) {
> >> >
> >> >if ((url == null) || (sessionId == null))
> >> >return (url);
> >> >
> >> >String path = url;
> >> >String query = "";
> >> >String anchor = "";
> >> >int question = url.indexOf('?');
> >> >if (question >= 0) {
> >> >path = url.substring(0, question);
> >> >query = url.substring(question);
> >> >}
> >> >int pound = path.indexOf('#');
> >> >if (pound >= 0) {
> >> >anchor = path.substring(pound);
> >> >path = path.substring(0, pound);
> >> >}
> >> >StringBuilder sb = new StringBuilder(path);
> >> >if( sb.length() > 0 ) { // jsessionid can't be first.
> >> >    sb.append(";");
> >> >
> >>  sb.append(ApplicationSessionCookieConfig.getSessionUriParamName(
> >> >request.getContext()));
> >> >sb.append("=");
> >> >sb.append(sessionId);
> >> >}
> >> >sb.append(anchor);
> >> >sb.append(query);
> >> >return (sb.toString());
> >> >
> >> >}
> >> >
> >> >
> >> > On Thu, Nov 17, 2011 at 6:52 PM, Igor Vaynberg <
> igor.vaynb...@gmail.com
> >> >wrote:
> >> >
> >> >> as long as we are passing the /?1 url through
> >> >> servletresponse#encoderedirecturl() tomcat is responsible for
> >> >> appending the JSESSIONID if its not yet available in a cookie...
> >> >>
> >> >> -igor
> >> >>
> >> >> On Thu, Nov 17, 2011 at 2:16 AM, thomas willomitzer 
> >> wrote:
> >> >> > Hi,
> >> >> >
> >> >> > Thanks for the advice! I follwed and traced the problem. Think
> it's a
> >> >> > combination of Wicket and Tomcat...
> >> >> >
> >> >> > When i send the request for http://localhost/, wicket get's the
> >> session
> >> >> > from tomcat, renders the page and buffers the response (since
> >> >> > ONE_PASS_RENDER isn't default).
> >> >> > Wicket (1.5.3) also appends the ?1 and sends a 302 redirect to
> >> >> > http://localhost/?1 (in the 302 response header the cookie get's
> >> >> correctly
> >> >> > set - but not appended to the redirect URL).
> >> >> > Tomcat (7.0.

Re: wicket 302 redirect loop

2011-11-17 Thread thomas willomitzer
No I'm afraid ... just tried

On Thu, Nov 17, 2011 at 8:19 PM, Igor Vaynberg wrote:

> would adding a bogus query param help there? so the url will look like
> this: localhost/?1&bogus=1
>
> -igor
>
> On Thu, Nov 17, 2011 at 10:21 AM, thomas willomitzer 
> wrote:
> > Fair enough ...
> >
> > Looking at org.apache.catalina.connector.Response a url of e.g.
> > http://localhost/?1 results in a path of length 0 which doesn't append
> the
> > jsessionid.
> >
> > if( sb.length() > 0 ) { // jsessionid can't be first.
> >
> > It's obviously a tomcat issue ... but given the fact that tomcat is
> widely
> > used ... can't we do something about that?
> > Well I did by using ONE_PASS_RENDER ;)
> >
> > Thanks
> > Willo
> >
> >/**
> > * Return the specified URL with the specified session identifier
> > * suitably encoded.
> > *
> > * @param url URL to be encoded with the session id
> > * @param sessionId Session id to be included in the encoded URL
> > */
> >protected String toEncoded(String url, String sessionId) {
> >
> >if ((url == null) || (sessionId == null))
> >return (url);
> >
> >String path = url;
> >String query = "";
> >String anchor = "";
> >int question = url.indexOf('?');
> >if (question >= 0) {
> >path = url.substring(0, question);
> >query = url.substring(question);
> >}
> >int pound = path.indexOf('#');
> >if (pound >= 0) {
> >anchor = path.substring(pound);
> >path = path.substring(0, pound);
> >}
> >StringBuilder sb = new StringBuilder(path);
> >if( sb.length() > 0 ) { // jsessionid can't be first.
> >sb.append(";");
> >
>  sb.append(ApplicationSessionCookieConfig.getSessionUriParamName(
> >request.getContext()));
> >sb.append("=");
> >sb.append(sessionId);
> >}
> >sb.append(anchor);
> >sb.append(query);
> >return (sb.toString());
> >
> >}
> >
> >
> > On Thu, Nov 17, 2011 at 6:52 PM, Igor Vaynberg  >wrote:
> >
> >> as long as we are passing the /?1 url through
> >> servletresponse#encoderedirecturl() tomcat is responsible for
> >> appending the JSESSIONID if its not yet available in a cookie...
> >>
> >> -igor
> >>
> >> On Thu, Nov 17, 2011 at 2:16 AM, thomas willomitzer 
> wrote:
> >> > Hi,
> >> >
> >> > Thanks for the advice! I follwed and traced the problem. Think it's a
> >> > combination of Wicket and Tomcat...
> >> >
> >> > When i send the request for http://localhost/, wicket get's the
> session
> >> > from tomcat, renders the page and buffers the response (since
> >> > ONE_PASS_RENDER isn't default).
> >> > Wicket (1.5.3) also appends the ?1 and sends a 302 redirect to
> >> > http://localhost/?1 (in the 302 response header the cookie get's
> >> correctly
> >> > set - but not appended to the redirect URL).
> >> > Tomcat (7.0.22) doesn't append jsessionid to an url like
> >> http://localhost/?1.
> >> > Looks like it's still the "empty path" and tomcat problem that
> prohibits
> >> > the appending of jsessionid.
> >> >
> >> > Now when I don't use cookies and follow the request to
> >> > http://localhost/?1how should wicket know which session we're talking
> >> > about?
> >> >
> >> > Please note that this problem doesn't exist when sending a request to
> >> e.g.
> >> > http://localhost/login. I get a correct redirect to
> >> > http://localhost/login;jsessionid=xx.
> >> >
> >> > I could think of the following "workaround":
> >> > 1.) For the homepage use ONE_PASS_RENDER
> >> >
> >> > Is this a tomcat/wicket combination problem or am I doing something
> >> wrong?
> >> >
> >> > Many thanks
> >> > Willo
> >> >
> >> > On Wed, Nov 16, 2011 at 7:57 PM, Bertrand Guay-Paquet <
> >> > ber...@step.polymtl.ca> wrote:
> >> >
> >> >> I don't know of a

Re: Apache Wicket is a Flawed Framework

2011-11-17 Thread thomas willomitzer
Ooohh... I better double check what I'm writing on this list, Since the FBI
is around ... ;)

On Thu, Nov 17, 2011 at 7:56 PM, Alex Objelean wrote:

> This is not an april fool's day, it is just an opinion of an
> http://www.linkedin.com/pub/eric-kizaki/30/2b1/1a4 inexperienced
> developer .
> Eric, if you have troubles in understanding wicket, you are definitely
> doing
> it wrong. Wicket is not a silver bullet, but it is a great tool when
> comparing to existing technologies.
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Apache-Wicket-is-a-Flawed-Framework-tp4080411p4081174.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: wicket 302 redirect loop

2011-11-17 Thread thomas willomitzer
Fair enough ...

Looking at org.apache.catalina.connector.Response a url of e.g.
http://localhost/?1 results in a path of length 0 which doesn't append the
jsessionid.

if( sb.length() > 0 ) { // jsessionid can't be first.

It's obviously a tomcat issue ... but given the fact that tomcat is widely
used ... can't we do something about that?
Well I did by using ONE_PASS_RENDER ;)

Thanks
Willo

/**
 * Return the specified URL with the specified session identifier
 * suitably encoded.
 *
 * @param url URL to be encoded with the session id
 * @param sessionId Session id to be included in the encoded URL
 */
protected String toEncoded(String url, String sessionId) {

if ((url == null) || (sessionId == null))
return (url);

String path = url;
String query = "";
String anchor = "";
int question = url.indexOf('?');
if (question >= 0) {
path = url.substring(0, question);
query = url.substring(question);
}
int pound = path.indexOf('#');
if (pound >= 0) {
anchor = path.substring(pound);
path = path.substring(0, pound);
}
StringBuilder sb = new StringBuilder(path);
if( sb.length() > 0 ) { // jsessionid can't be first.
sb.append(";");
sb.append(ApplicationSessionCookieConfig.getSessionUriParamName(
request.getContext()));
sb.append("=");
sb.append(sessionId);
}
sb.append(anchor);
sb.append(query);
return (sb.toString());

}


On Thu, Nov 17, 2011 at 6:52 PM, Igor Vaynberg wrote:

> as long as we are passing the /?1 url through
> servletresponse#encoderedirecturl() tomcat is responsible for
> appending the JSESSIONID if its not yet available in a cookie...
>
> -igor
>
> On Thu, Nov 17, 2011 at 2:16 AM, thomas willomitzer  wrote:
> > Hi,
> >
> > Thanks for the advice! I follwed and traced the problem. Think it's a
> > combination of Wicket and Tomcat...
> >
> > When i send the request for http://localhost/, wicket get's the session
> > from tomcat, renders the page and buffers the response (since
> > ONE_PASS_RENDER isn't default).
> > Wicket (1.5.3) also appends the ?1 and sends a 302 redirect to
> > http://localhost/?1 (in the 302 response header the cookie get's
> correctly
> > set - but not appended to the redirect URL).
> > Tomcat (7.0.22) doesn't append jsessionid to an url like
> http://localhost/?1.
> > Looks like it's still the "empty path" and tomcat problem that prohibits
> > the appending of jsessionid.
> >
> > Now when I don't use cookies and follow the request to
> > http://localhost/?1how should wicket know which session we're talking
> > about?
> >
> > Please note that this problem doesn't exist when sending a request to
> e.g.
> > http://localhost/login. I get a correct redirect to
> > http://localhost/login;jsessionid=xx.
> >
> > I could think of the following "workaround":
> > 1.) For the homepage use ONE_PASS_RENDER
> >
> > Is this a tomcat/wicket combination problem or am I doing something
> wrong?
> >
> > Many thanks
> > Willo
> >
> > On Wed, Nov 16, 2011 at 7:57 PM, Bertrand Guay-Paquet <
> > ber...@step.polymtl.ca> wrote:
> >
> >> I don't know of any other specific causes unfortunately...
> >>
> >> Try setting a breakpoint in RequestCycle#onBeginRequest() and see what
> >> happens. Try your page constructor too since it might be closer to the
> >> source of the problem.
> >>
> >> Good luck!
> >> Bertrand
> >>
> >>
> >> On 16/11/2011 12:21 PM, thomas willomitzer wrote:
> >>
> >>> Hi,
> >>>
> >>> Thanks I checked but no getPageParameters() override ;)
> >>>
> >>> Regards
> >>> Thomas
> >>>
> >>> On Wed, Nov 16, 2011 at 6:04 PM, Bertrand Guay-Paquet<
> >>> ber...@step.polymtl.ca>  wrote:
> >>>
> >>>  Hi,
> >>>>
> >>>> I had a redirect loop once because I added an override to
> >>>> Page#getPageParameters() by mistake. I wanted to use my method to
> >>>> generate
> >>>> a new PageParameters instance for a page but overriding the Page
> method
> >>>> gave your result.
> >>>>
> >>>> It's worth a shot!
> >>>>
> &

Re: wicket 302 redirect loop

2011-11-17 Thread thomas willomitzer
Hi,

Thanks for the advice! I follwed and traced the problem. Think it's a
combination of Wicket and Tomcat...

When i send the request for http://localhost/, wicket get's the session
from tomcat, renders the page and buffers the response (since
ONE_PASS_RENDER isn't default).
Wicket (1.5.3) also appends the ?1 and sends a 302 redirect to
http://localhost/?1 (in the 302 response header the cookie get's correctly
set - but not appended to the redirect URL).
Tomcat (7.0.22) doesn't append jsessionid to an url like http://localhost/?1.
Looks like it's still the "empty path" and tomcat problem that prohibits
the appending of jsessionid.

Now when I don't use cookies and follow the request to
http://localhost/?1how should wicket know which session we're talking
about?

Please note that this problem doesn't exist when sending a request to e.g.
http://localhost/login. I get a correct redirect to
http://localhost/login;jsessionid=xx.

I could think of the following "workaround":
1.) For the homepage use ONE_PASS_RENDER

Is this a tomcat/wicket combination problem or am I doing something wrong?

Many thanks
Willo

On Wed, Nov 16, 2011 at 7:57 PM, Bertrand Guay-Paquet <
ber...@step.polymtl.ca> wrote:

> I don't know of any other specific causes unfortunately...
>
> Try setting a breakpoint in RequestCycle#onBeginRequest() and see what
> happens. Try your page constructor too since it might be closer to the
> source of the problem.
>
> Good luck!
> Bertrand
>
>
> On 16/11/2011 12:21 PM, thomas willomitzer wrote:
>
>> Hi,
>>
>> Thanks I checked but no getPageParameters() override ;)
>>
>> Regards
>> Thomas
>>
>> On Wed, Nov 16, 2011 at 6:04 PM, Bertrand Guay-Paquet<
>> ber...@step.polymtl.ca>  wrote:
>>
>>  Hi,
>>>
>>> I had a redirect loop once because I added an override to
>>> Page#getPageParameters() by mistake. I wanted to use my method to
>>> generate
>>> a new PageParameters instance for a page but overriding the Page method
>>> gave your result.
>>>
>>> It's worth a shot!
>>>
>>> Regards,
>>> Bertrand
>>>
>>>
>>> On 16/11/2011 11:40 AM, thomas willomitzer wrote:
>>>
>>>  Dear All,
>>>>
>>>> I've managed to get the jsessionid appended correctly when requesting a
>>>> page without cookies enabled (wicket 1.5.3, tomcat 7.0.22).
>>>>
>>>> I get
>>>> curl -v --insecure https://localhost/ ->   Location:
>>>> https://localhost/?1
>>>> curl -v --insecure https://localhost/?1 ->   Location:
>>>> https://localhost/.;jsessionid=D62D2D693854214C847E7A75439909**
>>>> **A3<https://localhost/.;**jsessionid=**D62D2D693854214C847E7A75439909**A3>
>>>> <https://localhost/.;**jsessionid=**D62D2D693854214C847E7A75439909**A3<https://localhost/.;jsessionid=D62D2D693854214C847E7A75439909A3>
>>>> >
>>>> curl -v --insecure
>>>> https://localhost/.;jsessionid=D62D2D693854214C847E7A75439909**
>>>> **A3<https://localhost/.;**jsessionid=**D62D2D693854214C847E7A75439909**A3>
>>>> <https://localhost/.;**jsessionid=**D62D2D693854214C847E7A75439909**A3<https://localhost/.;jsessionid=D62D2D693854214C847E7A75439909A3>>->
>>>>   HTTP 404
>>>>
>>>>
>>>> change URL (erasing ".") to
>>>> curl -v --insecure
>>>> https://localhost/;jsessionid=**D62D2D693854214C847E7A75439909**
>>>> **A3<https://localhost/;jsessionid=**D62D2D693854214C847E7A75439909**A3>
>>>> <https://localhost/;**jsessionid=**D62D2D693854214C847E7A75439909**A3<https://localhost/;jsessionid=D62D2D693854214C847E7A75439909A3>>->
>>>>   Location:
>>>>
>>>> https://localhost/?1
>>>>
>>>> When trying in a browser I get the warning that it's a redirect loop.
>>>>
>>>> Can somebody please point me to what I'm doing wrong here?
>>>>
>>>> Many Thanks
>>>> Thomas
>>>>
>>>>
>>>>  --**
>>> --**-
>>> To unsubscribe, e-mail: 
>>> users-unsubscribe@wicket.**apa**che.org<http://apache.org>
>>> 
>>> >
>>>
>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>
>>>
>>>


Re: wicket 302 redirect loop

2011-11-16 Thread thomas willomitzer
Hi,

Thanks I checked but no getPageParameters() override ;)

Regards
Thomas

On Wed, Nov 16, 2011 at 6:04 PM, Bertrand Guay-Paquet <
ber...@step.polymtl.ca> wrote:

> Hi,
>
> I had a redirect loop once because I added an override to
> Page#getPageParameters() by mistake. I wanted to use my method to generate
> a new PageParameters instance for a page but overriding the Page method
> gave your result.
>
> It's worth a shot!
>
> Regards,
> Bertrand
>
>
> On 16/11/2011 11:40 AM, thomas willomitzer wrote:
>
>> Dear All,
>>
>> I've managed to get the jsessionid appended correctly when requesting a
>> page without cookies enabled (wicket 1.5.3, tomcat 7.0.22).
>>
>> I get
>> curl -v --insecure https://localhost/ ->  Location: https://localhost/?1
>> curl -v --insecure https://localhost/?1 ->  Location:
>> https://localhost/.;**jsessionid=**D62D2D693854214C847E7A75439909**A3<https://localhost/.;jsessionid=D62D2D693854214C847E7A75439909A3>
>> curl -v --insecure
>> https://localhost/.;**jsessionid=**D62D2D693854214C847E7A75439909**A3<https://localhost/.;jsessionid=D62D2D693854214C847E7A75439909A3>->
>>   HTTP 404
>>
>> change URL (erasing ".") to
>> curl -v --insecure
>> https://localhost/;jsessionid=**D62D2D693854214C847E7A75439909**A3<https://localhost/;jsessionid=D62D2D693854214C847E7A75439909A3>->
>>   Location:
>> https://localhost/?1
>>
>> When trying in a browser I get the warning that it's a redirect loop.
>>
>> Can somebody please point me to what I'm doing wrong here?
>>
>> Many Thanks
>> Thomas
>>
>>
> --**--**-
> To unsubscribe, e-mail: 
> users-unsubscribe@wicket.**apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


wicket 302 redirect loop

2011-11-16 Thread thomas willomitzer
Dear All,

I've managed to get the jsessionid appended correctly when requesting a
page without cookies enabled (wicket 1.5.3, tomcat 7.0.22).

I get
curl -v --insecure https://localhost/ -> Location: https://localhost/?1
curl -v --insecure https://localhost/?1 -> Location:
https://localhost/.;jsessionid=D62D2D693854214C847E7A75439909A3
curl -v --insecure
https://localhost/.;jsessionid=D62D2D693854214C847E7A75439909A3 -> HTTP 404

change URL (erasing ".") to
curl -v --insecure
https://localhost/;jsessionid=D62D2D693854214C847E7A75439909A3 -> Location:
https://localhost/?1

When trying in a browser I get the warning that it's a redirect loop.

Can somebody please point me to what I'm doing wrong here?

Many Thanks
Thomas


Re: jsessionid not appended for stateful pages

2011-11-16 Thread thomas willomitzer
Sorry ... wicket 1.5.3

On Wed, Nov 16, 2011 at 5:11 PM, thomas willomitzer  wrote:

> Martin,
>
> Upgrading to 1.5.2 and using tomcat 7.0.22 fixed my issue - now I get
>
> > Location:
> https://localhost/.;jsessionid=176D66D946CA33F54798F8EE1863C475
>
> Thanks
> Thomas
>
>
> On Wed, Nov 16, 2011 at 3:09 PM, Martin Grigorov wrote:
>
>> On Wed, Nov 16, 2011 at 4:02 PM, thomas willomitzer 
>> wrote:
>> > Hi Martin,
>> >
>> > Sorry for the confusion I meant that i've seen
>> > org.apache.wicket.util.string.Strings.stripJSessionId(uri) being called
>> for
>> > ResourceReferences to Javascript and Css.
>>
>> This is used to check whether a given resource is already contributed or
>> not.
>>
>> >
>> > I'm using wicket 1.5.1 and tomcat 6.0.33.
>>
>> Try with Wicket 1.5.3. I remember a ticket about such problems with
>> the home page without filter path.
>> We have a workaround in Wicket but I remember Tomcat also fixed it in
>> 7.x, not sure about 6.x.
>>
>> >
>> > You're right - I've traced from
>> >
>> org.apache.wicket.protocol.http.servlet.ServletWebResponse.sendRedirect(String)
>> > and it seems like there is a problem with "?1" and
>> > org.apache.catalina.connector.toEncoded(String url, String sessionId).
>> >
>> > In toEncoded(String url, String sessionId) when url = "?1" it seems that
>> > the parameter is NOT appended since variable path is of length zero and
>> if(
>> > sb.length() > 0 ) is false. (in order to see a value of "?1" i set a
>> > breakpoint in ServletWebResponse.sendRedirect followed by a breakpoint
>> in
>> > toEncoded)
>> >
>> > Since it seems to work for the rest of the world I guess I'm doing
>> > something wrong ...
>> >
>> >protected String toEncoded(String url, String sessionId) {
>> >
>> >if ((url == null) || (sessionId == null))
>> >return (url);
>> >
>> >String path = url;
>> >String query = "";
>> >String anchor = "";
>> >int question = url.indexOf('?');
>> >if (question >= 0) {
>> >path = url.substring(0, question);
>> >query = url.substring(question);
>> >}
>> >int pound = path.indexOf('#');
>> >if (pound >= 0) {
>> >anchor = path.substring(pound);
>> >path = path.substring(0, pound);
>> >    }
>> >StringBuffer sb = new StringBuffer(path);
>> >if( sb.length() > 0 ) { // jsessionid can't be first.
>> >sb.append(";");
>> >sb.append(Globals.SESSION_PARAMETER_NAME);
>> >sb.append("=");
>> >sb.append(sessionId);
>> >}
>> >sb.append(anchor);
>> >sb.append(query);
>> >return (sb.toString());
>> >
>> >}
>> >
>> >
>> > Thanks
>> > Thomas
>> >
>> >
>> > On Wed, Nov 16, 2011 at 1:39 PM, Martin Grigorov > >wrote:
>> >
>> >> Hi,
>> >>
>> >> On Wed, Nov 16, 2011 at 2:29 PM, thomas willomitzer
>> >>  wrote:
>> >> > Dear all,
>> >> >
>> >> > I've spent quite a bit of time tracking down a problem I'm having
>> using
>> >> > wicket and stateful pages.
>> >> > I've enabled the jsessionid url rewriting in tomcat (by simply using
>> the
>> >> > default settings) but I get a redirect url without the jsessionid.
>> >> >
>> >> > I've traced into tomcat's Response.encodeUrl and saw that the
>> jsessionid
>> >> is
>> >> > in fact appended (but later removed for in page references by wicket
>> -
>> >> > that's fine).
>> >>
>> >> What do you mean by that ? Where Wicket removes the jsessionid from the
>> >> url ?
>> >> Before issuing a redirect Wicket calls
>> >> javax.servlet.http.HttpServletResponse.encodeRedirectURL(String) which
>> >> is responsible to put jsessionid if cookies are disabled.
>> >> See
>> >>
>> org.apache.wicket.protocol.http.servlet.ServletWebResponse.sendRedirect(String)
>>

Re: jsessionid not appended for stateful pages

2011-11-16 Thread thomas willomitzer
Martin,

Upgrading to 1.5.2 and using tomcat 7.0.22 fixed my issue - now I get

> Location: https://localhost/.;jsessionid=176D66D946CA33F54798F8EE1863C475

Thanks
Thomas

On Wed, Nov 16, 2011 at 3:09 PM, Martin Grigorov wrote:

> On Wed, Nov 16, 2011 at 4:02 PM, thomas willomitzer  wrote:
> > Hi Martin,
> >
> > Sorry for the confusion I meant that i've seen
> > org.apache.wicket.util.string.Strings.stripJSessionId(uri) being called
> for
> > ResourceReferences to Javascript and Css.
>
> This is used to check whether a given resource is already contributed or
> not.
>
> >
> > I'm using wicket 1.5.1 and tomcat 6.0.33.
>
> Try with Wicket 1.5.3. I remember a ticket about such problems with
> the home page without filter path.
> We have a workaround in Wicket but I remember Tomcat also fixed it in
> 7.x, not sure about 6.x.
>
> >
> > You're right - I've traced from
> >
> org.apache.wicket.protocol.http.servlet.ServletWebResponse.sendRedirect(String)
> > and it seems like there is a problem with "?1" and
> > org.apache.catalina.connector.toEncoded(String url, String sessionId).
> >
> > In toEncoded(String url, String sessionId) when url = "?1" it seems that
> > the parameter is NOT appended since variable path is of length zero and
> if(
> > sb.length() > 0 ) is false. (in order to see a value of "?1" i set a
> > breakpoint in ServletWebResponse.sendRedirect followed by a breakpoint in
> > toEncoded)
> >
> > Since it seems to work for the rest of the world I guess I'm doing
> > something wrong ...
> >
> >protected String toEncoded(String url, String sessionId) {
> >
> >if ((url == null) || (sessionId == null))
> >return (url);
> >
> >String path = url;
> >String query = "";
> >String anchor = "";
> >int question = url.indexOf('?');
> >if (question >= 0) {
> >path = url.substring(0, question);
> >query = url.substring(question);
> >}
> >int pound = path.indexOf('#');
> >if (pound >= 0) {
> >anchor = path.substring(pound);
> >path = path.substring(0, pound);
> >}
> >StringBuffer sb = new StringBuffer(path);
> >if( sb.length() > 0 ) { // jsessionid can't be first.
> >sb.append(";");
> >sb.append(Globals.SESSION_PARAMETER_NAME);
> >sb.append("=");
> >sb.append(sessionId);
> >}
> >sb.append(anchor);
> >sb.append(query);
> >return (sb.toString());
> >
> >}
> >
> >
> > Thanks
> > Thomas
> >
> >
> > On Wed, Nov 16, 2011 at 1:39 PM, Martin Grigorov  >wrote:
> >
> >> Hi,
> >>
> >> On Wed, Nov 16, 2011 at 2:29 PM, thomas willomitzer
> >>  wrote:
> >> > Dear all,
> >> >
> >> > I've spent quite a bit of time tracking down a problem I'm having
> using
> >> > wicket and stateful pages.
> >> > I've enabled the jsessionid url rewriting in tomcat (by simply using
> the
> >> > default settings) but I get a redirect url without the jsessionid.
> >> >
> >> > I've traced into tomcat's Response.encodeUrl and saw that the
> jsessionid
> >> is
> >> > in fact appended (but later removed for in page references by wicket -
> >> > that's fine).
> >>
> >> What do you mean by that ? Where Wicket removes the jsessionid from the
> >> url ?
> >> Before issuing a redirect Wicket calls
> >> javax.servlet.http.HttpServletResponse.encodeRedirectURL(String) which
> >> is responsible to put jsessionid if cookies are disabled.
> >> See
> >>
> org.apache.wicket.protocol.http.servlet.ServletWebResponse.sendRedirect(String)
> >>
> >> The application I work on works without cookies and all if fine. (Wicket
> >> 1.5.3)
> >>
> >> >
> >> > What am I doing wrong and am I right in the assumption that wicket
> should
> >> > work without cookies?
> >> >
> >> > When using curl I first get a redirect to ?1, then to /. and then a
> 404
> >> >
> >> > $ curl -v http://localhost
> >> > * About to connect() to localhost port 80 (#0)
> >> > *   Trying 127.0.0.1... connected
>

Re: jsessionid not appended for stateful pages

2011-11-16 Thread thomas willomitzer
Hi Martin,

Sorry for the confusion I meant that i've seen
org.apache.wicket.util.string.Strings.stripJSessionId(uri) being called for
ResourceReferences to Javascript and Css.

I'm using wicket 1.5.1 and tomcat 6.0.33.

You're right - I've traced from
org.apache.wicket.protocol.http.servlet.ServletWebResponse.sendRedirect(String)
and it seems like there is a problem with "?1" and
org.apache.catalina.connector.toEncoded(String url, String sessionId).

In toEncoded(String url, String sessionId) when url = "?1" it seems that
the parameter is NOT appended since variable path is of length zero and if(
sb.length() > 0 ) is false. (in order to see a value of "?1" i set a
breakpoint in ServletWebResponse.sendRedirect followed by a breakpoint in
toEncoded)

Since it seems to work for the rest of the world I guess I'm doing
something wrong ...

protected String toEncoded(String url, String sessionId) {

if ((url == null) || (sessionId == null))
return (url);

String path = url;
String query = "";
String anchor = "";
int question = url.indexOf('?');
if (question >= 0) {
path = url.substring(0, question);
query = url.substring(question);
}
int pound = path.indexOf('#');
if (pound >= 0) {
anchor = path.substring(pound);
path = path.substring(0, pound);
}
StringBuffer sb = new StringBuffer(path);
if( sb.length() > 0 ) { // jsessionid can't be first.
sb.append(";");
sb.append(Globals.SESSION_PARAMETER_NAME);
sb.append("=");
sb.append(sessionId);
}
sb.append(anchor);
sb.append(query);
return (sb.toString());

}


Thanks
Thomas


On Wed, Nov 16, 2011 at 1:39 PM, Martin Grigorov wrote:

> Hi,
>
> On Wed, Nov 16, 2011 at 2:29 PM, thomas willomitzer
>  wrote:
> > Dear all,
> >
> > I've spent quite a bit of time tracking down a problem I'm having using
> > wicket and stateful pages.
> > I've enabled the jsessionid url rewriting in tomcat (by simply using the
> > default settings) but I get a redirect url without the jsessionid.
> >
> > I've traced into tomcat's Response.encodeUrl and saw that the jsessionid
> is
> > in fact appended (but later removed for in page references by wicket -
> > that's fine).
>
> What do you mean by that ? Where Wicket removes the jsessionid from the
> url ?
> Before issuing a redirect Wicket calls
> javax.servlet.http.HttpServletResponse.encodeRedirectURL(String) which
> is responsible to put jsessionid if cookies are disabled.
> See
> org.apache.wicket.protocol.http.servlet.ServletWebResponse.sendRedirect(String)
>
> The application I work on works without cookies and all if fine. (Wicket
> 1.5.3)
>
> >
> > What am I doing wrong and am I right in the assumption that wicket should
> > work without cookies?
> >
> > When using curl I first get a redirect to ?1, then to /. and then a 404
> >
> > $ curl -v http://localhost
> > * About to connect() to localhost port 80 (#0)
> > *   Trying 127.0.0.1... connected
> > * Connected to localhost (127.0.0.1) port 80 (#0)
> >> GET / HTTP/1.1
> >> User-Agent: curl/7.21.1 (i686-pc-mingw32) libcurl/7.21.1 OpenSSL/0.9.8k
> > zlib/1.2.3
> >> Host: localhost
> >> Accept: */*
> >>
> > < HTTP/1.1 302 Moved Temporarily
> > < Server: Apache-Coyote/1.1
> > < Set-Cookie: JSESSIONID=
> > CA5649F5EA37AC7CDB2D5E06170923A1; Path=/
> > < Date: Wed, 16 Nov 2011 12:16:15 GMT
> > < Expires: Thu, 01 Jan 1970 00:00:00 GMT
> > < Pragma: no-cache
> > < Cache-Control: no-cache, no-store
> > < Location: http://localhost/?1
> > < Content-Length: 0
> > <
> > * Connection #0 to host localhost left intact
> > * Closing connection #0
> >
> > thomas@willo ~
> > $ curl -v http://localhost?1 <http://localhost/?1>
> > * About to connect() to localhost port 80 (#0)
> > *   Trying 127.0.0.1... connected
> > * Connected to localhost (127.0.0.1) port 80 (#0)
> >> GET /?1 HTTP/1.1
> >> User-Agent: curl/7.21.1 (i686-pc-mingw32) libcurl/7.21.1 OpenSSL/0.9.8k
> > zlib/1.2.3
> >> Host: localhost
> >> Accept: */*
> >>
> > < HTTP/1.1 302 Moved Temporarily
> > < Server: Apache-Coyote/1.1
> > < Date: Wed, 16 Nov 2011 12:16:21 GMT
> > < Expires: Thu, 01 Jan 1970 00:00:00 GMT
> > < Pragma: no-cache
> > < Cache-Control: no-cache, no-store

jsessionid not appended for stateful pages

2011-11-16 Thread thomas willomitzer
Dear all,

I've spent quite a bit of time tracking down a problem I'm having using
wicket and stateful pages.
I've enabled the jsessionid url rewriting in tomcat (by simply using the
default settings) but I get a redirect url without the jsessionid.

I've traced into tomcat's Response.encodeUrl and saw that the jsessionid is
in fact appended (but later removed for in page references by wicket -
that's fine).

What am I doing wrong and am I right in the assumption that wicket should
work without cookies?

When using curl I first get a redirect to ?1, then to /. and then a 404

$ curl -v http://localhost
* About to connect() to localhost port 80 (#0)
*   Trying 127.0.0.1... connected
* Connected to localhost (127.0.0.1) port 80 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.21.1 (i686-pc-mingw32) libcurl/7.21.1 OpenSSL/0.9.8k
zlib/1.2.3
> Host: localhost
> Accept: */*
>
< HTTP/1.1 302 Moved Temporarily
< Server: Apache-Coyote/1.1
< Set-Cookie: JSESSIONID=
CA5649F5EA37AC7CDB2D5E06170923A1; Path=/
< Date: Wed, 16 Nov 2011 12:16:15 GMT
< Expires: Thu, 01 Jan 1970 00:00:00 GMT
< Pragma: no-cache
< Cache-Control: no-cache, no-store
< Location: http://localhost/?1
< Content-Length: 0
<
* Connection #0 to host localhost left intact
* Closing connection #0

thomas@willo ~
$ curl -v http://localhost?1 
* About to connect() to localhost port 80 (#0)
*   Trying 127.0.0.1... connected
* Connected to localhost (127.0.0.1) port 80 (#0)
> GET /?1 HTTP/1.1
> User-Agent: curl/7.21.1 (i686-pc-mingw32) libcurl/7.21.1 OpenSSL/0.9.8k
zlib/1.2.3
> Host: localhost
> Accept: */*
>
< HTTP/1.1 302 Moved Temporarily
< Server: Apache-Coyote/1.1
< Date: Wed, 16 Nov 2011 12:16:21 GMT
< Expires: Thu, 01 Jan 1970 00:00:00 GMT
< Pragma: no-cache
< Cache-Control: no-cache, no-store
< Location: http://localhost/.
< Content-Length: 0
<
* Connection #0 to host localhost left intact
* Closing connection #0

thomas@willo ~
$ curl -v http://localhost/.
* About to connect() to localhost port 80 (#0)
*   Trying 127.0.0.1... connected
* Connected to localhost (127.0.0.1) port 80 (#0)
> GET /. HTTP/1.1
> User-Agent: curl/7.21.1 (i686-pc-mingw32) libcurl/7.21.1 OpenSSL/0.9.8k
zlib/1.2.3
> Host: localhost
> Accept: */*
>
< HTTP/1.1 404 Not Found
< Server: Apache-Coyote/1.1
< Content-Type: text/html;charset=utf-8
< Content-Length: 958
< Date: Wed, 16 Nov 2011 12:16:24 GMT
<
Apache Tomcat/6.0.33 - Error report HTTP Status 404 - /.type Status
reportmessage /.description The requested resource (/.) is not
available.Apache
Tomcat/6.0.33*
Connection #0 to host localhost left intact
* Closing connection #0