Package org.apache.abdera.protocol.client

Examples of org.apache.abdera.protocol.client.RequestOptions


    public void testUpToDateUnModGet() throws Exception {
        // 3) Conditional GET example (get with If-Unmod. entry is not modified (< predicate date).
        // User client GET request
        //       GET /edit/first-post.atom HTTP/1.1
        // >      If-Unmodified-Since: Sat, 29 Oct 2025 19:43:31 GMT
        RequestOptions opts = new RequestOptions();
        final String contentType = "application/atom+xml";
        opts.setContentType(contentType);
        opts.setHeader( "If-Unmodified-Since", "Sat, 29 Oct 2050 19:43:31 GMT" );
        opts.setHeader( "Pragma", "no-cache"); // turn off client caching

        IRI colUri = new IRI(providerURI).resolve("customer");
        // res = client.post(colUri.toString() + "?test=foo", entry, opts);
        String id = eTag.substring( 1, eTag.length()-1);
        // Warning. AbderaClient.put(String uri,Base base,RequestOptions options) caches on the client side.
View Full Code Here


        // 4) Conditional GET example (get with If-Unmod. entry is modified (> predicate date)
        // User client GET request
        //       GET /edit/first-post.atom HTTP/1.1
        //        Host: example.org
        // >      If-Unmodified-Since: Sat, 29 Oct 1844 19:43:31 GMT
        RequestOptions opts = new RequestOptions();
        final String contentType = "application/atom+xml";
        opts.setContentType(contentType);
        opts.setHeader( "If-Unmodified-Since", "Sat, 29 Oct 1844 19:43:31 GMT" );
        opts.setHeader( "Pragma", "no-cache"); // turn off client caching

        IRI colUri = new IRI(providerURI).resolve("customer");
        // res = client.post(colUri.toString() + "?test=foo", entry, opts);
        String id = eTag.substring( 1, eTag.length()-1);
        // Warning. AbderaClient.put(String uri,Base base,RequestOptions options) caches on the client side.
View Full Code Here

        Content content = abdera.getFactory().newContent();
        content.setContentType(Content.Type.TEXT);
        content.setValue(customerName);
        entry.setContentElement(content);

        RequestOptions opts = new RequestOptions();
        final String contentType = "application/atom+xml";
        opts.setContentType(contentType);
        // AtomTestCaseUtils.printRequestHeaders( "Post request headers", "   ", opts );
        IRI colUri = new IRI(providerURI).resolve("customer");
        // res = client.post(colUri.toString() + "?test=foo", entry, opts);
        ClientResponse res = client.post(colUri.toString(), entry, opts);
View Full Code Here

    }

    @Test
    public void testXMLEntryGet() throws Exception {
        //System.out.println(">>>ContentNegotiationTest.testXMLEntryGet");
        RequestOptions opts = new RequestOptions();
        opts.setHeader( "Accept", "application/atom+xml" );

        IRI colUri = new IRI(providerURI).resolve("customer");
        ClientResponse res = client.get(colUri.toString() + "/" + lastId, opts);
        Assert.assertEquals(200, res.getStatus());
        String returnedContentType = res.getContentType().toString().trim();
View Full Code Here

    }

    @Test
    public void testJSONEntryGet() throws Exception {
        //System.out.println(">>>ContentNegotiationTest.testJSONEntryGet");
        RequestOptions opts = new RequestOptions();
        opts.setHeader( "Accept", "application/json" );

        IRI colUri = new IRI(providerURI).resolve("customer");
        ClientResponse res = client.get(colUri.toString() + "/" + lastId, opts);
        try {
            Assert.assertEquals(200, res.getStatus());
View Full Code Here

    }

    @Test
    public void testXMLFeedGet() throws Exception {
        //System.out.println(">>>ContentNegotiationTest.testXMLFeedGet");
        RequestOptions opts = new RequestOptions();
        opts.setHeader( "Accept", "application/atom+xml" );

        // Atom feed request
        ClientResponse res = client.get(providerURI, opts);
        Assert.assertNotNull(res);
        try {
View Full Code Here

    }

    @Test
    public void testJSONFeedGet() throws Exception {
        //System.out.println(">>>ContentNegotiationTest.testJSONFeedGet");
        RequestOptions opts = new RequestOptions();
        opts.setHeader( "Accept", "application/json" );

        // JSON feed request
        ClientResponse res = client.get(providerURI, opts);
        Assert.assertNotNull(res);
        try {
View Full Code Here

    @Test
    public void testUnmodifiedGetIfMatch() throws Exception {
        //System.out.println(">>>ProviderFeedEntityTagsTestCase.testFeedUnmodifiedGetIfMatch");
        // Feed request with predicates
        RequestOptions opts = new RequestOptions();
        final String contentType = "application/atom+xml";
        opts.setContentType(contentType);
        opts.setHeader( "If-Match", eTag);

        ClientResponse res = client.get(providerURI, opts);
        Assert.assertNotNull(res);
        try {
            String thisETag = res.getHeader("ETag");
View Full Code Here

    @Test
    public void testUnmodifiedGetIfNoneMatch() throws Exception {
        //System.out.println(">>>ProviderFeedEntityTagsTestCase.testFeedUnmodifiedGetIfNoneMatch");
        // Feed request with predicates
        RequestOptions opts = new RequestOptions();
        final String contentType = "application/atom+xml";
        opts.setContentType(contentType);
        opts.setHeader( "If-None-Match", eTag);

        ClientResponse res = client.get(providerURI, opts);
        Assert.assertNotNull(res);
        try {
            // Should return 304 - Feed not provided since it matches ETag.
View Full Code Here

    @Test
    public void testUnmodifiedGetIfUnModified() throws Exception {
        //System.out.println(">>>ProviderFeedEntityTagsTestCase.testFeedUnmodifiedGetIfUnModified");
        // Feed request with predicates
        RequestOptions opts = new RequestOptions();
        final String contentType = "application/atom+xml";
        opts.setContentType(contentType);
        opts.setHeader( "If-Unmodified-Since", dateFormat.format( new Date() ));

        ClientResponse res = client.get(providerURI, opts);
        Assert.assertNotNull(res);
        try {
            // Should return 200 - Feed provided since feed is unmodified since.
View Full Code Here

TOP

Related Classes of org.apache.abdera.protocol.client.RequestOptions

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.