Examples of QueryString


Examples of org.apache.myfaces.portlet.faces.util.QueryString

  }
 
  private boolean isTokenLink(String token, String url)
  {
    int queryStart = url.indexOf('?');
    QueryString queryStr = null;
    String tokenParam = null;

    if (queryStart != -1)
    {
      queryStr = new QueryString(url.substring(queryStart + 1), "UTF8");
      tokenParam = queryStr.getParameter(token);
      return Boolean.parseBoolean(tokenParam);
    }

    return false;
  }
View Full Code Here

Examples of org.apache.myfaces.portlet.faces.util.QueryString

  }
 
  private String removeTokenLink(String token, String url)
  {
    int queryStart = url.indexOf('?');
    QueryString queryStr = null;

    if (queryStart != -1)
    {
      queryStr = new QueryString(url.substring(queryStart + 1), "UTF8");
      queryStr.removeParameter(token);
      String query = queryStr.toString();
      if (query != null && query.length() != 0)
      {
        url = url.substring(0, queryStart + 1) + query;
      }
      else
View Full Code Here

Examples of org.apache.myfaces.portlet.faces.util.QueryString

    // Redirects to a view are dealt (elsewhere) as navigations --
    // encode this information for later use by the bridge controller.
    // Other links are redirected.
   
    // First look to see if this is an already encoded
    QueryString params = (QueryString) getRequestMap().get(ENCODED_ACTION_URL_ATTRIBUTE_PREFIX.concat(url.replace(".", "*")));
    if (params != null)
    {
      // Because we want to support translating a redirect that occurs
      // during a render as an in place navigation AND we can't reverse
      // engineer the URL from the actionURL, we stash the original URL on
      // a request attribute, keyed with the generated URL.  If this generated
      // url is passed to redirect() we can get the original url back and
      // process based on it.
     
      // In Portlet 1.0 we can't redirect to nonFaces target during render
      // Check for this case and throw an exception
      // A NonFaces target is any that doesn't have a Faces ViewId
      // encoded in it.
      if (getPortletPhase() == Bridge.PortletPhase.RENDER_PHASE)
      {
        String target = params.getParameter(JSF_TARGET_VIEWID_RENDER_PARAMETER);
        if (target == null)
        {
          throw new IllegalStateException("Can't redirect during render to a NonFaces target: " + target);
        }
      }
View Full Code Here

Examples of org.apache.myfaces.portlet.faces.util.QueryString

    // Some viewId may have query string, so handle that here
    // (e.g., TaskFlow has the following viewId:
    // /adf.task-flow?_document=/WEB-INF/task-flow.xml&_id=task1

    int queryStart = viewId.indexOf('?');
    QueryString queryStr = null;

    if (queryStart != -1)
    {
      // parse the query string and add the parameters to internal maps
      // delay the creation of ParameterMap and ParameterValuesMap until
      // they are needed/called by the client
      queryStr = new QueryString(viewId.substring(queryStart + 1), "UTF8");

      // TODO: Constants
      // We store these into a temporary Map until a client calls the corresponding
      // ExternalContext public api to get the request parameter map(s).  In those
      // methods we use these temp maps to build the overall Map that is returned.
      // This roundabout technique is used to delay accessing request parameters until the
      // client first requests them.
      mTempExtraRequestParameterMap = new HashMap<String, String>(5);
      mTempExtraRequestParameterValuesMap = new HashMap<String, String[]>(5);
      // Clear any existing Request ParameterMap to ensure reconstruction
      // with these new extra entries.
      mRequestParameterMap = null;
      mRequestParameterValuesMap = null;

      Enumeration<String> list = queryStr.getParameterNames();
      while (list.hasMoreElements())
      {
        String param = list.nextElement();
        mTempExtraRequestParameterMap.put(param, queryStr.getParameter(param));
       
        // Now deal with the multiValue case
        Enumeration<String> e = queryStr.getParameterValues(param);
        ArrayList<String> l = new ArrayList(5);
        while (e.hasMoreElements())
        {
          l.add(e.nextElement());        
        }
View Full Code Here

Examples of org.apache.myfaces.portlet.faces.util.QueryString

    return viewId;
  }

  private void updateViewChainAttribute(String mode, String viewId, boolean modeChanged)
  {
    QueryString qs = new QueryString("UTF8");
   
    // always encode the mode in the viewId as this is used for mode transitions
    qs.setParameter(Bridge.PORTLET_MODE_PARAMETER, mode);
   
    if (!modeChanged)
    {
        // Build a QueryString from the request's render parameters so can preserve
      // with the viewId
      Map m = getRequestParameterValuesMap();
      if (!m.isEmpty())
      {
        Set <Map.Entry<String, String[]>> set = m.entrySet();
        Iterator <Map.Entry<String,String[]>> i = set.iterator();
        while (i.hasNext()) 
        {
          Map.Entry<String,String[]> e = i.next();
          // only add if not a viewId or viewState parameter
          if (!e.getKey().equals(JSF_TARGET_VIEWID_RENDER_PARAMETER)
          && !e.getKey().equals(ResponseStateManager.VIEW_STATE_PARAM))
          {
            for (String s : e.getValue())
            {
              qs.addParameter(e.getKey(), s);
            }
          }
        }
      }
    }
       
    String toAppend = qs.toString();
    StringBuffer sb = new StringBuffer(viewId.length() + toAppend.length() + 1);
    viewId = sb.append(viewId).append("?").append(toAppend).toString();
     
    // Now add to the appropriate session attribute based on Mode
    Map sessionMap = getSessionMap();
View Full Code Here

Examples of org.apache.myfaces.portlet.faces.util.QueryString

  private String replaceResourceQueryStringMarkers(String s, boolean hasBackLink,
                                                   boolean hasViewLink)
  {
    String path = null;
    QueryString queryStr = null;
    int queryStart = -1;

    // First: split URL into path and query string
    // Hold onto QueryString for later processing
    queryStart = s.indexOf('?');

    // references aren't in the querystring so nothing to do
    if (queryStart == -1)
      return s;

    FacesContext context = FacesContext.getCurrentInstance();

    queryStr = new QueryString(s.substring(queryStart + 1), "UTF8");
    path = s.substring(0, queryStart);

    if (hasBackLink)
    {
      Enumeration<String> list = queryStr.getParameterNames();
      while (list.hasMoreElements())
      {
        String param = list.nextElement().toString();
        if (hasBackLink && param.equals(Bridge.BACK_LINK))
        {
          try
          {
            // Set backlink as parameter using value as param name
            queryStr.setParameter(queryStr.getParameter(param),
                                encodeActionURL(context.getApplication().getViewHandler().getActionURL(context,
                                                                                                       context.getViewRoot().getViewId())));
            ;
          }
          catch (Exception e)
          {
            ; // do nothing -- just ignore
          }
        }
      }
    }
   
    // Now make sure the parameters are removed
    try
    {
      queryStr.removeParameter(Bridge.BACK_LINK);
      queryStr.removeParameter(Bridge.VIEW_LINK);
    }
    catch (Exception e)
    {
      ; // do nothing -- just ignore
   

    // Now put the string back together
    String qs = queryStr.toString();
    if (qs.length() > 0)
    {
      s = path + "?" + qs;
    }
    else
View Full Code Here

Examples of org.apache.myfaces.portlet.faces.util.QueryString

        (request.getAttribute(Bridge.VIEW_PATH) != null));
   
    // Now check to see if this is a Refresh (render) that follows a redirect
    // If it is use the redirect information cached in the session as the basis
    // for the request.
    QueryString redirectParams = (QueryString)
              request.getPortletSession(true).getAttribute(BridgeImpl.RENDER_REDIRECT_VIEWPARAMS);
   
    boolean modeChanged = hasModeChanged(request, redirectParams);

    if (redirectParams != null && (clientDirectedView || modeChanged)) 
View Full Code Here

Examples of org.apache.myfaces.portlet.faces.util.QueryString

      lifecycle.removePhaseListener(this);
    }
     
    // check here to see if a redirect occurred -- if so rerun doFacesRequest
    // for this new view
    QueryString redirectParams = (QueryString) context.getExternalContext()
            .getRequestMap().get(BridgeImpl.REDIRECT_VIEWPARAMS);
   
    if (redirectParams == null)
    {
      lifecycle.render(context);
View Full Code Here

Examples of org.apache.myfaces.portlet.faces.util.QueryString

  }
 
  private boolean isTokenLink(String token, String url)
  {
    int queryStart = url.indexOf('?');
    QueryString queryStr = null;
    String tokenParam = null;

    if (queryStart != -1)
    {
      queryStr = new QueryString(url.substring(queryStart + 1), "UTF8");
      tokenParam = queryStr.getParameter(token);
      return Boolean.parseBoolean(tokenParam);
    }

    return false;
  }
View Full Code Here

Examples of org.apache.myfaces.portlet.faces.util.QueryString

        .append(mode)
        .toString();
    }
    else
    {
      QueryString qs = new QueryString(viewId.substring(queryStart + 1), "UTF8");
      qs.setParameter(Bridge.PORTLET_MODE_PARAMETER, mode);
      return sb.append(viewId.substring(0, queryStart + 1)).append(qs.toString()).toString();
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.