Examples of QueryString


Examples of com.ocpsoft.pretty.faces.url.QueryString

                  req.getRequestDispatcher(context.getDynaViewId()).forward(req, response);
               }
               else
               {
                  List<PathParameter> params = context.getCurrentMapping().getPatternParser().parse(url);
                  QueryString query = QueryString.build(params);

                  ServletRequest wrappedRequest = new PrettyFacesWrappedRequest(request,
                              query.getParameterMap());

                  log.trace("Sending mapped request [" + url.toURL() + "] to resource [" + viewId + "]");
                  if (url.decode().toURL().matches(viewId))
                  {
                     chain.doFilter(wrappedRequest, response);
View Full Code Here

Examples of com.ocpsoft.pretty.faces.url.QueryString

         String contextPath = prettyContext.getContextPath();
         if (PrettyContext.PRETTY_PREFIX.equals(action) && prettyContext.isPrettyRequest())
         {
            URL url = prettyContext.getRequestURL();
            QueryString query = prettyContext.getRequestQueryString();

            String target = contextPath + url.encode().toURL() + query.toQueryString();
            log.trace("Refreshing requested page [" + url + "]");
            String redirectUrl = externalContext.encodeRedirectURL(target, null);
            externalContext.redirect(redirectUrl);
            return true;
         }
View Full Code Here

Examples of com.ocpsoft.pretty.faces.url.QueryString

         }
         viewId = FacesNavigationURLCanonicalizer.normalizeRequestURI(context, viewId);

         URL url = new URL(viewId);
         url.getMetadata().setLeadingSlash(true);
         QueryString qs = QueryString.build("");
         if (viewId.contains("?"))
         {
            qs.addParameters(viewId);
         }
         qs.addParameters("?" + PrettyFacesWrappedResponse.REWRITE_MAPPING_ID_KEY + "=" + mapping.getId());

         viewId = url.toString() + qs.toQueryString();

         NavigationCase navigationCase = parent.getNavigationCase(context, fromAction, viewId);
         return navigationCase;
      }
      else
View Full Code Here

Examples of com.ocpsoft.pretty.faces.url.QueryString

   private void injectQueryParams(final FacesContext context, final UrlMapping mapping,
            final PrettyContext prettyContext)
   {
      boolean isPostback = FacesStateUtils.isPostback(context);
      List<QueryParameter> params = mapping.getQueryParams();
      QueryString queryString = prettyContext.getRequestQueryString();
      for (QueryParameter param : params)
      {
         // check if to skip this QueryParameter due to onPostback attribute
         if (!param.isOnPostback() && isPostback)
         {
            continue;
         }

         String el = param.getExpression().getELExpression();
         if ((el != null) && !"".equals(el.trim()))
         {
            String name = param.getName();
            if (queryString.getParameterMap().containsKey(name))
            {
               try
               {
                  if (elUtils.getExpectedType(context, el).isArray())
                  {
                     String[] values = queryString.getParameterValues(name);
                     elUtils.setValue(context, el, values);
                  }
                  else
                  {

                     String valueAsString = queryString.getParameter(name);

                     // get the type of the referenced property and try to obtain a converter for it
                     Class<?> expectedType = elUtils.getExpectedType(context, el);
                     Converter converter = context.getApplication().createConverter(expectedType);
View Full Code Here

Examples of com.ocpsoft.pretty.faces.url.QueryString

      return result;
   }

   public QueryString buildQueryString(final UrlMapping mapping)
   {
      QueryString result = new QueryString();

      String expression = "";
      Object value = null;
      try
      {
View Full Code Here

Examples of eu.planets_project.ifr.core.storage.api.query.QueryString

     * @see eu.planets_project.ifr.core.storage.api.DigitalObjectManager#list(java.net.URI, eu.planets_project.ifr.core.storage.api.query.Query)
     */
    public List<URI> list(URI pdURI, Query q) throws QueryValidationException {
        // Query modes:
        if( q instanceof QueryString ) {
            QueryString qs = (QueryString) q;
            try {
                return this.executeQuery( pdURI, qs.getQuery() );
            } catch (IOException e) {
                return null;
            }
        }
        return null;
View Full Code Here

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

   */
  @Override
  public String encodeActionURL(String url)
  {
    String viewId = null, path = null;
    QueryString queryStr = null;
    int queryStart = -1;

    if (url.startsWith("#") || isExternalURL(url) || isDirectLink(url))
    {
      return url;
    }

    // url might contain DirectLink=false parameter -- spec says remove if
    // it does.
    url = removeDirectLink(url);

    // Now determine the target viewId

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

    if (queryStart != -1)
    {
      // Get the query string
      queryStr = new QueryString(url.substring(queryStart + 1), "UTF8");
      path = url.substring(0, queryStart);
    }
    else
    {
      path = url;
      // construct an empty queryString to hold the viewId
      queryStr = new QueryString("UTF8");
    }
   
    // Determine the viewId by inspecting the URL
    if (!isRelativePath(path))
    {
      viewId = getViewIdFromPath(path);
    }
    else
    {
      viewId = getViewIdFromRelativePath(path);
    }

    if (viewId == null)
    {
      throw new FacesException("encodeActionURL:  unable to recognize viewId");
    }
   
    // put the viewId in the QueryStr.
    queryStr.addParameter(ACTION_ID_PARAMETER_NAME, viewId);

    if (mPhase == Bridge.PortletPhase.RENDER_PHASE)
    { // render - write
      // the viewId into
      // the response
      // (interaction
      // state)
      RenderResponse renderResponse = (RenderResponse) getResponse();
      PortletURL actionURL = renderResponse.createActionURL();

      // Add parameters so they don't get lost
      Enumeration<String> list = queryStr.getParameterNames();
      while (list.hasMoreElements())
      {
        String param = list.nextElement().toString();
        if (param.equals(Bridge.PORTLET_MODE_PARAMETER))
        {
          try
          {
            actionURL.setPortletMode(new PortletMode(queryStr.getParameter(param)));
          }
          catch (Exception e)
          {
            ; // do nothing -- just ignore
          }
        }
        else if (param.equals(Bridge.PORTLET_WINDOWSTATE_PARAMETER))
        {
          try
          {
            actionURL.setWindowState(new WindowState(queryStr.getParameter(param)));
          }
          catch (Exception e)
          {
            ; // do nothing -- just ignore
          }
        }
        else if (param.equals(Bridge.PORTLET_SECURE_PARAMETER))
        {
          try
          {
            actionURL.setSecure(Boolean.getBoolean(queryStr.getParameter(param)));
          }
          catch (Exception e)
          {
            ; // do nothing -- just ignore
          }
        }
        else
        {
          actionURL.setParameter(param, queryStr.getParameter(param));
        }
      }

      // TODO hack to workaround double encoding problem
      url = actionURL.toString();
      url = url.replaceAll("\\&amp\\;", "&");
    }
    else
    { // action - write the viewId to navigational state
      ActionResponse actionResponse = (ActionResponse) getResponse();

      // set request params into navigational states
      Enumeration<String> list = queryStr.getParameterNames();
      while (list.hasMoreElements())
      {
        String param = list.nextElement();
        if (param.equals(Bridge.PORTLET_MODE_PARAMETER))
        {
          try
          {
            actionResponse.setPortletMode(new PortletMode(queryStr.getParameter(param)));
          }
          catch (Exception e)
          {
            //TODO: Ignoring is probably dangerous here as it means that we are
            //      EITHER using exceptions for flow control (which is extreemly
            //      inefficient) or we should log a message saying what the issue
            //      is.  According to the Javadocs an exception is thrown here if the
            //      portlet mode is not allowed or if sendRedirect has already been
            //      called.  In either case we should log an information type message
            //      here.
            ; // do nothing -- just ignore
          }
        }
        else if (param.equals(Bridge.PORTLET_WINDOWSTATE_PARAMETER))
        {
          try
          {
            actionResponse.setWindowState(new WindowState(queryStr.getParameter(param)));
          }
          catch (Exception e)
          {
            ; // do nothing -- just ignore
          }
        }
        else if (param.equals(Bridge.PORTLET_SECURE_PARAMETER))
        {
          ; // ignore -- do nothing as can't encode into an actionResponse
        }
        else
        {
          actionResponse.setRenderParameter(param, queryStr.getParameter(param));
        }
      }
    }
    // Because we want to support translating a redirect that occurs
    // during a render as an in place navigation AND we can't reverse
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));
    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
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
      mInternalRequestParameterMap = new HashMap<String, String>(5);
      mInternalRequestParameterValuesMap = new HashMap<String, String[]>(5);

      Enumeration<String> list = queryStr.getParameterNames();
      while (list.hasMoreElements())
      {
        String param = list.nextElement();
        mInternalRequestParameterMap.put(param, queryStr.getParameter(param));
        mInternalRequestParameterValuesMap.put(param, new String[]
            { queryStr.getParameter(param) });
      }

      viewId = viewId.substring(0, queryStart);
      log("PortletExternalContextImpl.getViewId: special viewId: " + viewId);
    }
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
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.