Package railo.commons.net.http

Examples of railo.commons.net.http.HTTPResponse


        proxyport=pd==null?0:pd.getPort();
        proxyuser=pd==null?null:pd.getUsername();
        proxypassword=pd==null?null:pd.getPassword();
      }
     
      HTTPResponse method = HTTPEngine.get(url, authUser, authPassword, -1,HTTPEngine.MAX_REDIRECT, null, userAgent,
          ProxyDataImpl.getInstance(proxyserver, proxyport, proxyuser, proxypassword),null);
     
      // mimetype
      if(StringUtil.isEmpty(strMimetype)) {
        ContentType ct = method.getContentType();
        if(ct!=null)
          setMimetype(ct.toString());
       
      }
      InputStream is = new ByteArrayInputStream(method.getContentAsByteArray());
      try {
       
        render(pd4ml, is, os,url);
      }
      finally {
View Full Code Here


   * @param dataUrl
   * @return
   * @throws IOException
   */
  public static long length(URL url) throws IOException {
    HTTPResponse http = HTTPEngine.head(url, null, null, -1,HTTPEngine.MAX_REDIRECT,null, "Railo", null,null);
    return http.getContentLength()
  }
View Full Code Here

        }
        }
  }
 
  public void verifyExtensionProvider(String strUrl) throws PageException {
    HTTPResponse method=null;
    try {
      URL url = HTTPUtil.toURL(strUrl+"?wsdl",true);
      method = HTTPEngine.get(url, null, null, 2000,HTTPEngine.MAX_REDIRECT, null, null, null, null);
    }
    catch (MalformedURLException e) {
      throw new ApplicationException("url defintion ["+strUrl+"] is invalid");
    }
    catch (IOException e) {
      throw new ApplicationException("can't invoke ["+strUrl+"]",e.getMessage());
    }
   
    if(method.getStatusCode()!=200){int code=method.getStatusCode();
      String text=method.getStatusText();
      String msg=code+" "+text;
      throw new HTTPException(msg,null,code,text,method.getURL());
    }
    //Object o =
      CreateObject.doWebService(null, strUrl+"?wsdl");
     
  }
View Full Code Here

        ProxyData proxy=task.getProxyData();
        if(!ProxyDataImpl.isValid(proxy) && config.isProxyEnableFor(task.getUrl().getHost())) {
          proxy=config.getProxyData();
        }
       
        HTTPResponse rsp=null;
       
        // execute
        try {
          rsp = HTTPEngine.get(new URL(url), user, pass, task.getTimeout(),HTTPEngine.MAX_REDIRECT, charset, null, proxy, headers);
        } catch (Exception e) {
            if(log!=null)log.error(logName,e.getMessage());
            hasError=true;
        }
       
        // write file
        Resource file = task.getResource();
        if(!hasError && file!=null && task.isPublish()) {
          String n=file.getName();
          if(n.indexOf("{id}")!=-1){
            n=StringUtil.replace(n, "{id}",CreateUUID.invoke(), false)
            file=file.getParentResource().getRealResource(n);
          }
         
          if(isText(rsp) && task.isResolveURL()) {
           
              String str;
                try {
                    InputStream stream = rsp.getContentAsStream();
                    str = stream==null?"":IOUtil.toString(stream,(Charset)null);
                    if(str==null)str="";
                }
                catch (IOException e) {
                  str=e.getMessage();
                }
             
              try {
                    str=new URLResolver().transform(str,task.getUrl(),false);
                } catch (PageException e) {
                    if(log!=null)log.error(logName,e.getMessage());
                    hasError=true;
                }
              try {
                    IOUtil.write(file,str,charset,false);
                }
                catch (IOException e) {
                    if(log!=null)log.error(logName,e.getMessage());
                    hasError=true;
                }
          }
          else {
            //print.out("1111111111111111111111111111111");
              try {
                    IOUtil.copy(
                            rsp.getContentAsStream(),
                            file,
                            true
                    );
                    //new File(file.getAbsolutePath()).write(method.getResponseBodyAsStream());
                }
View Full Code Here

    params.put("returnFormat","json");
    try {
      params.put("argumentCollection",new JSONConverter(true).serialize(pc, args, false));
   
   
      HTTPResponse res = HTTPEngine4Impl.post(
        HTTPUtil.toURL(url,true),
        client.getServerUsername(),
        client.getServerPassword(), -1L, -1, config.getWebCharset(), "Railo Remote Invocation", client.getProxyData(), null,params);
   
      return new JSONExpressionInterpreter().interpret(pc, res.getContentAsString());
     
    }
    catch (IOException ioe) {
      throw Caster.toPageException(ioe);
    }
View Full Code Here

 
  public InputStream listBucketsRaw() throws MalformedURLException, IOException, InvalidKeyException, NoSuchAlgorithmException {
    String dateTimeString = Util.toHTTPTimeString();
    String signature = createSignature("GET\n\n\n"+dateTimeString+"\n/", getSecretAccessKeyValidate(), "iso-8859-1");
   
    HTTPResponse rsp = HTTPEngine3Impl.get(new URL("http://"+host), null, null, -1,MAX_REDIRECT, null, "Railo", null,
        new Header[]{
          header("Date",dateTimeString),
          header("Authorization","AWS "+getAccessKeyIdValidate()+":"+signature)
        }
    );
    return rsp.getContentAsStream();
   
  }
View Full Code Here

    String strUrl="http://"+bucketName+"."+host+"/";
    //if(Util.hasUpperCase(bucketName))strUrl="http://"+host+"/"+bucketName+"/";
    if(hasObj) {
      strUrl+=objectName;
    }
    HTTPResponse method = HTTPEngine3Impl.head(new URL(strUrl), null, null, -1,MAX_REDIRECT, null, "Railo", null,headers.toArray(new Header[headers.size()]));
    return method;
   
  }
View Full Code Here

    if(hasObj) {
      strUrl+=objectName;
    }
    strUrl+="?acl";
   
    HTTPResponse method = HTTPEngine3Impl.get(new URL(strUrl), null, null, -1,MAX_REDIRECT, null, "Railo", null,headers.toArray(new Header[headers.size()]));
    return method.getContentAsStream();
   
  }
View Full Code Here

    }
    strUrl+="?acl";
   
   
   
    HTTPResponse method = HTTPEngine3Impl.put(new URL(strUrl), null, null, -1,MAX_REDIRECT, null,
        "Railo", null,headers,re);
    if(method.getStatusCode()!=200){
      new ErrorFactory(method.getContentAsStream());
    }
   
   
  }
View Full Code Here

    if(maxKeys!=-1) {
      strUrl+=amp+"max-keys="+maxKeys;
      amp='&';
    }
   
    HTTPResponse method = HTTPEngine3Impl.get(new URL(strUrl), null, null, -1,MAX_REDIRECT, null, "Railo", null,headers.toArray(new Header[headers.size()]));
    return method.getContentAsStream();
  }
View Full Code Here

TOP

Related Classes of railo.commons.net.http.HTTPResponse

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.