Examples of ClientResource


Examples of org.restlet.resource.ClientResource

                        }
                        // The form is ready to send...
                        Context.getCurrentLogger().info(
                                " Form size to send = " + f.size());
                        if (resource == null) {
                            resource = new ClientResource(action);
                        }
                        resource.setReference(action);
                        output = resource.post(f.getWebRepresentation());
                    }
                }
View Full Code Here

Examples of org.restlet.resource.ClientResource

    protected void setUp() throws Exception {
        super.setUp();
        Finder finder = new Finder();
        finder.setTargetClass(MyResource8.class);

        this.clientResource = new ClientResource("http://local");
        this.clientResource.setNext(finder);
    }
View Full Code Here

Examples of org.restlet.resource.ClientResource

    protected void setUp() throws Exception {
        super.setUp();
        Finder finder = new Finder();
        finder.setTargetClass(MyResource5.class);

        this.clientResource = new ClientResource("http://local");
        this.clientResource.setNext(finder);
    }
View Full Code Here

Examples of org.restlet.resource.ClientResource

    protected void setUp() throws Exception {
        super.setUp();
        Finder finder = new Finder();
        finder.setTargetClass(MyServerResource12.class);

        this.clientResource = new ClientResource("http://local");
        this.clientResource.setNext(finder);
        this.myResource = clientResource.wrap(MyResource12.class);
    }
View Full Code Here

Examples of org.restlet.resource.ClientResource

     * Test POST, PUT and GET using the ClientResource class
     *
     * @throws Exception
     */
    public void testWithClientResource() throws Exception {
        ClientResource sampleResource = new ClientResource(uri);
        List<Preference<MediaType>> m = new ArrayList<Preference<MediaType>>();
        m.add(new Preference<MediaType>(MediaType.APPLICATION_XML));
        sampleResource.getClientInfo().setAcceptedMediaTypes(m);

        Sample sample = new Sample(IN_STRING);
        sample = sampleResource.post(sample, Sample.class);
        assertEquals(HELLO_OUT_STRING, sample.getVal());

        sampleResource.put(sample);
        assertTrue(sampleResource.getStatus().isSuccess());

        sample = sampleResource.put(sample, Sample.class);
        assertEquals(HELLO_OUT_STRING, sample.getVal());

        sample = sampleResource.get(Sample.class);
        assertEquals(IN_STRING, sample.getVal());
    }
View Full Code Here

Examples of org.restlet.resource.ClientResource

    protected void setUp() throws Exception {
        super.setUp();
        Finder finder = new Finder();
        finder.setTargetClass(MyResource4.class);

        this.clientResource = new ClientResource("http://local");
        this.clientResource.setNext(finder);
    }
View Full Code Here

Examples of org.restlet.resource.ClientResource

    protected void setUp() throws Exception {
        super.setUp();
        Finder finder = new Finder();
        finder.setTargetClass(MyServerResource1.class);

        this.clientResource = new ClientResource("http://local");
        this.clientResource.setNext(finder);
        this.myResource = clientResource.wrap(MyResource1.class);
    }
View Full Code Here

Examples of org.restlet.resource.ClientResource

    protected void setUp() throws Exception {
        super.setUp();
        Finder finder = new Finder();
        finder.setTargetClass(MyResource7.class);

        this.clientResource = new ClientResource("http://local");
        this.clientResource.setNext(finder);
    }
View Full Code Here

Examples of org.restlet.resource.ClientResource

            System.err.println("You need to pass a term to search");
        } else {
            // Fetch a resource: an XML document full of search results
            String term = Reference.encode(args[0]);
            String uri = BASE_URI + "?appid=restbook&query=" + term;
            Representation entity = new ClientResource(uri).get();
            DomRepresentation document = new DomRepresentation(entity);

            // Use XPath to find the interesting parts of the data structure
            String expr = "/ResultSet/Result/Title";
            for (Node node : document.getNodes(expr)) {
View Full Code Here

Examples of org.restlet.resource.ClientResource

        assertEquals(MediaType.APPLICATION_ATOM, representation.getMediaType());
    }

    public void testRepresentationToObject() throws IOException {
        ConverterService cs = new ConverterService();
        ClientResource cr = new ClientResource(
                "clap://class/org/restlet/test/ext/atom/entry.xml");
        Representation representation = cr.get();
        Object object = cs.toObject(representation);
        assertTrue(object instanceof Feed);
    }
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.