Uploaded image for project: 'Weld'
  1. Weld
  2. WELD-1218

Can't call externalContext.redirect with a cid inside

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • Major
    • 2.0.0.Beta1
    • 1.1.5.Final, 1.1.8.Final
    • None
    • None

    Description

      In my application, I need to redirect to another conversation.

      So I do that :

      @Inject
      private HttpConversationContext conversationContext;
      
      public void redirect() throws IOException {
      	final ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext();
      	final Map<String, List<String>> parameters = new HashMap<String, List<String>>();
      	final String conversationId = getConversationId();
      	if (conversationId != null) {
      		parameters.put(conversationContext.getParameterName(), Arrays.asList(conversationId));
      	}
      	//... put other parameters in the map
      	externalContext.redirect(externalContext.encodeRedirectURL(externalContext.getRequestContextPath()+getViewId(), parameters));
      }
      

      (getConversationId() & getViewId() returns the cid number of the conversation I want to redirect to, and the faces viewId of my target page)

      If I am in the conversation 2 & I want to redirect to conversation 1, here is the String passed to externalContext.redirect : "/mypage.xhtml?cid=1&otherparam=value"

      The problem is that my browser is finally redirected to : "/mypage.xhtml?cid=2&cid=1&otherparam=value" !

      I think that the problem comes from ConversationPropagationFilter.java:78 : in the FacesUrlTransformer, there is no check if in the http parameters, cid has already been specified or not.

      Attachments

        Issue Links

          Activity

            People

              rhn-engineering-jharting Jozef Hartinger
              aogier_jira Anthony O. (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: