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

invoking sendRedirect() in a JSP causes WELD-001303

    Details

      Description

      When sendRedirect() is used inside of a JSP page, it results in the exception WELD-001303: No active contexts for scope type @ConversationScoped

      A source of this error is a typical /index.jsp redirector page:

      <% response.sendRedirect("home.jsf"); %>

      The ConversationPropagationFilter is wrapping all requests (not just JSF requests). The conversation scope is only active during JSF requests. The problem comes when ConversationPropagationFilter traps calls to sendRedirect(). It first checks whether the conversation is transient. But this check mandates that the conversation scope be active.

      ConverationPropagationFilter.java:
      ...
      @Override
      public void sendRedirect(String path) throws IOException
      {
      ConversationImpl conversation = conversation(ctx);
      if (!conversation.isTransient())

      { ... }

      super.sendRedirect(path);
      }
      ...

      ConversationImpl.java
      ...
      public boolean isTransient()
      {
      checkConversationActive();
      return _transient;
      }
      ...

      I don't understand why isTransient() is enforcing that a conversation be active. If it's not active, then that should be considered transient (or there needs to be a portable way of checking if it's active.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                pmuir Pete Muir
                Reporter:
                dan.j.allen Dan Allen
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: