Package org.apache.abdera.i18n.iri

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


        if (arguments[0] instanceof AtomEntryHostObject) {
            AtomEntryHostObject atomEntryHostObject = (AtomEntryHostObject) arguments[0];
            Entry entry = atomEntryHostObject.getEntry();
            if (entry != null) {
                IRI editUri;
                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


        }
        return null;
    }

    private static IRI getEditURI(Entry entry) throws CarbonException {
        IRI editUri = null;
        List editLinks = entry.getLinks("edit");
        for (Iterator iter = editLinks.iterator(); iter.hasNext();) {
            Link link = (Link) iter.next();
            // if there is more than one edit link, we should not automatically
            // assume that it's always going to point to an Atom document
View Full Code Here

        return editUri;
    }


    private static IRI getEditURI(Feed feed) throws MimeTypeParseException, IRISyntaxException {
        IRI editUri = null;
        List editLinks = feed.getLinks("edit");
        for (Iterator iter = editLinks.iterator(); iter.hasNext();) {
            Link link = (Link) iter.next();
            // if there is more than one edit link, we should not automatically
            // assume that it's always going to point to an Atom document
View Full Code Here

            feed.setTitle(path);
            String[] childPaths = results.getChildren();
            for (String child : childPaths) {
                Resource entryObj = secureRegistry.get(child);
                Entry entry = factory.newEntry();
                IRI feedIRI = new IRI(getFeedIriForEntry(entryObj, request));
                addEntryDetails(request, entry, feedIRI, entryObj);
//                entry.addLink(child, "queryResult");
                feed.addEntry(entry);
            }
        } catch (Exception e) {
View Full Code Here

        } else {
            fullUrl = feedIri.toString();
        }

        String absoluteBase = fullUrl.substring(0, fullUrl.indexOf(APPConstants.ATOM));
        IRI mediaIri = new IRI(absoluteBase + APPConstants.RESOURCE + "/"
                + URLEncoder.encode(getMediaName(entryObj)));
        String mediaLink = mediaIri.toString();
        String mime = getContentType(entryObj);
        if (mime == null) {
            mime = "application/octet-stream";
        }
        try {
View Full Code Here

     */
    protected String getFeedIriForEntry(Resource entryObj, RequestContext request) {
        // We need to build the feed uri manually as the forwarded urls from the tenant url servlet
        // filter is causing problem (additional / at the start)in the request.getResolvedUri()
        // method
        IRI baseUri = request.getBaseUri();
        String feedString = baseUri.getScheme() + "://" + baseUri.getAuthority();

        IRI requestUri = request.getUri();
        String requestUriStr = "";
        if (requestUri != null) {
            requestUriStr = request.getUri().toString();
            // remove the additional '/' character.
            if (requestUriStr.length() > 1 &&
View Full Code Here

                              String contextPath,
                              IRI baseIri)
    {
        super(context,
                getMethod(request),
                new IRI(contextPath),
                baseIri);

        this.baseIri = baseIri;
        this.request = request;
        this.event = event;
View Full Code Here

            {
                logger.debug(event.getMessageAsString());
            }

            MuleMessage msg = event.getMessage();
            IRI baseIri = initBaseUri(event.getEndpointURI());
            String contextPath = msg.getInboundProperty(HttpConnector.HTTP_REQUEST_PROPERTY, StringUtils.EMPTY);

            Provider provider = abderaServiceComponent.getProvider();
            MuleRequestContext reqcontext = new MuleRequestContext(provider,
                                                                   event,
View Full Code Here

            if (!iri.endsWith("/"))
            {
                iri = iri + "/";
            }

            return new IRI(iri);
        }
View Full Code Here

        AbderaClient client = new AbderaClient(abdera);
        String base = "http://localhost:9002" + basePath + "/";

        // Testing of entry creation
        IRI colUri = new IRI(base).resolve("customers");
        Entry entry = factory.newEntry();
        entry.setTitle("Hmmm this is ignored right now");
        entry.setUpdated(new Date());
        entry.addAuthor("Acme Industries");
        entry.setId(factory.newUuidUri());
        entry.setSummary("Customer document");

        Element customerEl = factory.newElement(new QName("customer"));
        customerEl.setAttributeValue(new QName("name"), "Dan Diephouse");
        entry.setContent(customerEl);

        RequestOptions opts = new RequestOptions();
        opts.setContentType("application/atom+xml;type=entry");
        ClientResponse res = client.post(colUri.toString(), entry, opts);
        assertEquals(201, res.getStatus());

        IRI location = res.getLocation();
        assertEquals(basePath + "/customers/1001-Dan_Diephouse", location.toString());

        // GET the entry
        res = client.get(colUri.resolve(location.toString()).toString());
        assertEquals(200, res.getStatus());

        org.apache.abdera.model.Document<Entry> entry_doc = res.getDocument();
        entry = entry_doc.getRoot();
    }
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.