You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by "Alexander Klimetschek (JIRA)" <ji...@apache.org> on 2006/12/05 18:50:20 UTC

[jira] Created: (COCOON-1964) Redirects inside a block called via the blocks protocol fail

Redirects inside a block called via the blocks protocol fail
------------------------------------------------------------

                 Key: COCOON-1964
                 URL: http://issues.apache.org/jira/browse/COCOON-1964
             Project: Cocoon
          Issue Type: Bug
          Components: - Blocks Framework
    Affects Versions: 2.2-dev (Current SVN)
            Reporter: Alexander Klimetschek


If you do a redirect (from within a piece of flowscript "cocoon.redirectTo('cocoon:/foobar')" or via redirect-to in the sitemap) inside a block that was called via the block: protocol will fail since the re-use of the outputstream of the response (which happens to be a BlockCallHttpServletResponse) does not work.

This is due to the use of getWriter() after getOutputStream() has already been called. The servlet api says that only one of them should be called, so there is a check in the implementation of getWriter() that will throw an IllegalStateException. The patch removes that check, which is kinda hack, but I don't know of any other cases within cocoon where such a re-use is made.

The problem could be avoided if during the redirect a reset() or resetBuffer() would be called on the response, but for some reason this does not happen with a redirect from within a flowscript for a form.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (COCOON-1964) Redirects inside a block called via the blocks protocol fail

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

Alexander Klimetschek updated COCOON-1964:
------------------------------------------

    Priority: Critical  (was: Major)

Just to remind everyone: doing a redirect inside a called block and seeing it to fail is very critical IMHO. Should be fixed before 2.2 final.

Maybe a clean solution would be to implement BlockCallHttpResponse.sendRedirect() that forwards the redirect to the original request object.

> Redirects inside a block called via the blocks protocol fail
> ------------------------------------------------------------
>
>                 Key: COCOON-1964
>                 URL: https://issues.apache.org/jira/browse/COCOON-1964
>             Project: Cocoon
>          Issue Type: Bug
>          Components: - Servlet service framework
>    Affects Versions: 2.2-dev (Current SVN)
>            Reporter: Alexander Klimetschek
>            Priority: Critical
>         Attachments: cocoon-allow-redirect-in-called-block.patch
>
>
> If you do a redirect (from within a piece of flowscript "cocoon.redirectTo('cocoon:/foobar')" or via redirect-to in the sitemap) inside a block that was called via the block: protocol will fail since the re-use of the outputstream of the response (which happens to be a BlockCallHttpServletResponse) does not work.
> This is due to the use of getWriter() after getOutputStream() has already been called. The servlet api says that only one of them should be called, so there is a check in the implementation of getWriter() that will throw an IllegalStateException. The patch removes that check, which is kinda hack, but I don't know of any other cases within cocoon where such a re-use is made.
> The problem could be avoided if during the redirect a reset() or resetBuffer() would be called on the response, but for some reason this does not happen with a redirect from within a flowscript for a form.

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


[jira] Commented: (COCOON-1964) Redirects inside a block called via the blocks protocol fail

Posted by "Daniel Fagerstrom (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COCOON-1964?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12464506 ] 

Daniel Fagerstrom commented on COCOON-1964:
-------------------------------------------

The patch seem a little bit dangerous to me. Wouldn't it be better to try to fix the problem in the form flowscript?

> Redirects inside a block called via the blocks protocol fail
> ------------------------------------------------------------
>
>                 Key: COCOON-1964
>                 URL: https://issues.apache.org/jira/browse/COCOON-1964
>             Project: Cocoon
>          Issue Type: Bug
>          Components: - Blocks Framework
>    Affects Versions: 2.2-dev (Current SVN)
>            Reporter: Alexander Klimetschek
>         Attachments: cocoon-allow-redirect-in-called-block.patch
>
>
> If you do a redirect (from within a piece of flowscript "cocoon.redirectTo('cocoon:/foobar')" or via redirect-to in the sitemap) inside a block that was called via the block: protocol will fail since the re-use of the outputstream of the response (which happens to be a BlockCallHttpServletResponse) does not work.
> This is due to the use of getWriter() after getOutputStream() has already been called. The servlet api says that only one of them should be called, so there is a check in the implementation of getWriter() that will throw an IllegalStateException. The patch removes that check, which is kinda hack, but I don't know of any other cases within cocoon where such a re-use is made.
> The problem could be avoided if during the redirect a reset() or resetBuffer() would be called on the response, but for some reason this does not happen with a redirect from within a flowscript for a form.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (COCOON-1964) Redirects inside a block called via the blocks protocol fail

Posted by "Alexander Klimetschek (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/COCOON-1964?page=all ]

Alexander Klimetschek updated COCOON-1964:
------------------------------------------

    Attachment: cocoon-allow-redirect-in-called-block.patch

Affects only the cocoon-blocks-fw-impl module.

> Redirects inside a block called via the blocks protocol fail
> ------------------------------------------------------------
>
>                 Key: COCOON-1964
>                 URL: http://issues.apache.org/jira/browse/COCOON-1964
>             Project: Cocoon
>          Issue Type: Bug
>          Components: - Blocks Framework
>    Affects Versions: 2.2-dev (Current SVN)
>            Reporter: Alexander Klimetschek
>         Attachments: cocoon-allow-redirect-in-called-block.patch
>
>
> If you do a redirect (from within a piece of flowscript "cocoon.redirectTo('cocoon:/foobar')" or via redirect-to in the sitemap) inside a block that was called via the block: protocol will fail since the re-use of the outputstream of the response (which happens to be a BlockCallHttpServletResponse) does not work.
> This is due to the use of getWriter() after getOutputStream() has already been called. The servlet api says that only one of them should be called, so there is a check in the implementation of getWriter() that will throw an IllegalStateException. The patch removes that check, which is kinda hack, but I don't know of any other cases within cocoon where such a re-use is made.
> The problem could be avoided if during the redirect a reset() or resetBuffer() would be called on the response, but for some reason this does not happen with a redirect from within a flowscript for a form.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (COCOON-1964) Redirects inside a block called via the servlet protocol fail

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

Reinhard Poetz updated COCOON-1964:
-----------------------------------

    Summary: Redirects inside a block called via the servlet protocol fail  (was: Redirects inside a block called via the blocks protocol fail)

> Redirects inside a block called via the servlet protocol fail
> -------------------------------------------------------------
>
>                 Key: COCOON-1964
>                 URL: https://issues.apache.org/jira/browse/COCOON-1964
>             Project: Cocoon
>          Issue Type: Bug
>          Components: - Servlet service framework
>    Affects Versions: 2.2-dev (Current SVN)
>            Reporter: Alexander Klimetschek
>            Priority: Critical
>         Attachments: cocoon-allow-redirect-in-called-block.patch
>
>
> If you do a redirect (from within a piece of flowscript "cocoon.redirectTo('cocoon:/foobar')" or via redirect-to in the sitemap) inside a block that was called via the block: protocol will fail since the re-use of the outputstream of the response (which happens to be a BlockCallHttpServletResponse) does not work.
> This is due to the use of getWriter() after getOutputStream() has already been called. The servlet api says that only one of them should be called, so there is a check in the implementation of getWriter() that will throw an IllegalStateException. The patch removes that check, which is kinda hack, but I don't know of any other cases within cocoon where such a re-use is made.
> The problem could be avoided if during the redirect a reset() or resetBuffer() would be called on the response, but for some reason this does not happen with a redirect from within a flowscript for a form.

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