Examples of RequestParameter


Examples of hirondelle.web4j.request.RequestParameter

    Object result = null;
    if ( ! (aCandidateArg instanceof RequestParameter) ) {
      result = aCandidateArg;
    }
    else {
      RequestParameter reqParam = (RequestParameter)aCandidateArg;
      result = translateParam(reqParam, aTargetClass);
    }
    return result;
  }
View Full Code Here

Examples of hirondelle.web4j.request.RequestParameter

      //this method may return file upload controls - depends on interpretation, whether to include file upload controls in this method
      Enumeration paramNames = aRequestParser.getRequest().getParameterNames();
      while ( paramNames.hasMoreElements() ){
        String incomingParamName = (String)paramNames.nextElement();
        fLogger.fine("Checking parameter named " + Util.quote(incomingParamName));
        RequestParameter knownParam = matchToKnownParam(incomingParamName, expectedParams);
        if( knownParam == null ){
          fLogger.severe("*** Unknown Parameter *** : " + Util.quote(incomingParamName) + ". Please add public static final RequestParameter field for this item to your Action.");
          throw new BadRequestException(HttpServletResponse.SC_BAD_REQUEST);
        }
        if ( knownParam.isFileUploadParameter() ) {
          fLogger.fine("File Upload parameter - value not validatable here: " + knownParam.getName());
          continue; //prevents checks on values for file upload controls
        }
        Collection<SafeText> paramValues = aRequestParser.toSafeTexts(knownParam);
        if( ! isInternalParam( knownParam) ) {
          checkParamValues(knownParam, paramValues);
View Full Code Here

Examples of hirondelle.web4j.request.RequestParameter

    }
  }
 
  /** If no match is found, return <tt>null</tt>.   Matches to both regular and 'internal' request params. */
  private RequestParameter matchToKnownParam(String aIncomingParamName, Collection<RequestParameter> aExpectedParams){
    RequestParameter result = null;
    for (RequestParameter reqParam: aExpectedParams){
      if ( reqParam.getName().equals(aIncomingParamName) ){
        result = reqParam;
        break;
      }
View Full Code Here

Examples of juzu.request.RequestParameter

    if (query != null) {
      for (Iterator<RequestParameter> i = Lexers.queryParser(query);i.hasNext();) {
        if (requestParameters.isEmpty()) {
          requestParameters = new HashMap<String, RequestParameter>();
        }
        RequestParameter parameter = i.next();
        parameter.appendTo(requestParameters);
      }
    }

    //
    if ("POST".equals(req.getMethod())) {
      String contentType = req.getContentType();
      if (contentType != null && contentType.length() > 0) {
        Spliterator i = new Spliterator(contentType, ';');
        if ("application/x-www-form-urlencoded".equals(i.next().trim())) {
          Charset charset = defaultEncoding;
          while (i.hasNext()) {
            String v = i.next().trim();
            if (v.startsWith("charset=")) {
              charset = Charset.forName(v.substring("charset=".length()));
            }
          }
          try {
            byte[] bytes = Tools.copy(req.getInputStream(), new ByteArrayOutputStream()).toByteArray();
            String form = new String(bytes, charset);
            FormURLEncodedParser parser = new FormURLEncodedParser(defaultEncoding, form, 0, form.length());
            for (RequestParameter parameter : parser) {
              if (requestParameters.isEmpty()) {
                requestParameters = new HashMap<String, RequestParameter>();
              }
              parameter.appendTo(requestParameters);
            }
          }
          catch (IOException e) {
            log.error("Cannot parse form post", e);
          }
View Full Code Here

Examples of org.apache.sling.api.request.RequestParameter

        // find the first request parameter that matches one of
        // our parameterNames, in order, and has a value
        if (parameters!=null) {
            // we first check for the special sling parameters
            RequestParameter specialParam = parameters.getValue(SlingPostConstants.RP_NODE_NAME);
            if ( specialParam != null ) {
                if ( specialParam.getString() != null && specialParam.getString().length() > 0 ) {
                    valueToUse = specialParam.getString();
                    doFilter = false;
                }
            }
            if ( valueToUse == null ) {
                specialParam = parameters.getValue(SlingPostConstants.RP_NODE_NAME_HINT);
                if ( specialParam != null ) {
                    if ( specialParam.getString() != null && specialParam.getString().length() > 0 ) {
                        valueToUse = specialParam.getString();
                    }
                }
            }

            if (valueToUse == null) {
View Full Code Here

Examples of org.apache.sling.api.request.RequestParameter

        for (int i = 0; i < kvs.length; i++) {
            final Param kv = kvs[i];
            final RequestParameter[] param = new RequestParameter[kv.value.length];
            for (int j = 0; j < kv.value.length; j++) {
                final String strValue = kv.value[j];
                final RequestParameter aparam = context.mock(RequestParameter.class, "requestParameter" + i + "#" + j);
                context.checking(new Expectations() {
                    {
                        allowing(aparam).getString();
                        will(returnValue(strValue));
                    }
View Full Code Here

Examples of org.apache.sling.api.request.RequestParameter

        }

        if (items != null && items.size() > 0) {
            for (Iterator<?> ii = items.iterator(); ii.hasNext();) {
                FileItem fileItem = (FileItem) ii.next();
                RequestParameter pp = new MultipartRequestParameter(fileItem);
                parameters.addParameter(pp, false);
            }
        }
    }
View Full Code Here

Examples of org.apache.sling.api.request.RequestParameter

    }

    //---------- String parameter support

    public String getStringValue(final String name) {
        final RequestParameter param = getValue(name);
        return (param != null) ? param.getString() : null;
    }
View Full Code Here

Examples of org.apache.sling.api.request.RequestParameter

    }

    // ---------- Servlet API 3.0 Part

    public Object getPart(final String name) {
        final RequestParameter p = this.getValue(name);
        if (p instanceof MultipartRequestParameter) {
            return new SlingPart((MultipartRequestParameter) p);
        }

        // no such part
View Full Code Here

Examples of org.apache.sling.api.request.RequestParameter

        String resourcePath = request.getResource().getPath();
        if (session.itemExists(resourcePath)) {
            Node source = (Node) session.getItem(resourcePath);

            // create a symetric link
            RequestParameter linkParam = request.getRequestParameter("target");
            if (linkParam != null) {
                String linkPath = linkParam.getString();
                if (session.itemExists(linkPath)) {
                    Item targetItem = session.getItem(linkPath);
                    if (targetItem.isNode()) {
                        linkHelper.createSymetricLink(source,
                            (Node) targetItem, "link");
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.