Package org.apache.myfaces.portlet.faces.util

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


  }
 
  private String replaceResourceQueryStringMarkers(String s)
  {
    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);

    try
    {
      // If there is a backlink -- remove and convert it
      String backLinkValue = queryStr.removeParameter(Bridge.BACK_LINK);
      if (backLinkValue!= null)
      {
        queryStr.setParameter(backLinkValue, encodeActionURL(context.getApplication().getViewHandler().getActionURL(context,
                                context.getViewRoot().getViewId())), false);
      }
      // just remove the viewLink param
      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

  }
 
  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

  }
 
  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

        (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

      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

        .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

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

      getLifecycle().execute(context);

      // Check if a redirect was called.  If so encode the redirect viewId
      // as the action response without saving state.  Otherwise its not
      // a redirect so save the state for the subsequent render.
      QueryString redirectParams = (QueryString) context.getExternalContext().getRequestMap().get(BridgeImpl.BRIDGE_REDIRECT_VIEWPARAMS);

      // Do nothing for redirect case because the ActionResponse is
      // already encoded and no additional state needs to be saved.
      if (redirectParams == null)
      {
View Full Code Here

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

TOP

Related Classes of org.apache.myfaces.portlet.faces.util.QueryString

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.