Package org.apache.http.client.methods

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


                new BasicRedirectService(host, port, HttpStatus.SC_SEE_OTHER));
       
        DefaultHttpClient client = new DefaultHttpClient();
        HttpContext context = new BasicHttpContext();

        HttpGet httpget = new HttpGet("/oldlocation/");

        HttpResponse response = client.execute(getServerHttp(), httpget, context);
        HttpEntity e = response.getEntity();
        if (e != null) {
            e.consumeContent();
View Full Code Here


                new BasicRedirectService(host, port, HttpStatus.SC_NOT_MODIFIED));
       
        DefaultHttpClient client = new DefaultHttpClient();
        HttpContext context = new BasicHttpContext();

        HttpGet httpget = new HttpGet("/oldlocation/");

        HttpResponse response = client.execute(getServerHttp(), httpget, context);
        HttpEntity e = response.getEntity();
        if (e != null) {
            e.consumeContent();
View Full Code Here

                new BasicRedirectService(host, port, HttpStatus.SC_USE_PROXY));
       
        DefaultHttpClient client = new DefaultHttpClient();
        HttpContext context = new BasicHttpContext();

        HttpGet httpget = new HttpGet("/oldlocation/");

        HttpResponse response = client.execute(getServerHttp(), httpget, context);
        HttpEntity e = response.getEntity();
        if (e != null) {
            e.consumeContent();
View Full Code Here

                new BasicRedirectService(host, port, HttpStatus.SC_TEMPORARY_REDIRECT));
       
        DefaultHttpClient client = new DefaultHttpClient();
        HttpContext context = new BasicHttpContext();

        HttpGet httpget = new HttpGet("/oldlocation/");

        HttpResponse response = client.execute(getServerHttp(), httpget, context);
        HttpEntity e = response.getEntity();
        if (e != null) {
            e.consumeContent();
View Full Code Here

        DefaultHttpClient client = new DefaultHttpClient();
        client.getParams().setBooleanParameter(ClientPNames.ALLOW_CIRCULAR_REDIRECTS, true);
        client.getParams().setIntParameter(ClientPNames.MAX_REDIRECTS, 5);

        HttpGet httpget = new HttpGet("/circular-oldlocation/");

        try {
            client.execute(getServerHttp(), httpget);
            fail("ClientProtocolException exception should have been thrown");
        } catch (ClientProtocolException e) {
View Full Code Here

        this.localServer.register("*", new CircularRedirectService());

        DefaultHttpClient client = new DefaultHttpClient();
        client.getParams().setBooleanParameter(ClientPNames.ALLOW_CIRCULAR_REDIRECTS, false);

        HttpGet httpget = new HttpGet("/circular-oldlocation/");

        try {
            client.execute(getServerHttp(), httpget);
            fail("ClientProtocolException exception should have been thrown");
        } catch (ClientProtocolException e) {
View Full Code Here

        DefaultHttpClient client = new DefaultHttpClient();
        HttpContext context = new BasicHttpContext();

        client.getParams().setBooleanParameter(
                ClientPNames.REJECT_RELATIVE_REDIRECT, false);
        HttpGet httpget = new HttpGet("/oldlocation/");

        HttpResponse response = client.execute(getServerHttp(), httpget, context);
        HttpEntity e = response.getEntity();
        if (e != null) {
            e.consumeContent();
View Full Code Here

        DefaultHttpClient client = new DefaultHttpClient();
        HttpContext context = new BasicHttpContext();

        client.getParams().setBooleanParameter(
                ClientPNames.REJECT_RELATIVE_REDIRECT, false);
        HttpGet httpget = new HttpGet("/test/oldlocation");

        HttpResponse response = client.execute(getServerHttp(), httpget, context);
        HttpEntity e = response.getEntity();
        if (e != null) {
            e.consumeContent();
View Full Code Here

        DefaultHttpClient client = new DefaultHttpClient();

        client.getParams().setBooleanParameter(
                ClientPNames.REJECT_RELATIVE_REDIRECT, true);
        HttpGet httpget = new HttpGet("/oldlocation/");

        try {
            client.execute(getServerHttp(), httpget);
            fail("ClientProtocolException exception should have been thrown");
        } catch (ClientProtocolException e) {
View Full Code Here

    public void testRejectBogusRedirectLocation() throws Exception {
        this.localServer.register("*", new BogusRedirectService("xxx://bogus"));

        DefaultHttpClient client = new DefaultHttpClient();

        HttpGet httpget = new HttpGet("/oldlocation/");

        try {
            client.execute(getServerHttp(), httpget);
            fail("IllegalStateException should have been thrown");
        } catch (IllegalStateException e) {
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.