Package org.exoplatform.common.http.client

Examples of org.exoplatform.common.http.client.HTTPConnection$MSLargeWritesBugStream


      if (!resourcePath.startsWith("/"))
      {
         resourcePath = "/" + resourcePath;
      }

      HTTPConnection connection = WebDavUtils.getAuthConnection(config);
      HTTPResponse response = connection.Get(href);

      int status = response.getStatusCode();

      if (status != HTTPStatus.OK)
      {
View Full Code Here


         throw new WebApplicationException(e, createErrorResponse(e, 404));
      }
      try
      {
         URL url = new URL(urlParam);
         HTTPConnection conn = new HTTPConnection(url);
         conn.setTimeout(DEFAULT_CONNECT_TIMEOUT_MS);
         NVPair[] headerPairs = toNVPair(headers.getRequestHeaders(), //
            Collections.singleton(new CaseInsensitiveStringWrapper(HttpHeaders.HOST)));
         conn.setAllowUserInteraction(false);
         NVPair credentials = getCredentials(url);
         if (credentials != null)
         {
            conn.addBasicAuthorization(null, credentials.getName(), credentials.getValue());
         }
         HTTPResponse resp = conn.Delete(url.getFile(), headerPairs);
         if (resp.getStatusCode() >= 300)
         {
            if (LOG.isDebugEnabled())
            {
               // Do not read data if debug is off.
View Full Code Here

         throw new WebApplicationException(e, createErrorResponse(e, 404));
      }
      try
      {
         URL url = new URL(urlParam);
         HTTPConnection conn = new HTTPConnection(url);
         conn.setTimeout(DEFAULT_CONNECT_TIMEOUT_MS);
         NVPair[] headerPairs = toNVPair(headers.getRequestHeaders(), //
            Collections.singleton(new CaseInsensitiveStringWrapper(HttpHeaders.HOST)));
         conn.setAllowUserInteraction(false);
         NVPair credentials = getCredentials(url);
         if (credentials != null)
         {
            conn.addBasicAuthorization(null, credentials.getName(), credentials.getValue());
         }
         HTTPResponse resp = conn.Get(url.getFile(), (NVPair[])null, headerPairs);
         if (resp.getStatusCode() >= 300)
         {
            if (LOG.isDebugEnabled())
            {
               // Do not read data if debug is off.
View Full Code Here

      }

      try
      {
         URL url = new URL(urlParam);
         HTTPConnection conn = new HTTPConnection(url);
         conn.setTimeout(DEFAULT_CONNECT_TIMEOUT_MS);
         NVPair[] headerPairs = toNVPair(headers.getRequestHeaders(), //
            Collections.singleton(new CaseInsensitiveStringWrapper(HttpHeaders.HOST)));
         conn.setAllowUserInteraction(false);
         NVPair credentials = getCredentials(url);
         if (credentials != null)
         {
            conn.addBasicAuthorization(null, credentials.getName(), credentials.getValue());
         }
         HTTPResponse resp = null;
         if (entity != null)
         {
            HttpOutputStream stream = new HttpOutputStream();
            resp = conn.Post(url.getFile(), stream, headerPairs);
            byte[] buf = new byte[1024];
            int r = -1;
            while ((r = entity.read(buf)) != -1)
            {
               stream.write(buf, 0, r);
            }
            stream.close();
         }
         else
         {
            resp = conn.Post(url.getFile(), (NVPair[])null, headerPairs);
         }

         if (resp.getStatusCode() >= 300)
         {
            if (LOG.isDebugEnabled())
View Full Code Here

      }

      try
      {
         URL url = new URL(urlParam);
         HTTPConnection conn = new HTTPConnection(url);
         conn.setTimeout(DEFAULT_CONNECT_TIMEOUT_MS);
         NVPair[] headerPairs = toNVPair(headers.getRequestHeaders(), //
            Collections.singleton(new CaseInsensitiveStringWrapper(HttpHeaders.HOST)));
         conn.setAllowUserInteraction(false);
         NVPair credentials = getCredentials(url);
         if (credentials != null)
         {
            conn.addBasicAuthorization(null, credentials.getName(), credentials.getValue());
         }
         HTTPResponse resp = null;
         if (entity != null)
         {
            HttpOutputStream stream = new HttpOutputStream();
            resp = conn.Put(url.getFile(), stream, headerPairs);
            byte[] buf = new byte[1024];
            int r = -1;
            while ((r = entity.read(buf)) != -1)
            {
               stream.write(buf, 0, r);
            }
            stream.close();
         }
         else
         {
            resp = conn.Put(url.getFile(), new byte[0], headerPairs);
         }

         if (resp.getStatusCode() >= 300)
         {
            if (LOG.isDebugEnabled())
View Full Code Here

      ProtocolNotSuppException, IOException, ModuleException, ParseException
   {
      URL url_obj = null;
      url_obj = new URL(url);

      conn = new HTTPConnection(url_obj);
      conn.setTimeout(DEFAULT_CONNECT_TIMEOUT_MS);
      prepareRequestHeaders(httpRequest);
      prepareFormParams(url_obj);
      conn.setAllowUserInteraction(false);
      resp = conn.Get(url_obj.getProtocol() + "://" + url_obj.getAuthority() + url_obj.getPath(), form_data, headers);
View Full Code Here

      ProtocolNotSuppException, IOException, ModuleException, ParseException
   {
      URL url_obj = null;
      url_obj = new URL(url);

      conn = new HTTPConnection(url_obj);
      conn.setTimeout(DEFAULT_CONNECT_TIMEOUT_MS);
      conn.setAllowUserInteraction(false);
      prepareRequestHeaders(httpRequest);

      byte[] body = new byte[httpRequest.getContentLength()];
View Full Code Here

      ProtocolNotSuppException, IOException, ModuleException, ParseException
   {
      URL url_obj = null;
      url_obj = new URL(url);

      conn = new HTTPConnection(url_obj);
      conn.setTimeout(DEFAULT_CONNECT_TIMEOUT_MS);
      conn.setAllowUserInteraction(false);
      prepareRequestHeaders(httpRequest);

      byte[] body = new byte[httpRequest.getContentLength()];
View Full Code Here

      ProtocolNotSuppException, IOException, ModuleException, ParseException
   {
      URL url_obj = null;
      url_obj = new URL(url);

      conn = new HTTPConnection(url_obj);
      conn.setTimeout(DEFAULT_CONNECT_TIMEOUT_MS);
      conn.setAllowUserInteraction(false);
      prepareRequestHeaders(httpRequest);
      resp = conn.Delete(url_obj.getProtocol() + "://" + url_obj.getAuthority() + url_obj.getPath(), headers);
      if (resp.getStatusCode() >= 300)
View Full Code Here

   public static final String ROOTPASS = "exo";

   public static HTTPConnection GetAuthConnection()
   {
      HTTPConnection connection = new HTTPConnection(HOST, WebDav.PORT_INT);
      connection.addBasicAuthorization(REALM, ROOTID, ROOTPASS);

      return connection;
   }
View Full Code Here

TOP

Related Classes of org.exoplatform.common.http.client.HTTPConnection$MSLargeWritesBugStream

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.