You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Ivaylo Stoykov (JIRA)" <ji...@apache.org> on 2010/11/12 00:04:15 UTC

[jira] Created: (WICKET-3161) Can not create cookies

Can not create cookies
----------------------

                 Key: WICKET-3161
                 URL: https://issues.apache.org/jira/browse/WICKET-3161
             Project: Wicket
          Issue Type: Bug
          Components: wicket
    Affects Versions: 1.5-M3
         Environment: Windows 7, Intel i7
            Reporter: Ivaylo Stoykov


Hi,

I'm migrating to wicket 1.5-M3 and I've encountered a problem. I can not create cookies (I presume that I can't delete them either).
I've looked through the source code and this is what I found:

I add the cookie to the response and I end up with a nice HeaderBufferingWebResponse which contains BufferedWebResponse$AddCookieAction.
But then redirectTo(Url, RequestCycle) from WebPageRenderer class is called. Here is the method:
        
       private void redirectTo(Url url, RequestCycle requestCycle)
	{
		WebResponse response = (WebResponse)requestCycle.getResponse();
		String relativeUrl = requestCycle.getUrlRenderer().renderUrl(url);
		response.reset();
		response.sendRedirect(relativeUrl);
	}
response.reset(); - removes all actions from the request.
So after this method my request has got only BufferedWebResponse$SendRedirectAction.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Re: [jira] Resolved: (WICKET-3161) Can not create cookies

Posted by Martin Grigorov <mg...@apache.org>.
On Tue, Nov 16, 2010 at 3:10 AM, Jeremy Thomerson <jr...@apache.org>wrote:

>
>
> On Sat, Nov 13, 2010 at 7:18 AM, Peter Ertl (JIRA) <ji...@apache.org>wrote:
>
>>
>>     [
>> https://issues.apache.org/jira/browse/WICKET-3161?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel]
>>
>> Peter Ertl resolved WICKET-3161.
>> --------------------------------
>>
>>       Resolution: Fixed
>>    Fix Version/s: 1.5-M4
>>
>> I am confident that this issue is fixed but I am not very happy about the
>> solution. Please feel free to improve it or send me feedback.
>>
>> I also added a test case in wicket source to test for existance of cookies
>> that were set during a link listener event.
>>
>> General question to wicket devs: Is it ok to "resolve issue" if I am not
>> happy with a solution but the issue is fixed?
>
>
> I don't see why not, although if you're really dissatisfied with the
> solution, you may want to open a follow-up ticket to clean up the solution.
>
>
> Jeremy
>
>>
>
> My approach in such cases is to attach a patch and ask for review.

martin-g

Re: [jira] Resolved: (WICKET-3161) Can not create cookies

Posted by Jeremy Thomerson <jr...@apache.org>.
On Sat, Nov 13, 2010 at 7:18 AM, Peter Ertl (JIRA) <ji...@apache.org> wrote:

>
>     [
> https://issues.apache.org/jira/browse/WICKET-3161?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel]
>
> Peter Ertl resolved WICKET-3161.
> --------------------------------
>
>       Resolution: Fixed
>    Fix Version/s: 1.5-M4
>
> I am confident that this issue is fixed but I am not very happy about the
> solution. Please feel free to improve it or send me feedback.
>
> I also added a test case in wicket source to test for existance of cookies
> that were set during a link listener event.
>
> General question to wicket devs: Is it ok to "resolve issue" if I am not
> happy with a solution but the issue is fixed?


I don't see why not, although if you're really dissatisfied with the
solution, you may want to open a follow-up ticket to clean up the solution.


Jeremy

>

[jira] Issue Comment Edited: (WICKET-3161) Can not create cookies

Posted by "Ivaylo Stoykov (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-3161?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12931361#action_12931361 ] 

Ivaylo Stoykov edited comment on WICKET-3161 at 11/12/10 5:41 AM:
------------------------------------------------------------------

Hi Martin,

I don't set a render strategy, so I should be using REDIRECT_TO_BUFFER which is the default.
I'm attaching a quickstart.

      was (Author: istoykov):
    Hi Martin,

I don't set a render strategy, so I should be using REDIRECT_TO_BUFFER which is the default.
I'm attaching the quickstart.
  
> Can not create cookies
> ----------------------
>
>                 Key: WICKET-3161
>                 URL: https://issues.apache.org/jira/browse/WICKET-3161
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.5-M3
>         Environment: Windows 7, Intel i7
>            Reporter: Ivaylo Stoykov
>         Attachments: quickstart.zip
>
>
> Hi,
> I'm migrating to wicket 1.5-M3 and I've encountered a problem. I can not create cookies (I presume that I can't delete them either).
> I've looked through the source code and this is what I found:
> I add the cookie to the response and I end up with a nice HeaderBufferingWebResponse which contains BufferedWebResponse$AddCookieAction.
> But then redirectTo(Url, RequestCycle) from WebPageRenderer class is called. Here is the method:
>         
>        private void redirectTo(Url url, RequestCycle requestCycle)
> 	{
> 		WebResponse response = (WebResponse)requestCycle.getResponse();
> 		String relativeUrl = requestCycle.getUrlRenderer().renderUrl(url);
> 		response.reset();
> 		response.sendRedirect(relativeUrl);
> 	}
> response.reset(); - removes all actions from the request.
> So after this method my request has got only BufferedWebResponse$SendRedirectAction.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (WICKET-3161) Can not create cookies

Posted by "Peter Ertl (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-3161?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Peter Ertl reassigned WICKET-3161:
----------------------------------

    Assignee: Peter Ertl

> Can not create cookies
> ----------------------
>
>                 Key: WICKET-3161
>                 URL: https://issues.apache.org/jira/browse/WICKET-3161
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.5-M3
>         Environment: Windows 7, Intel i7
>            Reporter: Ivaylo Stoykov
>            Assignee: Peter Ertl
>         Attachments: quickstart.zip
>
>
> Hi,
> I'm migrating to wicket 1.5-M3 and I've encountered a problem. I can not create cookies (I presume that I can't delete them either).
> I've looked through the source code and this is what I found:
> I add the cookie to the response and I end up with a nice HeaderBufferingWebResponse which contains BufferedWebResponse$AddCookieAction.
> But then redirectTo(Url, RequestCycle) from WebPageRenderer class is called. Here is the method:
>         
>        private void redirectTo(Url url, RequestCycle requestCycle)
> 	{
> 		WebResponse response = (WebResponse)requestCycle.getResponse();
> 		String relativeUrl = requestCycle.getUrlRenderer().renderUrl(url);
> 		response.reset();
> 		response.sendRedirect(relativeUrl);
> 	}
> response.reset(); - removes all actions from the request.
> So after this method my request has got only BufferedWebResponse$SendRedirectAction.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WICKET-3161) Can not create cookies

Posted by "Ivaylo Stoykov (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-3161?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12931361#action_12931361 ] 

Ivaylo Stoykov commented on WICKET-3161:
----------------------------------------

Hi Martin,

I don't set a render strategy, so I should be using REDIRECT_TO_BUFFER which is the default.
I'm attaching the quickstart.

> Can not create cookies
> ----------------------
>
>                 Key: WICKET-3161
>                 URL: https://issues.apache.org/jira/browse/WICKET-3161
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.5-M3
>         Environment: Windows 7, Intel i7
>            Reporter: Ivaylo Stoykov
>         Attachments: quickstart.zip
>
>
> Hi,
> I'm migrating to wicket 1.5-M3 and I've encountered a problem. I can not create cookies (I presume that I can't delete them either).
> I've looked through the source code and this is what I found:
> I add the cookie to the response and I end up with a nice HeaderBufferingWebResponse which contains BufferedWebResponse$AddCookieAction.
> But then redirectTo(Url, RequestCycle) from WebPageRenderer class is called. Here is the method:
>         
>        private void redirectTo(Url url, RequestCycle requestCycle)
> 	{
> 		WebResponse response = (WebResponse)requestCycle.getResponse();
> 		String relativeUrl = requestCycle.getUrlRenderer().renderUrl(url);
> 		response.reset();
> 		response.sendRedirect(relativeUrl);
> 	}
> response.reset(); - removes all actions from the request.
> So after this method my request has got only BufferedWebResponse$SendRedirectAction.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (WICKET-3161) Can not create cookies

Posted by "Peter Ertl (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-3161?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Peter Ertl resolved WICKET-3161.
--------------------------------

       Resolution: Fixed
    Fix Version/s: 1.5-M4

I am confident that this issue is fixed but I am not very happy about the solution. Please feel free to improve it or send me feedback.

I also added a test case in wicket source to test for existance of cookies that were set during a link listener event.

General question to wicket devs: Is it ok to "resolve issue" if I am not happy with a solution but the issue is fixed?


> Can not create cookies
> ----------------------
>
>                 Key: WICKET-3161
>                 URL: https://issues.apache.org/jira/browse/WICKET-3161
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.5-M3
>         Environment: Windows 7, Intel i7
>            Reporter: Ivaylo Stoykov
>            Assignee: Peter Ertl
>             Fix For: 1.5-M4
>
>         Attachments: quickstart.zip
>
>
> Hi,
> I'm migrating to wicket 1.5-M3 and I've encountered a problem. I can not create cookies (I presume that I can't delete them either).
> I've looked through the source code and this is what I found:
> I add the cookie to the response and I end up with a nice HeaderBufferingWebResponse which contains BufferedWebResponse$AddCookieAction.
> But then redirectTo(Url, RequestCycle) from WebPageRenderer class is called. Here is the method:
>         
>        private void redirectTo(Url url, RequestCycle requestCycle)
> 	{
> 		WebResponse response = (WebResponse)requestCycle.getResponse();
> 		String relativeUrl = requestCycle.getUrlRenderer().renderUrl(url);
> 		response.reset();
> 		response.sendRedirect(relativeUrl);
> 	}
> response.reset(); - removes all actions from the request.
> So after this method my request has got only BufferedWebResponse$SendRedirectAction.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WICKET-3161) Can not create cookies

Posted by "Martin Grigorov (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-3161?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12931345#action_12931345 ] 

Martin Grigorov commented on WICKET-3161:
-----------------------------------------

Hi Ivaylo,

Which render strategy do you use in your application ? (do you use getRequestCycleSettings().setRenderStragegy())

The purpose of the Action's is to cache the actual behavior for the response after the redirect. I.e. you set a cookie to the response, at the end of the request cycle this response is saved in org.apache.wicket.protocol.http.WebApplication.storeBufferedResponse(String, Url, BufferedWebResponse), then a redirect (without the cookie) is being made, and when the redirect comes back org.apache.wicket.request.mapper.BufferedResponseMapper.hasBufferedResponse(Url) will see there is a cached response and will use it without re-doing the whole request cycle processing, and now the cookie action will be executed.

This code has been changed between 1.5-M2.1 and M3 so it indeed could be broken.
Can you create a quickstart application so we can debug it more easily ?
Thanks!

> Can not create cookies
> ----------------------
>
>                 Key: WICKET-3161
>                 URL: https://issues.apache.org/jira/browse/WICKET-3161
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.5-M3
>         Environment: Windows 7, Intel i7
>            Reporter: Ivaylo Stoykov
>
> Hi,
> I'm migrating to wicket 1.5-M3 and I've encountered a problem. I can not create cookies (I presume that I can't delete them either).
> I've looked through the source code and this is what I found:
> I add the cookie to the response and I end up with a nice HeaderBufferingWebResponse which contains BufferedWebResponse$AddCookieAction.
> But then redirectTo(Url, RequestCycle) from WebPageRenderer class is called. Here is the method:
>         
>        private void redirectTo(Url url, RequestCycle requestCycle)
> 	{
> 		WebResponse response = (WebResponse)requestCycle.getResponse();
> 		String relativeUrl = requestCycle.getUrlRenderer().renderUrl(url);
> 		response.reset();
> 		response.sendRedirect(relativeUrl);
> 	}
> response.reset(); - removes all actions from the request.
> So after this method my request has got only BufferedWebResponse$SendRedirectAction.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WICKET-3161) Can not create cookies

Posted by "Hudson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-3161?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12931671#action_12931671 ] 

Hudson commented on WICKET-3161:
--------------------------------

Integrated in Apache Wicket 1.5.x #507 (See [https://hudson.apache.org/hudson/job/Apache%20Wicket%201.5.x/507/])
    WICKET-3161: added missing apache license headers
WICKET-3161: improve naming
WICKET-3161: added test case
WICKET-3161: cookies that are set during a buffered web response will not be transferred over redirecting. 

The solution to this issue is not what I consider pretty so please take time to review and feel free to improve it.

Sorry for the last commit message (I intended to create a path but was clicking too fast)

The previous commit is part of WICKET-3161


> Can not create cookies
> ----------------------
>
>                 Key: WICKET-3161
>                 URL: https://issues.apache.org/jira/browse/WICKET-3161
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.5-M3
>         Environment: Windows 7, Intel i7
>            Reporter: Ivaylo Stoykov
>            Assignee: Peter Ertl
>             Fix For: 1.5-M4
>
>         Attachments: quickstart.zip
>
>
> Hi,
> I'm migrating to wicket 1.5-M3 and I've encountered a problem. I can not create cookies (I presume that I can't delete them either).
> I've looked through the source code and this is what I found:
> I add the cookie to the response and I end up with a nice HeaderBufferingWebResponse which contains BufferedWebResponse$AddCookieAction.
> But then redirectTo(Url, RequestCycle) from WebPageRenderer class is called. Here is the method:
>         
>        private void redirectTo(Url url, RequestCycle requestCycle)
> 	{
> 		WebResponse response = (WebResponse)requestCycle.getResponse();
> 		String relativeUrl = requestCycle.getUrlRenderer().renderUrl(url);
> 		response.reset();
> 		response.sendRedirect(relativeUrl);
> 	}
> response.reset(); - removes all actions from the request.
> So after this method my request has got only BufferedWebResponse$SendRedirectAction.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WICKET-3161) Can not create cookies

Posted by "Hudson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-3161?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12931804#action_12931804 ] 

Hudson commented on WICKET-3161:
--------------------------------

Integrated in Apache Wicket 1.5.x #511 (See [https://hudson.apache.org/hudson/job/Apache%20Wicket%201.5.x/511/])
    

> Can not create cookies
> ----------------------
>
>                 Key: WICKET-3161
>                 URL: https://issues.apache.org/jira/browse/WICKET-3161
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.5-M3
>         Environment: Windows 7, Intel i7
>            Reporter: Ivaylo Stoykov
>            Assignee: Peter Ertl
>             Fix For: 1.5-M4
>
>         Attachments: quickstart.zip
>
>
> Hi,
> I'm migrating to wicket 1.5-M3 and I've encountered a problem. I can not create cookies (I presume that I can't delete them either).
> I've looked through the source code and this is what I found:
> I add the cookie to the response and I end up with a nice HeaderBufferingWebResponse which contains BufferedWebResponse$AddCookieAction.
> But then redirectTo(Url, RequestCycle) from WebPageRenderer class is called. Here is the method:
>         
>        private void redirectTo(Url url, RequestCycle requestCycle)
> 	{
> 		WebResponse response = (WebResponse)requestCycle.getResponse();
> 		String relativeUrl = requestCycle.getUrlRenderer().renderUrl(url);
> 		response.reset();
> 		response.sendRedirect(relativeUrl);
> 	}
> response.reset(); - removes all actions from the request.
> So after this method my request has got only BufferedWebResponse$SendRedirectAction.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (WICKET-3161) Can not create cookies

Posted by "Ivaylo Stoykov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-3161?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ivaylo Stoykov updated WICKET-3161:
-----------------------------------

    Attachment: quickstart.zip

> Can not create cookies
> ----------------------
>
>                 Key: WICKET-3161
>                 URL: https://issues.apache.org/jira/browse/WICKET-3161
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.5-M3
>         Environment: Windows 7, Intel i7
>            Reporter: Ivaylo Stoykov
>         Attachments: quickstart.zip
>
>
> Hi,
> I'm migrating to wicket 1.5-M3 and I've encountered a problem. I can not create cookies (I presume that I can't delete them either).
> I've looked through the source code and this is what I found:
> I add the cookie to the response and I end up with a nice HeaderBufferingWebResponse which contains BufferedWebResponse$AddCookieAction.
> But then redirectTo(Url, RequestCycle) from WebPageRenderer class is called. Here is the method:
>         
>        private void redirectTo(Url url, RequestCycle requestCycle)
> 	{
> 		WebResponse response = (WebResponse)requestCycle.getResponse();
> 		String relativeUrl = requestCycle.getUrlRenderer().renderUrl(url);
> 		response.reset();
> 		response.sendRedirect(relativeUrl);
> 	}
> response.reset(); - removes all actions from the request.
> So after this method my request has got only BufferedWebResponse$SendRedirectAction.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WICKET-3161) Can not create cookies

Posted by "Peter Ertl (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-3161?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12931647#action_12931647 ] 

Peter Ertl commented on WICKET-3161:
------------------------------------

Removing reset() will not change anything

The set-cookie action gets lost when redirecting_to_buffer to redirect to a clean url after invoking the link listener, in WebPageRenderer in approx. line 123 in trunk


		// keep the original response
		final Response originalResponse = requestCycle.getResponse();

		// buffered web response for page 
   **** (the set-cookie action in originalResponse, which is of type HeaderBufferingWebResponse, is dropped here) ****
		BufferedWebResponse response = new BufferedWebResponse((WebResponse)originalResponse);

		// keep the original base URL
		Url originalBaseUrl = requestCycle.getUrlRenderer().setBaseUrl(targetUrl);

copying originalResponse over to response does not copy over the set cookie action.

still investigating further on this...

> Can not create cookies
> ----------------------
>
>                 Key: WICKET-3161
>                 URL: https://issues.apache.org/jira/browse/WICKET-3161
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.5-M3
>         Environment: Windows 7, Intel i7
>            Reporter: Ivaylo Stoykov
>         Attachments: quickstart.zip
>
>
> Hi,
> I'm migrating to wicket 1.5-M3 and I've encountered a problem. I can not create cookies (I presume that I can't delete them either).
> I've looked through the source code and this is what I found:
> I add the cookie to the response and I end up with a nice HeaderBufferingWebResponse which contains BufferedWebResponse$AddCookieAction.
> But then redirectTo(Url, RequestCycle) from WebPageRenderer class is called. Here is the method:
>         
>        private void redirectTo(Url url, RequestCycle requestCycle)
> 	{
> 		WebResponse response = (WebResponse)requestCycle.getResponse();
> 		String relativeUrl = requestCycle.getUrlRenderer().renderUrl(url);
> 		response.reset();
> 		response.sendRedirect(relativeUrl);
> 	}
> response.reset(); - removes all actions from the request.
> So after this method my request has got only BufferedWebResponse$SendRedirectAction.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.