ICEfaces
  1. ICEfaces
  2. ICE-1595

InputFile not working with GlassFish JSF 1.2

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.5.3
    • Fix Version/s: 1.6.1
    • Component/s: None
    • Labels:
      None
    • Environment:
      Operating System: Windows XP
      Platform: PC
    • Workaround Exists:
      Yes
    • Workaround Description:
      Hide
      I've solved the bug by placing the code from the BlockingServlet into com.icesoft.faces.webapp.xmlhttp.FileUploadServlet. I've changed the method execute(...) into(where setupPostbackKey(..) sets-up the required postBackKey into the facesContext given)

      protected void execute(HttpSession session, PersistentFacesState state) {
              if (state == null) {
                  state = getState(session, state);
              }

              if (state != null) {
                  try {
                      setupPostbackKey(state.getFacesContext());
                      state.execute();
                  } catch (RenderingException e) {
                      if (log.isDebugEnabled()) {
                          log.debug(e.getMessage());
                      }
                  }
              } else {
                  if (log.isDebugEnabled()) {
                      log.debug("null PersistentFacesState");
                  }
              }
          }
      Show
      I've solved the bug by placing the code from the BlockingServlet into com.icesoft.faces.webapp.xmlhttp.FileUploadServlet. I've changed the method execute(...) into(where setupPostbackKey(..) sets-up the required postBackKey into the facesContext given) protected void execute(HttpSession session, PersistentFacesState state) {         if (state == null) {             state = getState(session, state);         }         if (state != null) {             try {                 setupPostbackKey(state.getFacesContext());                 state.execute();             } catch (RenderingException e) {                 if (log.isDebugEnabled()) {                     log.debug(e.getMessage());                 }             }         } else {             if (log.isDebugEnabled()) {                 log.debug("null PersistentFacesState");             }         }     }

      Description

      In FileUploadServlet.java the execute() method doesn't pass the RESTORE_VIEW phase because the VIEW_STATE_PARAM parameter required by GlassFish JSF 1.2 implementation to think it's a postBack, is not encoded in FileUploadServlet.
      There should have been a similar code in FileUploadServlet.java like in BlockingServlet.java where you have:

      BlockingServlet.java:

      static {
              //We will place VIEW_STATE_PARAM in the requestMap so that
              //JSF 1.2 doesn't think the request is a postback and skip
              //execution
              try {
                  Field field = javax.faces.render.ResponseStateManager.class.getField("VIEW_STATE_PARAM");
                  if (null != field) {
                      postBackKey = (String) field.get(javax.faces.render.ResponseStateManager.class);
                  }
              } catch (Exception e) {
              }
          }

      ....

      void renderCycle(BridgeFacesContext context, Lifecycle lifecycle) {
              synchronized (context) {
                  context.setCurrentInstance();
                  DOMResponseWriter.applyBrowserDOMChanges(context);

      //Here is where the key is being set into the external context
                  if (null != postBackKey) {
                      context.getExternalContext().getRequestParameterMap()
                              .put(postBackKey, "not reload");
                  }

                  lifecycle.execute(context);
                  lifecycle.render(context);
                  context.release();
              }
          }

        Activity

        Hide
        Ken Fyten added a comment -

        Please verify that inputFile is working correctly with Glassfish v2 for 1.6.2.

        Show
        Ken Fyten added a comment - Please verify that inputFile is working correctly with Glassfish v2 for 1.6.2.
        Hide
        Ken Fyten added a comment -

        This issue pre-dates work done on inputFile in 1.6. Please review to determine if it's still relevant.

        Show
        Ken Fyten added a comment - This issue pre-dates work done on inputFile in 1.6. Please review to determine if it's still relevant.

          People

          • Assignee:
            Unassigned
            Reporter:
            Dan Leahu
          • Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: