Examples of HttpOptions


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

        // Request the options from the server so we can find out if the broker we are
        // talking to supports GZip compressed content.  If so and useCompression is on
        // then we can compress our POST data, otherwise we must send it uncompressed to
        // ensure backwards compatibility.
        HttpOptions optionsMethod = new HttpOptions(remoteUrl.toString());
        ResponseHandler<String> handler = new BasicResponseHandler() {
            @Override
            public String handleResponse(HttpResponse response) throws HttpResponseException, IOException {

                for(Header header : response.getAllHeaders()) {
View Full Code Here

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

            } else if (method.equals(HTTPConstants.HEAD)) {
                httpRequest = new HttpHead(uri);
            } else if (method.equals(HTTPConstants.TRACE)) {
                httpRequest = new HttpTrace(uri);
            } else if (method.equals(HTTPConstants.OPTIONS)) {
                httpRequest = new HttpOptions(uri);
            } else if (method.equals(HTTPConstants.DELETE)) {
                httpRequest = new HttpDelete(uri);
            } else if (method.equals(HTTPConstants.GET)) {
                httpRequest = new HttpGet(uri);
            } else if (method.equals(HTTPConstants.PATCH)) {
View Full Code Here

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

    }
   
    @Test
    public void preflightPostClassAnnotation() throws ClientProtocolException, IOException {
        HttpClient httpclient = new DefaultHttpClient();
        HttpOptions httpoptions = new HttpOptions("http://localhost:" + PORT + "/antest/unannotatedPost");
        httpoptions.addHeader("Origin", "http://in.org");
        // nonsimple header
        httpoptions.addHeader("Content-Type", "application/json");
        httpoptions.addHeader(CorsHeaderConstants.HEADER_AC_REQUEST_METHOD, "POST");
        httpoptions.addHeader(CorsHeaderConstants.HEADER_AC_REQUEST_HEADERS, "X-custom-1");
        HttpResponse response = httpclient.execute(httpoptions);
        assertEquals(200, response.getStatusLine().getStatusCode());
    }
View Full Code Here

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

    }
   
    @Test
    public void simplePostClassAnnotation() throws ClientProtocolException, IOException {
        HttpClient httpclient = new DefaultHttpClient();
        HttpOptions httpoptions = new HttpOptions("http://localhost:" + PORT + "/antest/unannotatedPost");
        httpoptions.addHeader("Origin", "http://in.org");
        // nonsimple header
        httpoptions.addHeader("Content-Type", "text/plain");
        httpoptions.addHeader(CorsHeaderConstants.HEADER_AC_REQUEST_METHOD, "POST");
        HttpResponse response = httpclient.execute(httpoptions);
        assertEquals(200, response.getStatusLine().getStatusCode());
    }
View Full Code Here

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

        configureAllowOrigins(true, null);
        String r = configClient.replacePath("/setAllowCredentials/false")
            .accept("text/plain").post(null, String.class);
        assertEquals("ok", r);
        HttpClient httpclient = new DefaultHttpClient();
        HttpOptions http = new HttpOptions("http://localhost:" + PORT + "/untest/annotatedPut");
        // this is the origin we expect to get.
        http.addHeader("Origin", "http://area51.mil:31415");
        http.addHeader(CorsHeaderConstants.HEADER_AC_REQUEST_METHOD, "PUT");
        http.addHeader(CorsHeaderConstants.HEADER_AC_REQUEST_HEADERS, "X-custom-1, X-custom-2");
        HttpResponse response = httpclient.execute(http);
        assertEquals(200, response.getStatusLine().getStatusCode());
        assertOriginResponse(false, new String[]{"http://area51.mil:31415"}, true, response);
        assertAllowCredentials(response, false);
        List<String> exposeHeadersValues
View Full Code Here

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

        String r = configClient.replacePath("/setAllowCredentials/false")
            .accept("text/plain").post(null, String.class);
        assertEquals("ok", r);
       
        HttpClient httpclient = new DefaultHttpClient();
        HttpOptions http = new HttpOptions("http://localhost:" + PORT + "/antest/delete");
        // this is the origin we expect to get.
        http.addHeader("Origin", "http://area51.mil:3333");
        http.addHeader(CorsHeaderConstants.HEADER_AC_REQUEST_METHOD, "DELETE");
        HttpResponse response = httpclient.execute(http);
        assertEquals(200, response.getStatusLine().getStatusCode());
        assertOriginResponse(false, new String[]{"http://area51.mil:3333"}, true, response);
        assertAllowCredentials(response, false);
        List<String> exposeHeadersValues
View Full Code Here

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

        String r = configClient.replacePath("/setAllowCredentials/false")
            .accept("text/plain").post(null, String.class);
        assertEquals("ok", r);
       
        HttpClient httpclient = new DefaultHttpClient();
        HttpOptions http = new HttpOptions("http://localhost:" + PORT + "/antest/delete");
        // this is the origin we expect to get.
        http.addHeader("Origin", "http://area51.mil:4444");
        http.addHeader(CorsHeaderConstants.HEADER_AC_REQUEST_METHOD, "DELETE");
        HttpResponse response = httpclient.execute(http);
        assertEquals(200, response.getStatusLine().getStatusCode());
        assertOriginResponse(false, new String[]{"http://area51.mil:4444"}, false, response);
        // we could check that the others are also missing.
    }
View Full Code Here

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

            } else if (method.equals(HTTPConstants.HEAD)) {
                httpRequest = new HttpHead(uri);
            } else if (method.equals(HTTPConstants.TRACE)) {
                httpRequest = new HttpTrace(uri);
            } else if (method.equals(HTTPConstants.OPTIONS)) {
                httpRequest = new HttpOptions(uri);
            } else if (method.equals(HTTPConstants.DELETE)) {
                httpRequest = new HttpDelete(uri);
            } else if (method.equals(HTTPConstants.GET)) {
                httpRequest = new HttpGet(uri);
            } else if (method.equals(HTTPConstants.PATCH)) {
View Full Code Here

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

            } else if (method.equalsIgnoreCase(Method.HEAD.getName())) {
                this.httpRequest = new HttpHead(requestUri);
            } else if (method.equalsIgnoreCase(Method.DELETE.getName())) {
                this.httpRequest = new HttpDelete(requestUri);
            } else if (method.equalsIgnoreCase(Method.OPTIONS.getName())) {
                this.httpRequest = new HttpOptions(requestUri);
            } else if (method.equalsIgnoreCase(Method.TRACE.getName())) {
                this.httpRequest = new HttpTrace(requestUri);
            } else {
                this.httpRequest = new HttpEntityEnclosingRequestBase() {
View Full Code Here

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

    public static Request Delete(final String uri) {
        return new Request(new HttpDelete(uri));
    }

    public static Request Options(final URI uri) {
        return new Request(new HttpOptions(uri));
    }
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.