Package org.apache.abdera.i18n.iri

Examples of org.apache.abdera.i18n.iri.IRI


            Document<Entry> document = abderaParser.parse( post.getResponseBodyAsStream() );
            Entry entry = document.getRoot();
            String title = entry.getTitle();
            // System.out.println( "mediaPost entry.title=" + title );
            Assert.assertNotNull( title );
            IRI id = entry.getId();
            // System.out.println( "mediaPost entry.id=" + id );
            Assert.assertNotNull( id );
            mediaId = id.toString();
            Assert.assertNotNull( mediaId ); // Save for put/update request
            Date updated = entry.getUpdated();
            // System.out.println( "mediaPost entry.updated=" + updated);
            Assert.assertNotNull( updated );
            String summary = entry.getSummary();
            // System.out.println( "mediaPost entry.summary=" + summary);
            Assert.assertNotNull( summary );
            IRI contentSrc = entry.getContentSrc();
            // System.out.println( "mediaPost entry.content.src=" + contentSrc + ", type=" + entry.getContentType());
            Assert.assertNotNull( contentSrc );
            Link editLink = entry.getEditLink();
            // System.out.println( "mediaPost entry.editLink" + " rel=" + editLink.getRel() + ", href=" +  editLink.getHref() );
            Assert.assertNotNull( editLink );
View Full Code Here


        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);

        // Assert response status code is 201-OK.
        // Assert response header Content-Type: application/atom+xml; charset=UTF-8
        Assert.assertEquals(201, res.getStatus());
        String returnedContentType = res.getContentType().toString().trim();
View Full Code Here

    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();
        // Assert.assertEquals(contentType, returnedContentType );
        res.release();     
    }
View Full Code Here

    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());
            // Abdera 0.4 throws exception on getContentType with application/json.     
            // System.out.println( "ContentNegotiationTest.testJSONEntryGet contentType=" + res.getContentType());
            String contentType = res.getHeader( "Content-Type");
View Full Code Here

            } else if (content.getContentType() == Content.Type.MEDIA) {
                resource.setMediaType(content.getMimeType().toString());
            }
        }

        IRI srcIri = content.getSrc();
        if (srcIri != null) {
            try {
                final URL url = new URL(Utils.encodeRegistryPath(
                        URLDecoder.decode(srcIri.toString(), "utf-8")) +
                        ((resource.getPermanentPath() != null) ?
                                RegistryConstants.URL_SEPARATOR + "version:" + snapshotID : ""));
                resource.setContentURL(url);
                if (authorizationString != null) {
                    resource.setAuthorizationString(authorizationString);
                }
                return resource;
            } catch (IOException e) {
                throw new RegistryException("unable to receive source. " + srcIri.toString());
            }
        }

        String content1 = entry.getContent();
        resource.setContent(content1);
View Full Code Here

      FOMBuilder builder =
        new FOMBuilder(
          getFomFactory(options),
          reader,
          options);
      return getDocument(builder, base != null ? new IRI(base) : null, options);
    } catch (Exception e) {
      if (!(e instanceof ParseException))
        e = new ParseException(e);
      throw (ParseException)e;
    }
View Full Code Here

  public IRI getBaseUri() {
    return base;
  }

  public Document<T> setBaseUri(String base) {
    this.base = new IRI(base);
    return this;
  }
View Full Code Here

    return getHeader("Content-Language");
  }
 
  public IRI getContentLocation() {
    String value = getHeader("Content-Location");
    return (value != null) ? new IRI(value) : null;
  }
View Full Code Here

        } else if (arguments[0] instanceof AtomEntryHostObject) {
            AtomEntryHostObject atomEntryHostObject = (AtomEntryHostObject) arguments[0];
            Entry entry = atomEntryHostObject.getEntry();
            if (entry != null) {
                IRI editUri = null;
                try {
                    editUri = getEditURI(entry);
                    ClientResponse clientResponse = hostObject.client.get(editUri.toString());
                    Scriptable entryHostObject = cx.newObject(hostObject, "AtomEntry",
                                                              new Object[0]);
                    ((AtomEntryHostObject) entryHostObject).setEntry((Entry) clientResponse
                            .getDocument().getRoot());
                    return entryHostObject;
View Full Code Here

        } else if (arguments[0] instanceof AtomFeedHostObject) {
            AtomFeedHostObject atomFeedHostObject = (AtomFeedHostObject) arguments[0];
            Feed feed = atomFeedHostObject.getFeed();
            if (feed != null) {
                IRI editUri = null;
                try {
                    editUri = getEditURI(feed);
                    ClientResponse clientResponse = hostObject.client.get(editUri.toString());
                    Scriptable feedHostObject = cx.newObject(hostObject, "AtomFeed",
                                                             new Object[0]);
                    ((AtomFeedHostObject) feedHostObject).setFeed((Feed) clientResponse
                            .getDocument().getRoot());
                    return feedHostObject;
View Full Code Here

TOP

Related Classes of org.apache.abdera.i18n.iri.IRI

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.