Package org.apache.http.client.methods

Examples of org.apache.http.client.methods.HttpGet


        oHttpCli = new DefaultHttpClient();
      } // fi (oHttpCli)

    oHttpCli.getCredentialsProvider().setCredentials(new AuthScope(oUrl.getHost(), AuthScope.ANY_PORT, realm()),
                             new UsernamePasswordCredentials(user(), password()));       
      HttpGet oGet = null;
      try {
        oGet = new HttpGet(sFilePath);     
        HttpResponse oResp = oHttpCli.execute(oGet);
        HttpEntity oEnty = oResp.getEntity();
        int nLen = (int) oEnty.getContentLength();
        if (nLen>0) {
          aRetVal = new byte[nLen];
View Full Code Here


      if (null==oHttpCli) {       
        oHttpCli = new DefaultHttpClient();
      } // fi (oHttpCli)
    oHttpCli.getCredentialsProvider().setCredentials(new AuthScope(oUrl.getHost(), AuthScope.ANY_PORT, realm()),
                             new UsernamePasswordCredentials(user(), password()));       
      HttpGet oGet = null;
      try {

        oGet = new HttpGet(sFilePath);     
        HttpResponse oResp = oHttpCli.execute(oGet);
        HttpEntity oEnty = oResp.getEntity();
        int nLen = (int) oEnty.getContentLength();
        if (nLen>0) {
          byte[] aRetVal = new byte[nLen];
View Full Code Here

  }

  public static Element getRootNode(HttpClient httpClient, String url) throws InvalidHttpResponseException {
    logger.info("getRootNode({})", url);
    try {
      HttpGet method = new HttpGet(url);
      HttpResponse response = httpClient.execute(method);
      int statusCode = response.getStatusLine().getStatusCode();
      if (statusCode != 200) {
        logger.error("Response status code was: {} (url={})", statusCode, url);
        throw new InvalidHttpResponseException(url, response);
View Full Code Here

      try {
        byte[] buffer = new byte[1024];

        final HttpClient httpClient = HttpXmlUtils.getHttpClient();
        final HttpGet method = new HttpGet(url);

        if (!_cancelled) {
          final HttpResponse response = httpClient.execute(method);

          if (response.getStatusLine().getStatusCode() != 200) {
View Full Code Here

    private void execute() {
        if (responseEntity != null) {
            return;
        }

        HttpGet getMethod = new HttpGet(this.uri);
        HttpResponse response;

        try {
            response = ((PreemptiveAuthHttpRequestFactory) SyncopeSession.get().getRestTemplate().getRequestFactory()).
                    getHttpClient().execute(getMethod);
View Full Code Here

            String uri = "/random/" + sizes[i];
            if (sizes[i] < 0)
                uri += "/";

            HttpGet request = new HttpGet(uri);

            HttpClientConnection conn = connectTo(target);
           
            httpContext.setAttribute(
                    ExecutionContext.HTTP_CONNECTION, conn);
            httpContext.setAttribute(
                    ExecutionContext.HTTP_TARGET_HOST, target);
            httpContext.setAttribute(
                    ExecutionContext.HTTP_REQUEST, request);

            request.setParams(
                    new DefaultedHttpParams(request.getParams(), defaultParams));
            httpExecutor.preProcess
                (request, httpProcessor, httpContext);
            HttpResponse response = httpExecutor.execute
                (request, conn, httpContext);
            response.setParams(
View Full Code Here

       
        @Override
        public void run() {
            try {
                for (int i = 0; i < this.repetitions; i++) {
                    HttpGet httpget = new HttpGet(this.requestURI);
                    HttpResponse response = this.httpclient.execute(
                            this.target,
                            httpget);
                    if (this.forceClose) {
                        httpget.abort();
                    } else {
                        HttpEntity entity = response.getEntity();
                        if (entity != null) {
                            entity.consumeContent();
                        }
View Full Code Here

        @Override
        public void run() {
            try {
                for (int r = 0; r < this.requestCount; r++) {
                    HttpGet httpget = new HttpGet("/");
                    HttpResponse response = this.httpclient.execute(
                            this.target,
                            httpget,
                            this.context);
                    this.count++;
View Full Code Here

           
            HttpHost target = new HttpHost(
                    LocalTestServer.TEST_SERVER_ADDR.getHostName(),
                    server.getServicePort(),
                    "https");
            HttpGet httpget = new HttpGet("/random/100");
            HttpResponse response = httpclient.execute(target, httpget);
            assertEquals(200, response.getStatusLine().getStatusCode());
            assertTrue(hostnameVerifier.isFired());
        } finally {
            server.stop();
View Full Code Here

        DefaultHttpClient client = new DefaultHttpClient();
        HttpResponse response;

        if(!relative) {
            String request = "http://" + host + ":" + port + uri;
            HttpGet httpget = new HttpGet(request);
            response = client.execute(httpget);
            response.getEntity().consumeContent()
        } else {
            HttpHost target = new HttpHost(host, port);
            HttpGet httpget = new HttpGet(uri);
            response = client.execute(target, httpget);
            response.getEntity().consumeContent()
        }
       
        assertEquals(HttpStatus.SC_OK, response.getStatusLine().getStatusCode());      
View Full Code Here

TOP

Related Classes of org.apache.http.client.methods.HttpGet

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.