Package org.exoplatform.common.http.client

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


      AuthorizationHandler ah = AuthorizationInfo.getAuthHandler();

      try
      {
         URL url = new URL(sUrl);
         HTTPConnection connection = new HTTPConnection(url);
         connection.removeModule(CookieModule.class);
         AuthorizationInfo.setAuthHandler(null);

         HTTPResponse resp = connection.Get(url.getFile());

         String authHeader = resp.getHeader("WWW-Authenticate");

         String realm = authHeader.split("=")[1];
         realm = realm.substring(1, realm.length() - 1);
View Full Code Here


      {
         // execute the POST
         String complURL = protocol + "://" + host + sURL;

         URL url = new URL(complURL);
         HTTPConnection connection = new HTTPConnection(url);
         connection.removeModule(CookieModule.class);

         connection.addBasicAuthorization(getRealm(complURL), login, password);

         HTTPResponse resp;
         if (postData == null)
         {
            resp = connection.Post(url.getFile());
         }
         else
         {
            NVPair[] pairs = new NVPair[2];
            pairs[0] = new NVPair("Content-Type", "application/json; charset=UTF-8");
            pairs[1] = new NVPair("Content-Length", Integer.toString(postData.length()));

            resp = connection.Post(url.getFile(), postData.getBytes(), pairs);
         }

         BackupAgentResponse responce = new BackupAgentResponse(resp.getData(), resp.getStatusCode());
         return responce;
      }
View Full Code Here

      {
         // execute the POST
         String complURL = protocol + "://" + host + sURL;

         URL url = new URL(complURL);
         HTTPConnection connection = new HTTPConnection(url);
         connection.removeModule(CookieModule.class);

         connection.addBasicAuthorization(getRealm(complURL), login, password);

         HTTPResponse resp = connection.Get(url.getFile());

         BackupAgentResponse responce = new BackupAgentResponse(resp.getData(), resp.getStatusCode());
         return responce;
      }
      catch (ModuleException e)
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);
      resp = conn.Get(url_obj.getProtocol() + "://" + url_obj.getAuthority() + url_obj.getPath(), form_data, headers);
      if (resp.getStatusCode() >= 300)
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);

      byte[] body = new byte[httpRequest.getContentLength()];
      new DataInputStream(httpRequest.getInputStream()).readFully(body);
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);

      byte[] body = new byte[httpRequest.getContentLength()];
      new DataInputStream(httpRequest.getInputStream()).readFully(body);
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);
      resp = conn.Delete(url_obj.getProtocol() + "://" + url_obj.getAuthority() + url_obj.getPath(), headers);
      if (resp.getStatusCode() >= 300)
      {
View Full Code Here

               "Fail remote initializetion : the user name or password not not specified : " + dataSourceUrl);

         String userName = userInfo.split(":")[0];
         String password = userInfo.split(":")[1];

         HTTPConnection connection = new HTTPConnection(url);
         connection.removeModule(CookieModule.class);

         String realmName = getRealm(complURL);
         connection.addBasicAuthorization(realmName, userName, password);

         HTTPResponse resp = connection.Get(url.getFile());

         result = resp.getText();

         AuthorizationInfo.removeAuthorization(url.getHost(), url.getPort(), "Basic", realmName);
View Full Code Here

      AuthorizationHandler ah = AuthorizationInfo.getAuthHandler();

      try
      {
         URL url = new URL(sUrl);
         HTTPConnection connection = new HTTPConnection(url);
         connection.removeModule(CookieModule.class);
         AuthorizationInfo.setAuthHandler(null);

         HTTPResponse resp = connection.Get(url.getFile());

         String authHeader = resp.getHeader("WWW-Authenticate");

         String realm = authHeader.split("=")[1];
         realm = realm.substring(1, realm.length() - 1);
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

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.