Package org.apache.cxf.transport.http

Examples of org.apache.cxf.transport.http.HTTPConduit$InterposedMessageObserver


            bp.getRequestContext().remove(BindingProvider.USERNAME_PROPERTY);
            bp.getRequestContext().remove(BindingProvider.PASSWORD_PROPERTY);
           
            //try setting on the conduit directly
            Client client = ClientProxy.getClient(greeter);
            HTTPConduit httpConduit = (HTTPConduit)client.getConduit();
            AuthorizationPolicy policy = new AuthorizationPolicy();
            policy.setUserName("BJ2");
            policy.setPassword("pswd");
            httpConduit.setAuthorization(policy);
           
            s = greeter.greetMe("secure");
            assertEquals("Hello BJ2", s);
        } catch (UndeclaredThrowableException ex) {
            throw (Exception)ex.getCause();
View Full Code Here


    public void testGetBook123Client() throws Exception {
       
        String baseAddress = "http://localhost:" + PORT + "/test/services/rest";
        BookStoreJaxrsJaxws proxy = JAXRSClientFactory.create(baseAddress,
                                                                  BookStoreJaxrsJaxws.class);
        HTTPConduit conduit = (HTTPConduit)WebClient.getConfig(proxy).getConduit();
       
        Book b = proxy.getBook(new Long("123"));
        assertEquals(123, b.getId());
        assertEquals("CXF in Action", b.getName());
       
        HTTPConduit conduit2 = (HTTPConduit)WebClient.getConfig(proxy).getConduit();
        assertSame(conduit, conduit2);
       
        conduit.getClient().setAutoRedirect(true);
        b = proxy.getBook(new Long("123"));
        assertEquals(123, b.getId());
View Full Code Here

    
        List<Entry> entries = new LinkedList<Entry>();
        WebClient wcEntry = WebClient.create("http://localhost:" + PORT + "/atom/logs",
            Collections.singletonList(new AtomEntryProvider()))
            .accept("application/atom+xml;type=entry");
        HTTPConduit conduit = WebClient.getConfig(wcEntry).getHttpConduit();
        conduit.getClient().setReceiveTimeout(1000000);
        conduit.getClient().setConnectionTimeout(1000000);
        for (int i = 0; i < 8; i++) {
            Entry entry = wcEntry.path("entry/" + i).get(Entry.class);
            entry.toString();
            entries.add(entry);
            wcEntry.back(true);
View Full Code Here

    }
   
    @Test
    public void testPagedFeedWithReadWriteStorage() throws Exception {
        WebClient wc = WebClient.create("http://localhost:" + PORT + "/resource3/storage");
        HTTPConduit conduit = WebClient.getConfig(wc).getHttpConduit();
        conduit.getClient().setReceiveTimeout(1000000);
        conduit.getClient().setConnectionTimeout(1000000);
        wc.path("/log").get();
        Thread.sleep(3000);
       
        verifyStoragePages("http://localhost:"
                           + PORT + "/atom3/logs", "next", "Resource3", "theStorageLogger");
View Full Code Here

        LOG.fine("Created greeter client.");
        ConnectionHelper.setKeepAliveConnection(greeter, false, true);

        Client c = ClientProxy.getClient(greeter);
        HTTPConduit hc = (HTTPConduit)(c.getConduit());
        HTTPClientPolicy cp = hc.getClient();
        cp.setDecoupledEndpoint("http://localhost:" + DECOUPLE_PORT + "/decoupled_endpoint");

        out = new OutMessageRecorder();
        in = new InMessageRecorder();
View Full Code Here

        JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
        bean.setAddress(address);
        bean.setProperties(Collections.singletonMap(org.apache.cxf.message.Message.MTOM_ENABLED,
                                                    (Object)"true"));
        WebClient client = bean.createWebClient();
        HTTPConduit conduit = WebClient.getConfig(client).getHttpConduit();
        conduit.getClient().setReceiveTimeout(1000000);
        conduit.getClient().setConnectionTimeout(1000000);
       
        client.type("multipart/related").accept("multipart/related");
        XopType xop = new XopType();
        xop.setName("xopName");
        InputStream is =
View Full Code Here

    public void testAddGetImageWebClient() throws Exception {
        InputStream is1 =
            getClass().getResourceAsStream("/org/apache/cxf/systest/jaxrs/resources/java.jpg");
        String address = "http://localhost:" + PORT + "/bookstore/books/image";
        WebClient client = WebClient.create(address);
        HTTPConduit conduit = WebClient.getConfig(client).getHttpConduit();
        conduit.getClient().setReceiveTimeout(1000000);
        conduit.getClient().setConnectionTimeout(1000000);
        client.type("multipart/mixed").accept("multipart/mixed");
        InputStream is2 = client.post(is1, InputStream.class);
        byte[] image1 = IOUtils.readBytesFromStream(
            getClass().getResourceAsStream("/org/apache/cxf/systest/jaxrs/resources/java.jpg"));
        byte[] image2 = IOUtils.readBytesFromStream(is2);
View Full Code Here

    public void testUploadImageFromForm() throws Exception {
        InputStream is1 =
            getClass().getResourceAsStream("/org/apache/cxf/systest/jaxrs/resources/java.jpg");
        String address = "http://localhost:" + PORT + "/bookstore/books/formimage";
        WebClient client = WebClient.create(address);
        HTTPConduit conduit = WebClient.getConfig(client).getHttpConduit();
        conduit.getClient().setReceiveTimeout(1000000);
        conduit.getClient().setConnectionTimeout(1000000);
        client.type("multipart/form-data").accept("multipart/form-data");
       
        ContentDisposition cd = new ContentDisposition("attachment;filename=java.jpg");
        MultivaluedMap<String, String> headers = new MetadataMap<String, String>();
        headers.putSingle("Content-ID", "image");
View Full Code Here

        File file =
            new File(getClass().getResource("/org/apache/cxf/systest/jaxrs/resources/java.jpg")
                               .toURI().getPath());
        String address = "http://localhost:" + PORT + "/bookstore/books/formimage2";
        WebClient client = WebClient.create(address);
        HTTPConduit conduit = WebClient.getConfig(client).getHttpConduit();
        conduit.getClient().setReceiveTimeout(1000000);
        conduit.getClient().setConnectionTimeout(1000000);
        client.type("multipart/form-data").accept("multipart/form-data");
       
        MultipartBody body2 = client.post(file, MultipartBody.class);
        InputStream is2 = body2.getRootAttachment().getDataHandler().getInputStream();
        byte[] image1 = IOUtils.readBytesFromStream(
View Full Code Here

    public void testGetBook123Client() throws Exception {
       
        String baseAddress = "http://localhost:" + PORT + "/test/services/rest";
        BookStoreJaxrsJaxws proxy = JAXRSClientFactory.create(baseAddress,
                                                                  BookStoreJaxrsJaxws.class);
        HTTPConduit conduit = (HTTPConduit)WebClient.getConfig(proxy).getConduit();
       
        Book b = proxy.getBook(new Long("123"));
        assertEquals(123, b.getId());
        assertEquals("CXF in Action", b.getName());
       
        HTTPConduit conduit2 = (HTTPConduit)WebClient.getConfig(proxy).getConduit();
        assertSame(conduit, conduit2);
       
        conduit.getClient().setAutoRedirect(true);
        b = proxy.getBook(new Long("123"));
        assertEquals(123, b.getId());
View Full Code Here

TOP

Related Classes of org.apache.cxf.transport.http.HTTPConduit$InterposedMessageObserver

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.