ICEfaces
  1. ICEfaces
  2. ICE-1628

FileUploadServlet should use the correct viewNumber to get the correct PersistentFacesState

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.5.3
    • Fix Version/s: 1.7, 1.7.1
    • Component/s: None
    • Labels:
      None
    • Environment:
      Liferay + Portlets + IceFaces
    • Workaround Exists:
      Yes
    • Workaround Description:
      Hide
      For this to work, I've placed in com.icesoft.faces.component.inputfile.FileUploadServlet, in doPost(...) method the following code:

      request.getSession(false).setAttribute(PersistentFacesServlet.CURRENT_VIEW_NUMBER, request.getParameter("viewNumber"));

      where the viewNumber is a request parameter encoded in the iframe generated by the InputFileRenderer class.

      In com.icesoft.faces.component.inputfile.InputFile you must have(where viewNumber is encoded in the queryString):

      String getQueryString(FacesContext facesContext) {
              String inputTextClass = getInputTextClass();
              String buttonClass = getButtonClass();
              String label = getLabel();
              boolean uniqueFolder = isUniqueFolder();
              String queryString =
                      "?" + FILE_UPLOAD_COMPONENT_ID + "=" + getRegistrationId() +
                              "&disabled=" + isDisabled() +
                              "&inputTextClass=" + inputTextClass +
                              "&buttonClass=" + buttonClass +
                              "&label=" + label +
                              "&uniqueFolder=" + uniqueFolder +
                              "&cssFile=" + getCssFile() +
                              "&viewNumber=" + facesContext.getExternalContext().getRequestParameterMap().get("viewNumber");
              return queryString;
          }
      Show
      For this to work, I've placed in com.icesoft.faces.component.inputfile.FileUploadServlet, in doPost(...) method the following code: request.getSession(false).setAttribute(PersistentFacesServlet.CURRENT_VIEW_NUMBER, request.getParameter("viewNumber")); where the viewNumber is a request parameter encoded in the iframe generated by the InputFileRenderer class. In com.icesoft.faces.component.inputfile.InputFile you must have(where viewNumber is encoded in the queryString): String getQueryString(FacesContext facesContext) {         String inputTextClass = getInputTextClass();         String buttonClass = getButtonClass();         String label = getLabel();         boolean uniqueFolder = isUniqueFolder();         String queryString =                 "?" + FILE_UPLOAD_COMPONENT_ID + "=" + getRegistrationId() +                         "&disabled=" + isDisabled() +                         "&inputTextClass=" + inputTextClass +                         "&buttonClass=" + buttonClass +                         "&label=" + label +                         "&uniqueFolder=" + uniqueFolder +                         "&cssFile=" + getCssFile() +                         "&viewNumber=" + facesContext.getExternalContext().getRequestParameterMap().get("viewNumber");         return queryString;     }

      Description

      The FileUploadServlet doesn't take in account the current viewNumber to retrieve the correct PersistentFacesState. This code:

      Object current_view_number = session.getAttribute(PersistentFacesServlet.CURRENT_VIEW_NUMBER);

      would only work if the PersistentFacesServlet.CURRENT_VIEW_NUMBER session attribute would have been set at each call to the FileUploadServlet servlet. If we use the 1.5.3 version of IceFaces(without setting this session attribute), the current view number is the one from the last portlet on the page.

        Activity

        Hide
        Ken Fyten added a comment -

        This issue is quite old and pre-dates the fixes to file-upload applied in 1.6. Please review to determine if it's still relevant.

        Show
        Ken Fyten added a comment - This issue is quite old and pre-dates the fixes to file-upload applied in 1.6. Please review to determine if it's still relevant.
        Hide
        Mark Collette added a comment -

        This was fixed much before ICEfaces 1.7. A Subversion annotation shows the line of code going back to revision 15241, or November 23, 2007, but that functionality could easily have been in there beforehand.

        Show
        Mark Collette added a comment - This was fixed much before ICEfaces 1.7. A Subversion annotation shows the line of code going back to revision 15241, or November 23, 2007, but that functionality could easily have been in there beforehand.

          People

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

            Dates

            • Created:
              Updated:
              Resolved: