[richfaces-issues] [JBoss JIRA] Commented: (RF-4113) IE 7 type mismatch when get 302 redirection

Tomas Hampl (JIRA) jira-events at lists.jboss.org
Mon Dec 29 09:43:54 EST 2008


    [ https://jira.jboss.org/jira/browse/RF-4113?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12444206#action_12444206 ] 

Tomas Hampl commented on RF-4113:
---------------------------------

I found workaround for this bug. To the destination page of 302 or 301 (in header location) you can add something like this:
 //in jsp
 response.setHeader("Location", "login.jsp");
 response.setHeader("Ajax-Response", "redirect");

this will redirect only ajax4jsf (richfaces ajax) requests!
So our example : We have login.jsp page with some login form and we redirect customer to login page if his session is broken. Page source looks like this

....
...
 //invalid session cookie to allow another login
....
//richfaces  broken session redirection to login page
 response.setHeader("Location", "login.jsp");
 response.setHeader("Ajax-Response", "redirect");
.....
...
//login form


If customer open login.jsp in browser he will get it. If he click on richfaces component, ajax request get 302(becaouse hes session is invalid or something like that) and redirect to the location (login.jsp) ajax4jsf parse it and don`t do the replacePage function where is the problem with window.document.open or oldDocOpen.apply in IE but do the  window.location = req.getResponseHeader("Location"); witch works fine for me

> IE 7 type mismatch when get 302 redirection
> -------------------------------------------
>
>                 Key: RF-4113
>                 URL: https://jira.jboss.org/jira/browse/RF-4113
>             Project: RichFaces
>          Issue Type: Bug
>    Affects Versions: 3.2.2
>         Environment: windows XP servicepack 3 -> internet explorer 7 browser
>            Reporter: Tomas Hampl
>            Assignee: Nick Belaevski
>             Fix For: Future
>
>
> When session is invalided with spring security . Spring security sends status 302 and redirect to custom page. When I click to open a modal panel and ajax get back 302 redirection there is type mismatch javascript error in Internet explorer, but in firefox works well.
> is there any workaround or something ?
> Problem is on this line "window.document.open(req.getContentType(),true);" .  ("req.getContentType()" is ok)
> here is debug output:
> debug[15:06:22,252]: Have Event [object Object] with properties: target: [object], srcElement: [object], type: click
> debug[15:06:22,252]: NEW AJAX REQUEST !!! with form :j_id16
> debug[15:06:22,268]: Append hidden control j_id16:folderTree:j__id50:0::_defaultNodeFaceNodeExpanded with value [false] and value attribute [false]
> debug[15:06:22,268]: Append hidden control j_id16:folderTree:j__id50:1::_defaultNodeFaceNodeExpanded with value [false] and value attribute [false]
> debug[15:06:22,284]: Append hidden control j_id16:folderTree:j__id50:1:j__id50:0::_defaultNodeFaceNodeExpanded with value [false] and value attribute [false]
> debug[15:06:22,284]: Append hidden control j_id16:folderTree:input with value [j_id16:folderTree:j__id50:1::_defaultNodeFace] and value attribute [j_id16:folderTree:j__id50:1::_defaultNodeFace]
> debug[15:06:22,299]: Append hidden control j_id16_SUBMIT with value [1] and value attribute [1]
> debug[15:06:22,299]: Append hidden control javax.faces.ViewState with value [VWVnSkh++7wEiAwpAMM+MtuU9eaGfD3Q60e5hNQHw/niFHXZVXk/FGv4cR4XOgWPAYrhd8JH48HNyraATgehx1EqghLjL+nUGGwwHsa6hNLtJsA1TnvwGJeUZ1bKSqKi] and value attribute [VWVnSkh++7wEiAwpAMM+MtuU9eaGfD3Q60e5hNQHw/niFHXZVXk/FGv4cR4XOgWPAYrhd8JH48HNyraATgehx1EqghLjL+nUGGwwHsa6hNLtJsA1TnvwGJeUZ1bKSqKi]
> debug[15:06:22,315]: parameter ajaxSingle with value j_id16:folderTree
> debug[15:06:22,315]: parameter j_id16:folderTree:selectedNode with value j_id16:folderTree:j__id50:1::_defaultNodeFace
> debug[15:06:22,330]: Start XmlHttpRequest
> debug[15:06:22,346]: Reqest state : 1
> debug[15:06:22,346]: QueryString: AJAXREQUEST=_viewRoot&j_id16%3AfolderTree%3Aj__id50%3A0%3A%3A_defaultNodeFaceNodeExpanded=false&j_id16%3AfolderTree%3Aj__id50%3A1%3A%3A_defaultNodeFaceNodeExpanded=false&j_id16%3AfolderTree%3Aj__id50%3A1%3Aj__id50%3A0%3A%3A_defaultNodeFaceNodeExpanded=false&j_id16%3AfolderTree%3Ainput=j_id16%3AfolderTree%3Aj__id50%3A1%3A%3A_defaultNodeFace&j_id16_SUBMIT=1&javax.faces.ViewState=VWVnSkh%2B%2B7wEiAwpAMM%2BMtuU9eaGfD3Q60e5hNQHw%2FniFHXZVXk%2FFGv4cR4XOgWPAYrhd8JH48HNyraATgehx1EqghLjL%2BnUGGwwHsa6hNLtJsA1TnvwGJeUZ1bKSqKi&ajaxSingle=j_id16%3AfolderTree&j_id16%3AfolderTree%3AselectedNode=j_id16%3AfolderTree%3Aj__id50%3A1%3A%3A_defaultNodeFace&
> debug[15:06:22,487]: Reqest state : 2
> debug[15:06:22,487]: Reqest state : 3
> debug[15:06:22,502]: Reqest state : 4
> debug[15:06:22,502]: Reqest end with state 4
> debug[15:06:22,518]: Response  with content-type: text/html;charset=UTF-8
> debug[15:06:22,518]: Full response content: 
> <html xmlns="http://www.w3.org/1999/xhtml"><head>    <title></title>  </head>
>   <body>         text    </body></html>
> warn[15:06:22,534]: No ajax response header 
> debug[15:06:22,534]: Header Location not found, search in <meta>
> debug[15:06:22,549]: replace all page content with response
> debug[15:06:22,549]: setup custom document.open method
> debug[15:06:22,627]: exception during write page content undefined
> debug[15:06:22,643]: response has parsed as DOM documnet.
> debug[15:06:22,721]: append new node in documen

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

       




More information about the richfaces-issues mailing list