Package com.liferay.util.servlet

Examples of com.liferay.util.servlet.DynamicServletRequest


  public static UploadPortletRequest getUploadPortletRequest(
    ActionRequest req) {

    ActionRequestImpl actionReq = (ActionRequestImpl)req;
    DynamicServletRequest dynamicReq =
      (DynamicServletRequest)actionReq.getHttpServletRequest();
    UploadServletRequest uploadReq =
      (UploadServletRequest)dynamicReq.getRequest();

    return new UploadPortletRequest(
      uploadReq, getPortletNamespace(actionReq.getPortletName()));
  }
View Full Code Here


              queryParams.put(name, newValues);
            }
          }

          DynamicServletRequest dynamicReq =
            new DynamicServletRequest(httpReq);

          Iterator itr = queryParams.entrySet().iterator();

          while (itr.hasNext()) {
            Map.Entry entry = (Map.Entry)itr.next();

            String name = (String)entry.getKey();
            String[] values = (String[])entry.getValue();

            String[] oldValues =
              dynamicReq.getParameterValues(name);

            if (oldValues == null) {
              dynamicReq.setParameterValues(name, values);
            }
            else {
              String[] newValues =
                new String[values.length + oldValues.length];

              System.arraycopy(
                values, 0, newValues, 0, values.length);

              System.arraycopy(
                oldValues, 0, newValues, values.length,
                oldValues.length);

              dynamicReq.setParameterValues(name, newValues);
            }
          }

          httpReq = dynamicReq;
        }
View Full Code Here

               WindowState windowState, PortletMode portletMode,
               PortletPreferences prefs, String layoutId) {

    _portletName = portlet.getPortletId();

    DynamicServletRequest dynamicReq =
      new DynamicServletRequest(req, false);

    Enumeration enu = null;

    Map renderParameters = null;

    boolean portletFocus = false;

    if (_portletName.equals(req.getParameter(
        WebKeys.PORTLET_URL_PORTLET_NAME))) {

      // Request was targeted to this portlet

      boolean action = ParamUtil.getBoolean(
        req, WebKeys.PORTLET_URL_ACTION);

      if (!action) {

        // Request was triggered by a render URL

         portletFocus = true;
      }
      else if (action && isAction()) {

        // Request was triggered by an action URL and is being processed
        // by com.liferay.portlet.ActionRequestImpl

         portletFocus = true;
      }
    }

    if (portletFocus) {
      renderParameters = new HashMap();

      RenderParametersPool.put(
        req, layoutId, _portletName, renderParameters);

      enu = req.getParameterNames();
    }
    else {
      renderParameters = RenderParametersPool.get(
        req, layoutId, _portletName);

      enu = Collections.enumeration(renderParameters.keySet());
    }

    String prefix = PortalUtil.getPortletNamespace(_portletName);

    while (enu.hasMoreElements()) {
      String param = (String)enu.nextElement();

      if (param.startsWith(prefix)) {
        String newParam =
          param.substring(prefix.length(), param.length());
        String[] values = null;

        if (portletFocus) {
          if (req instanceof UploadServletRequest) {
            UploadServletRequest uploadServletReq = (UploadServletRequest)req;
            if(uploadServletReq.getFile(param) == null) {
              values = uploadServletReq.getParameterValues(param);
            } else {
              values = new String[0];
            }
          } else {
            values = req.getParameterValues(param);
          }

          renderParameters.put(param, values);
        }
        else {
          values = (String[])renderParameters.get(param);
        }

        dynamicReq.setParameterValues(newParam, values);
      }
      else {

        // Allow regular parameters to pass through

        if (!PortalUtil.isReservedParameter(param)) {
          String[] values = null;

          if (portletFocus) {
            values = req.getParameterValues(param);

            renderParameters.put(param, values);
          }
          else {
            values = (String[])renderParameters.get(param);
          }

          dynamicReq.setParameterValues(param, values);
        }
      }
    }

    _req = dynamicReq;
View Full Code Here

TOP

Related Classes of com.liferay.util.servlet.DynamicServletRequest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.