Package org.apache.abdera.model

Examples of org.apache.abdera.model.Document


        ClientResponse clientResponse =
                abderaClient.get(baseURI + APPConstants.ATOM +
                        encodeURL(path + RegistryConstants.URL_SEPARATOR +
                                APPConstants.PARAMETER_RATINGS + ":" + userName),
                        getAuthorization());
        Document introspection =
                clientResponse.getDocument();
        Entry entry = (Entry) introspection.getRoot();
        String intValue = entry.getContent();
        abderaClient.teardown();
        return Integer.parseInt(intValue);
    }
View Full Code Here


        ClientResponse resp = abderaClient.get(baseURI + APPConstants.ATOM +
                encodeURL(path + RegistryConstants.URL_SEPARATOR +
                        APPConstants.PARAMETER_QUERY) + "?" +
                buildQueryString(parameters),
                requestOptions);
        Document introspection = resp.getDocument();
        Feed feed = (Feed) introspection.getRoot();
        Collection c = createResourceFromFeed(feed);
        abderaClient.teardown();
        return c;
    }
View Full Code Here

        ClientResponse resp = abderaClient.get(baseURI + APPConstants.ATOM +
                encodeURL(resourcePath +
                        RegistryConstants.URL_SEPARATOR +
                        APPConstants.PARAMETER_LOGS),
                requestOptions);
        Document introspection =
                resp.getDocument();
        Feed feed = (Feed) introspection.getRoot();
        List entries = feed.getEntries();
        LogEntry logs[] = null;
        if (entries != null) {
            logs = new LogEntry[entries.size()];
            for (int i = 0; i < entries.size(); i++) {
View Full Code Here

                abderaClient.get(baseURI + APPConstants.ATOM +
                        encodeURL(resourcePath +
                        RegistryConstants.URL_SEPARATOR +
                        APPConstants.ASPECT) + "(" + encodeURL(aspectName) + ")",
                        getAuthorization());
        Document introspection = clientResponse.getDocument();
        Feed feed = (Feed) introspection.getRoot();
        List entries = feed.getEntries();
        if (entries != null) {
            String[] aspectActions = new String[entries.size()];
            for (int i = 0; i < entries.size(); i++) {
                Entry entry = (Entry) entries.get(i);
View Full Code Here

                        encodeURL(path +
                                RegistryConstants.URL_SEPARATOR +
                                APPConstants.PARAMETER_DUMP),
                        getAuthorization());
        if (clientResponse.getType() == Response.ResponseType.SUCCESS) {
            Document introspection = clientResponse.getDocument();
            Element element = introspection.getRoot();
            if (element instanceof OMElement) {
                try {
                    ((OMElement) element).serialize(writer);
                } catch (XMLStreamException e) {
                    throw new RegistryException("Failed to serialize the xml", e);
View Full Code Here

    WritableByteChannel out,
    WriterOptions options)
      throws IOException {
    String charset = options.getCharset();
    if (charset == null) {
      Document doc = null;
      if (base instanceof Document)
        doc = (Document) base;
      else if (base instanceof Element) {
        doc = ((Element)base).getDocument();
      }
      charset = doc != null ? doc.getCharset() : null;
    }
    writeTo(
      base,
      Channels.newWriter(
        out, charset != null ?
View Full Code Here

  public ClientResponse post(
    String uri,
    Base base,
    RequestOptions options) {
      if (base instanceof Document) {
        Document d = (Document) base;
        if (options.getSlug() == null &&
            d.getSlug() != null)
          options.setSlug(d.getSlug());
      }
      return execute("POST", uri, new BaseRequestEntity(base, options.isUseChunked()), options);
  }
View Full Code Here

      String uri,
      Base base,
      RequestOptions options) {
    if (options == null) options = getDefaultRequestOptions();
    if (base instanceof Document) {
      Document d = (Document) base;
      if (options.getSlug() == null &&
          d.getSlug() != null)
        options.setSlug(d.getSlug());
     
      if (options.isConditionalPut()) {
        if (d.getEntityTag() != null)
          options.setIfMatch(d.getEntityTag());
        else if (d.getLastModified() != null)
          options.setIfUnmodifiedSince(d.getLastModified());
      }
    }
    return execute("PUT", uri, new BaseRequestEntity(base, options.isUseChunked()), options);
  }
View Full Code Here

        assertNotNull(resp);
        assertEquals(ResponseType.SUCCESS, resp.getType());
        assertTrue(MimeTypeHelper.isMatch(resp.getContentType().toString(), OpenSearchConstants.OPENSEARCH_DESCRIPTION_CONTENT_TYPE));

        Document doc = resp.getDocument();
        StringWriter writer = new StringWriter();
        doc.writeTo(writer);

        String result = writer.toString();
        System.out.println(result);

        assertXpathEvaluatesTo(SHORT_NAME, "/os:OpenSearchDescription/os:ShortName", result);
View Full Code Here

  public Content setContent(InputStream in, String mediatype){
    if (MimeTypeHelper.isText(mediatype)) {
      try {
        StringBuilder buf = new StringBuilder();
        String charset = MimeTypeHelper.getCharset(mediatype);
        Document doc = this.getDocument();
        charset = charset != null ? charset : doc != null ? doc.getCharset() : null;
        charset = charset != null ? charset : "UTF-8";
        InputStreamReader isr = new InputStreamReader(in,charset);
        char[] data = new char[500];
        int r = -1;
        while ((r = isr.read(data)) != -1) {
View Full Code Here

TOP

Related Classes of org.apache.abdera.model.Document

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.