Package org.apache.abdera.ext.opensearch.model

Examples of org.apache.abdera.ext.opensearch.model.Url


       
        document.setShortName(SHORT_NAME);
        document.setDescription(DESCRIPTION);
        document.setTags(TAG1, TAG2);
       
        Url url = new Url(Abdera.getInstance());
        url.setType(URL_TYPE);
        url.setTemplate(URL_TEMPLATE);
       
        Query query = new Query(Abdera.getInstance());
        query.setRole(Query.Role.EXAMPLE);
        query.setSearchTerms(QUERY_TERMS);
       
View Full Code Here


        Query q = doc.getRoot().getFirstChild(OpenSearchConstants.QUERY);
        assertNotNull(q);
        assertEquals(Query.Role.EXAMPLE, q.getRole());
        assertEquals(QUERY_TERMS, q.getSearchTerms());
       
        Url u = doc.getRoot().getFirstChild(OpenSearchConstants.URL);
        assertNotNull(u);
        assertEquals(URL_TYPE, u.getType());
        assertEquals(URL_TEMPLATE, u.getTemplate());
    }
View Full Code Here

    public void setOpenSearchUrlAdapter(OpenSearchUrlAdapter openSearchUrlAdapter) {
        this.openSearchUrlAdapter = openSearchUrlAdapter;
    }

    public Url asUrlElement(RequestContext request) {
        Url element = new Url(request.getAbdera());
        element.setType(ATOM_CONTENT_TYPE);

        StringBuilder template = new StringBuilder();
        template.append(this.getTemplateUrl(request));
        if (this.searchParameters != null) {
            template.append("?");
            for (int i = 0; i < this.searchParameters.length; i++) {
                OpenSearchUrlParameterInfo param = this.searchParameters[i];
                template.append(param.getName()).append("=").append("{").append(param.getValue());
                if (param.isOptional()) {
                    template.append("?");
                }
                template.append("}");
                if (i < this.searchParameters.length - 1) {
                    template.append("&");
                }
            }
        }
        element.setTemplate(template.toString());

        return element;
    }
View Full Code Here

        document.setShortName(SHORT_NAME);
        document.setDescription(DESCRIPTION);
        document.setTags(TAG1, TAG2);

        Url url = new Url(Abdera.getInstance());
        url.setType(URL_TYPE);
        url.setTemplate(URL_TEMPLATE);

        Query query = new Query(Abdera.getInstance());
        query.setRole(Query.Role.EXAMPLE);
        query.setSearchTerms(QUERY_TERMS);
View Full Code Here

        Query q = doc.getRoot().getFirstChild(OpenSearchConstants.QUERY);
        assertNotNull(q);
        assertEquals(Query.Role.EXAMPLE, q.getRole());
        assertEquals(QUERY_TERMS, q.getSearchTerms());

        Url u = doc.getRoot().getFirstChild(OpenSearchConstants.URL);
        assertNotNull(u);
        assertEquals(URL_TYPE, u.getType());
        assertEquals(URL_TEMPLATE, u.getTemplate());
    }
View Full Code Here

TOP

Related Classes of org.apache.abdera.ext.opensearch.model.Url

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.