Package org.apache.wink.client

Examples of org.apache.wink.client.Resource.accept()


            String rss_url = "http://www.rssboard.org/files/rss-2.0-sample.xml";
            Resource feedResource = restClient.resource(rss_url);

            // perform a GET on the resource. The resource will be returned as
            // an Rss object
            RssFeed rss = feedResource.accept(MediaType.APPLICATION_XML_TYPE).get(RssFeed.class);

            System.out.println("RSS Title = " + rss.getChannel().getTitle());
            System.out.println("RSS Descritpion = " + rss.getChannel().getDescription());
            System.out.println("RSS Link = " + rss.getChannel().getLink());
            int itemCount = 0;
View Full Code Here


            // create the resource instance to interact with
            String rss_url = "http://www.rssboard.org/files/rss-2.0-sample.xml";
            Resource feedResource = restClient.resource(rss_url);

            // perform a GET on the resource. The resource will be returned as an Rss object
            RssFeed rssFeed = feedResource.accept(MediaType.APPLICATION_XML).get(RssFeed.class);

            // Map RSS into SyndFeed
            SyndFeed syndFeed = new SyndFeed();
            syndFeed = rssFeed.toSynd(syndFeed);
View Full Code Here

            // Create new Resource on given URL
            Resource resource = restClient.resource(defectsFeed);

            AppService service =
                resource.accept(MediaTypeUtils.ATOM_SERVICE_DOCUMENT).get(AppService.class);

            // Find workspace by it's title
            AppWorkspace workspace = service.getWorkspace(WORKSPACE_TITLE);

            // Find collection by title
View Full Code Here

            AppCollection collection = workspace.getCollection(COLLECTION_TITLE);
            String href = collection.getHref();

            // Get collection of defects
            Resource feedResource = restClient.resource(href);
            AtomFeed feed = feedResource.accept(MediaType.APPLICATION_ATOM_XML).get(AtomFeed.class);

            // Browse through collection of defects.
            listDefects(feed);
            listTests(restClient, testFeed);
View Full Code Here

        }
    }

    private static void listTests(RestClient restClient, String url) {
        Resource feedResource = restClient.resource(url);
        AtomFeed feed = feedResource.accept(MediaType.APPLICATION_ATOM_XML).get(AtomFeed.class);
        List<AtomEntry> entries = feed.getEntries();
        for (AtomEntry atomEntry : entries) {
            System.out.println("ID> " + atomEntry.getId()
                + " Title> "
                + atomEntry.getTitle().getValue());
View Full Code Here

            Cookie cookie = new Cookie(p.getKey(), String.valueOf(p.getValue()));
            resource.cookie(cookie);
        }

        resource.contentType(getContentType());
        resource.accept(getAccepts());       
       
        //handles declarative headers configured on the composite
        for(HTTPHeader header : binding.getHttpHeaders()) {
            //treat special headers that need to be calculated
            if(header.getName().equalsIgnoreCase("Expires")) {
View Full Code Here

            resource = resource.queryParams(params);
        }

        // Default content and accept types to XML if not configured
        resource = (type != null) ? resource.contentType(type) : resource.contentType(MediaType.APPLICATION_XML_TYPE);
        resource = (accept != null) ? resource.accept(type) : resource.accept(MediaType.APPLICATION_XML_TYPE);

        if (authCookie != null) {
            resource = resource.cookie(authCookie);
        }
View Full Code Here

            resource = resource.queryParams(params);
        }

        // Default content and accept types to XML if not configured
        resource = (type != null) ? resource.contentType(type) : resource.contentType(MediaType.APPLICATION_XML_TYPE);
        resource = (accept != null) ? resource.accept(type) : resource.accept(MediaType.APPLICATION_XML_TYPE);

        if (authCookie != null) {
            resource = resource.cookie(authCookie);
        }
View Full Code Here

    final private static String BASE_URI = ServerEnvironmentInfo.getBaseURI() + "/optionalproviders/blogservice";

    public void testAtomGETBlogs() throws Exception {
        RestClient client = new RestClient();
        Resource resource = client.resource(BASE_URI);
        AtomFeed feed = resource.accept("application/atom+xml").get(AtomFeed.class);
        assertEquals(BlogService.ID, feed.getId());
        assertEquals(BlogService.ID, feed.getTitle().getValue());
       
        List<AtomLink> expectedLinks = new ArrayList<AtomLink>();
        AtomLink link = new AtomLink();
View Full Code Here

    }
   
    public void testAtomGETBlog() throws Exception {
        RestClient client = new RestClient();
        Resource resource = client.resource(BASE_URI+"/blogs/0");
        AtomFeed feed = resource.accept("application/atom+xml").get(AtomFeed.class);
        assertEquals("0", feed.getId());
        assertEquals("wink-developer-blog", feed.getTitle().getValue());
       
        List<AtomLink> expectedLinks = new ArrayList<AtomLink>();
        AtomLink link = new AtomLink();
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.