Brian Johnson created JBSEAM-4992:
-------------------------------------

             Summary: http/https scheme redirection does not propagate request 
parameters
                 Key: JBSEAM-4992
                 URL: https://issues.jboss.org/browse/JBSEAM-4992
             Project: Seam 2
          Issue Type: Bug
          Components: Core
    Affects Versions: 2.2.0.GA
            Reporter: Brian Johnson


Using Seam 2.2.0

Have the following wildcard scheme def in my pages.xml:

<page view-id="*" scheme="http" />

For some specific pages (password change, etc), the scheme is specified as 
https.  For all other view-id defs, no scheme is specified so the default of 
http is used.

My problem is this, for a page that doesn't specify a scheme (and, hence, uses 
the default http), if the user attempts to visit the page using https, when 
Seam redirects to http, it drops the request parameters.  Near as I can tell, 
this is what happens:

in org.jboss.seam.navigation.Pages.preRender(FacesContext) after we've 
determined there's a scheme mismatch, the following is called:

Manager.instance().redirect(viewId);

that lands me in org.jboss.seam.faces.FacesManager.redirect(String), where we 
call:

redirect(viewId, null, true, true);

See that null there?  That argument is the request parameter map.  Are we 
intentionally not propagating the request parameters in this case?  If so, can 
someone please enligten me as to why?

Attempted to ask this question in the community forum 
(https://community.jboss.org/thread/200759), but have received no response.  
Read through the Seam documentation and saw no reference to propagation of 
request parameters for a scheme redirect.  Common sense would seem to suggest 
that request parameter propagation should be occurring, so given the lack of 
information on the topic in the community forum and the doc, I guess that's all 
I have to rely on.

I also tested with 2.2.2.Final and found the same results.

I can presently workaround by extending Pages and overriding preRender as 
follows:
        @Override
        public boolean preRender(FacesContext facesContext)
        {
                String viewId = getViewId(facesContext);

                // redirect to HTTPS if necessary
                String requestScheme = getRequestScheme(facesContext);
                if (requestScheme != null)
                {
                        String scheme = getScheme(viewId);
                        if (scheme != null && !requestScheme.equals(scheme))
                        {
                                Manager manager = Manager.instance();
                                if (manager instanceof FacesManager)
                                {
                                        FacesManager facesManager = 
(FacesManager) manager;
                                        Map<String, Object> requestParamMap = 
null;
                                        try
                                        {
                                                Map<String, String> 
stringStringMap = facesContext.getExternalContext()
                                                                
.getRequestParameterMap();
                                                if (stringStringMap != null)
                                                {
                                                        requestParamMap = new 
HashMap<String, Object>(stringStringMap);
                                                }
                                        }
                                        catch (Exception e)
                                        {
                                                log.error("Failed to cast param 
map", e);
                                        }
                                        facesManager.redirect(viewId, 
requestParamMap, true, true);
                                        return false;
                                }
                        }
                }
                return super.preRender(facesContext);
        }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        
_______________________________________________
seam-issues mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/seam-issues

Reply via email to