Package org.apache.abdera.protocol.client

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


    public void testOutOfDateGet() throws Exception {
        // 4) Conditional GET example (get with If-Mod. entry is not to date)
        // User client GET request
        //       GET /edit/first-post.atom HTTP/1.1
        // >      If-Modified-Since: Sat, 29 Oct 1844 19:43:31 GMT
        RequestOptions opts = new RequestOptions();
        final String contentType = "application/atom+xml; type=entry";
        opts.setContentType(contentType);
        opts.setHeader( "If-Modified-Since", "Sat, 29 Oct 1844 19:43:31 GMT"); // "EEE, dd MMM yyyy HH:mm:ss Z // RFC 822 Date
        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


    public void testUpToDateUnModGet() throws Exception {
        // 3) Conditional GET example (get with If-Unmod. entry is not modified (< predicate date).
        // User client GET request
        //       GET /edit/first-post.atom HTTP/1.1
        // >      If-Unmodified-Since: Sat, 29 Oct 2025 19:43:31 GMT
        RequestOptions opts = new RequestOptions();
        final String contentType = "application/atom+xml; type=entry";
        opts.setContentType(contentType);
        opts.setHeader( "If-Unmodified-Since", "Sat, 29 Oct 2050 19:43:31 GMT" );
        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

        // 4) Conditional GET example (get with If-Unmod. entry is modified (> predicate date)
        // User client GET request
        //       GET /edit/first-post.atom HTTP/1.1
        //        Host: example.org
        // >      If-Unmodified-Since: Sat, 29 Oct 1844 19:43:31 GMT
        RequestOptions opts = new RequestOptions();
        final String contentType = "application/atom+xml; type=entry";
        opts.setContentType(contentType);
        opts.setHeader( "If-Unmodified-Since", "Sat, 29 Oct 1844 19:43:31 GMT" );
        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

        if (((ResourceImpl) resource).isContentModified()) {
            element.addSimpleExtension(new QName(APPConstants.NAMESPACE, "contentModified"),
                    "true");
        }

        RequestOptions requestOptions = getAuthorization();
        requestOptions.setSlug(relativePath);

        ClientResponse resp;
        if (!alreadyExists) {
            resp = abderaClient.post(baseURI + APPConstants.ATOM + encodeURL(parentPath),
                    element, requestOptions);
View Full Code Here

        }
        entry.addSimpleExtension(new QName(APPConstants.NAMESPACE, "parentPath"), resource.getParentPath());
        if (((ResourceImpl) resource).isContentModified()) {
            entry.addSimpleExtension(new QName(APPConstants.NAMESPACE, "contentModified"), "true");
        }
        RequestOptions opts = getAuthorization();
        opts.setSlug(suggestedPath);
        opts.setContentType(resource.getMediaType());
        ClientResponse response =
                abderaClient.post(baseURI + APPConstants.ATOM + "?importURL=" +
                        encodeURL(sourceURL + RegistryConstants.URL_SEPARATOR +
                                APPConstants.IMPORT_MEDIA_TYPE),
                        entry,
View Full Code Here

        AbderaClient abderaClient = new AbderaClient(abdera);
        final Factory factory = abdera.getFactory();
        Element el = factory.newElement(APPConstants.QN_ASSOC);
        el.setAttributeValue(APPConstants.ASSOC_TYPE, associationType);
        el.setText(associationPaths);
        RequestOptions requestOptions = getAuthorization();
        requestOptions.setHeader("Destination", associationPaths);
        requestOptions.setHeader("AssociationType", associationType);
        ClientResponse resp = abderaClient.delete(baseURI + APPConstants.ATOM +
                encodeURL(sourcePath +
                        RegistryConstants.URL_SEPARATOR +
                        APPConstants.ASSOCIATIONS),
                requestOptions);
View Full Code Here

        return Integer.parseInt(intValue);
    }

    public Collection executeQuery(String path, Map parameters) throws RegistryException {
        AbderaClient abderaClient = new AbderaClient(abdera);
        RequestOptions requestOptions = getAuthorization();
        if (path == null) {
            path = "/";
        }
        ClientResponse resp = abderaClient.get(baseURI + APPConstants.ATOM +
                encodeURL(path + RegistryConstants.URL_SEPARATOR +
View Full Code Here

        if (resourcePath == null || "".equals(resourcePath)) {
            resourcePath = "/";
        }

        AbderaClient abderaClient = new AbderaClient(abdera);
        RequestOptions requestOptions = getAuthorization();
        requestOptions.addDateHeader("ToDate", to);
        requestOptions.addDateHeader("FromDate", from);
        requestOptions.addHeader("Action", "" + action);
        requestOptions.addHeader("Author", userName);
        ClientResponse resp = abderaClient.get(baseURI + APPConstants.ATOM +
                encodeURL(resourcePath +
                        RegistryConstants.URL_SEPARATOR +
                        APPConstants.PARAMETER_LOGS),
                requestOptions);
View Full Code Here

     * This method will create a RequestOptions object adding  Authorization headers.
     *
     * @return RequestOptions Created RequestOptions object
     */
    private RequestOptions getAuthorization() {
        RequestOptions requestOptions = new RequestOptions();
        requestOptions.setAuthorization(authorizationString);
        return requestOptions;
    }
View Full Code Here

        requestOptions.setAuthorization(authorizationString);
        return requestOptions;
    }

    private RequestOptions getAuthorizationForCaching(String path) {
        RequestOptions requestOptions = new RequestOptions();
        requestOptions.setAuthorization(authorizationString);
        requestOptions.setHeader("if-none-match", cache.getETag(path));
        return requestOptions;
    }
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.