Package railo.commons.net.http.httpclient3.entity

Examples of railo.commons.net.http.httpclient3.entity._ByteArrayRequestEntity


      return "";
    }
    Map<String, Long> feedSizes = new LinkedHashMap<String, Long>();
    String[] pathGroups = ivoryInPaths.split("#");
    String[] inputFeeds = ivoryInputFeeds.split("#");
    Entity entity = EntityUtil.getEntity(message.getEntityType(),
        message.getEntityName());

    List<String> lateFeed = new ArrayList<String>();
    if (EntityUtil.getLateProcess(entity) != null) {
      for (LateInput li : EntityUtil.getLateProcess(entity)
View Full Code Here


        public void process(EntityContainer entityContainer) {
            if (progressListener.isCanceled()) {
                target.cancel();
                throw new OsmosisRuntimeException("Cancelled by user");
            }
            Entity entity = entityContainer.getEntity();
            if (++count % 10 == 0) {
                progressListener.setProgress(count);
            }
            latestChangeset = Math.max(latestChangeset, entity.getChangesetId());
            latestTimestamp = Math.max(latestTimestamp, entity.getTimestamp().getTime());
            Geometry geom = null;
            switch (entity.getType()) {
            case Node:
                nodeCount++;
                geom = parsePoint((Node) entity);
                break;
            case Way:
View Full Code Here

            if (progressListener.isCanceled()) {
                target.cancel();
                throw new OsmosisRuntimeException("Cancelled by user");
            }
            final EntityContainer entityContainer = container.getEntityContainer();
            final Entity entity = entityContainer.getEntity();
            final ChangeAction changeAction = container.getAction();
            if (changeAction.equals(ChangeAction.Delete)) {
                SimpleFeatureType ft = entity instanceof Node ? OSMUtils.nodeType() : OSMUtils
                        .wayType();
                String id = Long.toString(entity.getId());
                target.put(new FeatureToDelete(ft, id));
                return;
            }
            if (changeAction.equals(ChangeAction.Modify)) {
                // Check that the feature to modify exist. If so, we will just treat it as an
                // addition, overwriting the previous feature
                SimpleFeatureType ft = entity instanceof Node ? OSMUtils.nodeType() : OSMUtils
                        .wayType();
                String path = ft.getName().getLocalPart();
                Optional<org.locationtech.geogig.api.Node> opt = workTree.findUnstaged(path);
                if (!opt.isPresent()) {
                    return;
                }
            }

            if (++count % 10 == 0) {
                progressListener.setProgress(count);
            }
            latestChangeset = Math.max(latestChangeset, entity.getChangesetId());
            latestTimestamp = Math.max(latestTimestamp, entity.getTimestamp().getTime());
            Geometry geom = null;
            switch (entity.getType()) {
            case Node:
                nodeCount++;
                geom = parsePoint((Node) entity);
                break;
            case Way:
View Full Code Here

      else if(type.equals("formfield") || type.equals("form")) {
        hasForm=true;
        if(http.method==METHOD_GET) throw new ApplicationException("httpparam type formfield can't only be used, when method of the tag http equal post");
        if(post!=null){
          if(doMultiPart){
            parts.add(new RailoStringPart(param.getName(),param.getValueAsString(),_charset));
          }
          else post.addParameter(new NameValuePair(param.getName(),param.getValueAsString()));
        }
        //else if(multi!=null)multi.addParameter(param.getName(),param.getValueAsString());
      }
    // CGI
      else if(type.equals("cgi")) {
        if(param.getEncoded())
            httpMethod.addRequestHeader(
                            translateEncoding(param.getName(),http.charset),
                            translateEncoding(param.getValueAsString(),http.charset));
                else
                    httpMethod.addRequestHeader(param.getName(),param.getValueAsString());
      }
        // Header
            else if(type.startsWith("head")) {
              if(param.getName().equalsIgnoreCase("content-type")) hasContentType=true;
             
              if(param.getName().equalsIgnoreCase("Accept-Encoding")) {
                acceptEncoding.append(headerValue(param.getValueAsString()));
                acceptEncoding.append(", ");
              }
              else httpMethod.addRequestHeader(param.getName(),headerValue(param.getValueAsString()));
            }
    // Cookie
      else if(type.equals("cookie")) {
        Cookie c=toCookie(_url.getHost(),param.getName(),param.getValueAsString(),_charset);
        c.setPath("/");
        client.getState().addCookie(c);
      }
    // File
      else if(type.equals("file")) {
        hasForm=true;
        if(http.method==METHOD_GET) throw new ApplicationException("httpparam type file can't only be used, when method of the tag http equal post");
        if(doMultiPart) {
          try {
            parts.add(new ResourcePart(param.getName(),new ResourcePartSource(param.getFile()),getContentType(param),_charset));
          }
          catch (FileNotFoundException e) {
            throw new ApplicationException("can't upload file, path is invalid",e.getMessage());
          }
        }
      }
    // XML
      else if(type.equals("xml")) {
        hasBody=true;
        hasContentType=true;
        httpMethod.addRequestHeader("Content-type", "text/xml; charset="+http.charset);
          //post.setRequestBody(new NameValuePair [] {new NameValuePair(translateEncoding(param.getName(), charset),translateEncoding(param.getValue(), charset))});
        if(eem==null)throw new ApplicationException("type xml is only supported for type post and put");
          eem.setRequestBody(param.getValueAsString());
      }
    // Body
      else if(type.equals("body")) {
        hasBody=true;
        if(eem==null)throw new ApplicationException("type body is only supported for type post and put");
          Object value = param.getValue();
         
          if(value instanceof InputStream) {
          eem.setRequestEntity(new InputStreamRequestEntity((InputStream)value,"application/octet-stream"));
        }
        else if(Decision.isCastableToBinary(value,false)){
          eem.setRequestEntity(new ByteArrayRequestEntity(Caster.toBinary(value)));
        }
        else {
          eem.setRequestEntity(new StringRequestEntity(param.getValueAsString()));
        }
      }
            else {
                throw new ApplicationException("invalid type ["+type+"]");
            }
       
    }
   
    httpMethod.setRequestHeader("Accept-Encoding",acceptEncoding.append("gzip").toString());
   
   
   
    // multipart
    if(doMultiPart && eem!=null) {
      hasContentType=true;
      boolean doIt=true;
      if(!http.multiPart && parts.size()==1){
        Part part = parts.get(0);
        /* jira 1513
          if(part instanceof ResourcePart){
          ResourcePart rp = (ResourcePart) part;
          eem.setRequestEntity(new ResourceRequestEntity(rp.getResource(),rp.getContentType()));
          doIt=false;
        }
        else */
          if(part instanceof RailoStringPart){
          RailoStringPart sp = (RailoStringPart) part;
          try {
            eem.setRequestEntity(new StringRequestEntity(sp.getValue(),sp.getContentType(),sp.getCharSet()));
          } catch (IOException e) {
            throw Caster.toPageException(e);
          }
          doIt=false;
        }
View Full Code Here

      else if(type.equals("file")) {
        hasForm=true;
        if(http.method==METHOD_GET) throw new ApplicationException("httpparam type file can't only be used, when method of the tag http equal post");
        if(doMultiPart) {
          try {
            parts.add(new ResourcePart(param.getName(),new ResourcePartSource(param.getFile()),getContentType(param),_charset));
          }
          catch (FileNotFoundException e) {
            throw new ApplicationException("can't upload file, path is invalid",e.getMessage());
          }
        }
View Full Code Here

      else if(type.equals("file")) {
        hasForm=true;
        if(http.method==METHOD_GET) throw new ApplicationException("httpparam type file can't only be used, when method of the tag http equal post");
        if(doMultiPart) {
          try {
            parts.add(new ResourcePart(param.getName(),new ResourcePartSource(param.getFile()),getContentType(param),_charset));
          }
          catch (FileNotFoundException e) {
            throw new ApplicationException("can't upload file, path is invalid",e.getMessage());
          }
        }
View Full Code Here

  public static Header header(String name, String value) {
    return new HeaderImpl(name, value);
  }

  public static Entity getEmptyEntity(String contentType) {
    return new EmptyRequestEntity(contentType);
  }
View Full Code Here

  public static Entity getTemporaryStreamEntity(TemporaryStream ts, String contentType) {
    return new TemporaryStreamRequestEntity(ts,contentType);
  }
 
  public static Entity getResourceEntity(Resource res, String contentType) {
    return new ResourceRequestEntity(res,contentType);
  }
View Full Code Here

  public static Entity getByteArrayEntity(byte[] barr, String contentType) {
    return new _ByteArrayRequestEntity(barr, contentType);
  }
 
  public static Entity getTemporaryStreamEntity(TemporaryStream ts, String contentType) {
    return new TemporaryStreamRequestEntity(ts,contentType);
  }
View Full Code Here

  public static Entity getEmptyEntity(String contentType) {
    return new EmptyRequestEntity(contentType);
  }
   
  public static Entity getByteArrayEntity(byte[] barr, String contentType) {
    return new _ByteArrayRequestEntity(barr, contentType);
  }
View Full Code Here

TOP

Related Classes of railo.commons.net.http.httpclient3.entity._ByteArrayRequestEntity

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.