Examples of addRequestProperty()


Examples of java.net.URLConnection.addRequestProperty()

                        .content(body)
                        .end();
            }
        }).start();
        URLConnection urlConnection = httpGet(webServer, "/");
        urlConnection.addRequestProperty("Cookie", new HttpCookie("a", "b").toString());
        urlConnection.addRequestProperty("Cookie", new HttpCookie("c", "\"d").toString() + "; " + new HttpCookie("e", "f").toString());
        assertEquals("Your cookies: a=b c=\"d e=f", contents(urlConnection));
    }

    @Test
View Full Code Here

Examples of java.net.URLConnection.addRequestProperty()

                        .end();
            }
        }).start();
        URLConnection urlConnection = httpGet(webServer, "/");
        urlConnection.addRequestProperty("Cookie", new HttpCookie("a", "b").toString());
        urlConnection.addRequestProperty("Cookie", new HttpCookie("c", "\"d").toString() + "; " + new HttpCookie("e", "f").toString());
        assertEquals("Your cookies: a=b c=\"d e=f", contents(urlConnection));
    }

    @Test
    public void behavesWellWhenThereAreNoInboundCookies() throws IOException {
View Full Code Here

Examples of java.net.URLConnection.addRequestProperty()

       
        String endpointAddress =
            "http://localhost:" + PORT + "/webapp/store1/bookstore/books/123";
        URL url = new URL(endpointAddress);
        URLConnection connect = url.openConnection();
        connect.addRequestProperty("Accept", "application/json");
        InputStream in = connect.getInputStream();
        assertNotNull(in);          

        assertEquals("Jackson output not correct",
                     "{\"class\":\"org.apache.cxf.systest.jaxrs.Book\",\"name\":\"CXF in Action\",\"id\":123}",
View Full Code Here

Examples of java.net.URLConnection.addRequestProperty()

    @Test
    public void testResourceAccessHeaderValidToken() throws Exception {

        URL url = new URL(Common.RESOURCE_SERVER + Common.PROTECTED_RESOURCE_HEADER);
        URLConnection c = url.openConnection();
        c.addRequestProperty(Common.HEADER_AUTHORIZATION, Common.AUTHORIZATION_HEADER_OAUTH2);

        if (c instanceof HttpURLConnection) {
            HttpURLConnection httpURLConnection = (HttpURLConnection)c;
            httpURLConnection.setRequestMethod("GET");
View Full Code Here

Examples of java.net.URLConnection.addRequestProperty()

            @Nonnull OWLOntologyLoaderConfiguration config) throws IOException {
        String requestType = getRequestTypes();
        URL originalURL = documentIRI.toURI().toURL();
        String originalProtocol = originalURL.getProtocol();
        URLConnection conn = originalURL.openConnection();
        conn.addRequestProperty("Accept", requestType);
        if (config.isAcceptingHTTPCompression()) {
            conn.setRequestProperty("Accept-Encoding", "gzip, deflate");
        }
        int connectionTimeout = config.getConnectionTimeout();
        conn.setConnectTimeout(connectionTimeout);
View Full Code Here

Examples of java.net.URLConnection.addRequestProperty()

                String newProtocol = newURL.getProtocol();
                if (!originalProtocol.equals(newProtocol)) {
                    // then different protocols: redirect won't follow
                    // automatically
                    conn = newURL.openConnection();
                    conn.addRequestProperty("Accept", requestType);
                    if (config.isAcceptingHTTPCompression()) {
                        conn.setRequestProperty("Accept-Encoding",
                                "gzip, deflate");
                    }
                    conn.setConnectTimeout(connectionTimeout);
View Full Code Here

Examples of java.net.URLConnection.addRequestProperty()

                input = input.replaceAll("shttp://", "http://");
            }
            URL url = new URL(input);
            URLConnection conn = url.openConnection();
            if(check)
                conn.addRequestProperty("host", "qinglie.taobao.com");
            conn.setConnectTimeout(30000);
            return conn.getInputStream();
        }
        catch (Throwable e) {
            logger.error("job get input error:" + jobtask.getJobName() + "," + jobtask.getInput(), e);
View Full Code Here

Examples of java.net.URLConnection.addRequestProperty()

        try {
            final URLConnection conn = this.url.openConnection();
            conn.setConnectTimeout(5000);

            if (this.apiKey != null) {
                conn.addRequestProperty("X-API-Key", this.apiKey);
            }
            conn.addRequestProperty("User-Agent", "Updater (by Gravity)");

            conn.setDoOutput(true);
View Full Code Here

Examples of java.net.URLConnection.addRequestProperty()

            conn.setConnectTimeout(5000);

            if (this.apiKey != null) {
                conn.addRequestProperty("X-API-Key", this.apiKey);
            }
            conn.addRequestProperty("User-Agent", "Updater (by Gravity)");

            conn.setDoOutput(true);

            final BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
            final String response = reader.readLine();
View Full Code Here

Examples of java.net.URLConnection.addRequestProperty()

        // Verify result
        endpointAddress = "http://localhost:9080/bookstore/books/123";
        URL url = new URL(endpointAddress);
        URLConnection connect = url.openConnection();
        connect.addRequestProperty("Accept", "application/xml");
        InputStream in = connect.getInputStream();
        assertNotNull(in);

        InputStream expected = getClass().getResourceAsStream("resources/expected_update_book.txt");
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.