Examples of HttpGet


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

     * @throws IOException
     */
    public void GET(final String uri) throws IOException {
        if (this.currentRequest != null) throw new IOException("Client is in use!");
        final MultiProtocolURI url = new MultiProtocolURI(uri);
        final HttpGet httpGet = new HttpGet(url.toNormalform(true, false, true, false));
        setHost(url.getHost()); // overwrite resolved IP, needed for shared web hosting DO NOT REMOVE, see http://en.wikipedia.org/wiki/Shared_web_hosting_service
        this.currentRequest = httpGet;
        execute(httpGet);
    }
View Full Code Here

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

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

      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

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

  }

  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

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

      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

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

    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

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

            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

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

       
        @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

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

        @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

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

           
            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
TOP
Copyright © 2018 www.massapi.com. 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.