Package org.apache.abdera.protocol.client

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


  @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 304 - Feed not provided since feed is modified since.
View Full Code Here


  @Test
    public void testUnmodifiedGetIfModified() throws Exception {   
    System.out.println(">>>ProviderFeedEntityTagsTestCase.testFeedUnmodifiedGetIfModified");
    // Feed request with predicates
    RequestOptions opts = new RequestOptions();
    final String contentType = "application/atom+xml";
    opts.setContentType(contentType);
    opts.setHeader( "If-Modified-Since", dateFormat.format( new Date( 0 ) ));
   
    ClientResponse res = client.get(providerURI, opts);
    Assert.assertNotNull(res);
    try {
      // Should return 200 - Feed provided since feed is changed.
View Full Code Here

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

    RequestOptions opts = new RequestOptions();
    String contentType = "application/atom+xml; type=entry";
    opts.setContentType(contentType);
    IRI colUri = new IRI(providerURI).resolve("customer");
    ClientResponse res = client.post(colUri.toString(), entry, opts);
     
    // Feed request with predicates
    opts = new RequestOptions();
    contentType = "application/atom+xml";
    opts.setContentType(contentType);
    opts.setHeader( "If-None-Match", eTag);
   
    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 testModifiedGetIfMatch() throws Exception {   
    System.out.println(">>>ProviderFeedEntityTagsTestCase.testFeedModifiedGetIfMatch");
    // 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 testModifiedGetIfUnModified() 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 304 - Feed not provided since feed is modified since.     
View Full Code Here

  @Test
    public void testModifiedGetIfModified() throws Exception {   
    System.out.println(">>>ProviderFeedEntityTagsTestCase.testFeedUnmodifiedGetIfModified");
    // Feed request with predicates
    RequestOptions opts = new RequestOptions();
    final String contentType = "application/atom+xml";
    opts.setContentType(contentType);
    opts.setHeader( "If-Modified-Since", dateFormat.format( lastModified ));
   
    ClientResponse res = client.get(providerURI, opts);
    Assert.assertNotNull(res);
    try {
      // Should return 200 - Feed provided since feed is changed.
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; type=entry";
    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

    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; type=entry";
    opts.setContentType(contentType);
    opts.setHeader( "If-None-Match", eTag);
   
    // AtomTestCaseUtils.printRequestHeaders( "Put request headers", "   ", opts );
    IRI colUri = new IRI(providerURI).resolve("customer");
    // res = client.post(colUri.toString() + "?test=foo", entry, opts);
      id = eTag.substring( 1, eTag.length()-1);
View Full Code Here

    // 4) Conditional GET example (get with etag. etag not in cache)
    // User client GET request
    //       GET /edit/first-post.atom HTTP/1.1
    // >      If-None-Match: "e180ee84f0671b1"

    RequestOptions opts = new RequestOptions();
    final String contentType = "application/atom+xml; type=entry";
    opts.setContentType(contentType);
    opts.setHeader( "If-None-Match", "123456");
    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

    // 3) Conditional GET example (get with etag. etag match)
    // User client GET request
    //       GET /edit/first-post.atom HTTP/1.1
    // >      If-None-Match: "e180ee84f0671b1"

    RequestOptions opts = new RequestOptions();
    final String contentType = "application/atom+xml; type=entry";
    opts.setContentType(contentType);
    opts.setHeader( "If-None-Match", eTag);
    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

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.