Package org.apache.abdera.protocol.client

Examples of org.apache.abdera.protocol.client.AbderaClient.post()


      StringRequestEntity stringreq = new StringRequestEntity(
        f.toString(),"application/x-www-form-urlencoded","utf-8");
      String uri = "https://www.google.com/accounts/ClientLogin";
      RequestOptions options = abderaClient.getDefaultRequestOptions();
      options.setContentType("application/x-www-form-urlencoded");
      ClientResponse response = abderaClient.post(uri, stringreq, options);
      InputStream in = response.getInputStream();
      ByteArrayOutputStream out = new ByteArrayOutputStream();
      int n = -1;
      while ((n = in.read()) != -1) { out.write(n); }
      out.flush();
View Full Code Here


      AbderaClient client = new AbderaClient(abdera);
      Entry entry = abdera.newEntry();   
      entry.setTitle("testCreatePackageFromAtom");
      entry.setSummary("desc for testCreatePackageFromAtom");
     
      ClientResponse resp = client.post(generateBaseUrl() + "/packages", entry);
        //System.out.println(GetContent(resp.getInputStream()));

    assertEquals(ResponseType.SUCCESS, resp.getType());

    Document<Entry> doc = resp.getDocument();
View Full Code Here

    public void associateAspect(String resourcePath, String aspect) throws RegistryException {
        AbderaClient abderaClient = new AbderaClient(abdera);
        // POST as text to "<resource>;aspects"
        ByteArrayInputStream is = new ByteArrayInputStream(aspect.getBytes());
        ClientResponse resp = abderaClient.post(baseURI + APPConstants.ATOM +
                encodeURL(resourcePath +
                        RegistryConstants.URL_SEPARATOR +
                        APPConstants.ASPECTS),
                is,
                getAuthorization());
View Full Code Here

        // The content doesn't really matter here, so this is a placeholder for now.
        // Later on we'll likely want to support parameterized invocations, so we'll likely
        // enable posting form-encoded data.
        ByteArrayInputStream is = new ByteArrayInputStream("invoke".getBytes());
        ClientResponse resp = abderaClient.post(baseURI + APPConstants.ATOM +
                encodeURL(resourcePath +
                        RegistryConstants.URL_SEPARATOR +
                        APPConstants.ASPECT) + "(" + encodeURL(aspectName) + ")" +
                action,
                is,
View Full Code Here

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

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

        }
        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,
                        opts);
        if (response.getType() == Response.ResponseType.SUCCESS) {
View Full Code Here

    public String rename(String currentPath, String newPath) throws RegistryException {
        AbderaClient abderaClient = new AbderaClient(abdera);
        ByteArrayInputStream is = new ByteArrayInputStream(newPath.getBytes());
        ClientResponse resp =
                abderaClient.post(baseURI + APPConstants.ATOM +
                        encodeURL(currentPath +
                                RegistryConstants.URL_SEPARATOR +
                                APPConstants.PARAMETER_RENAME),
                        is,
                        getAuthorization());
View Full Code Here

    public String move(String currentPath, String newPath) throws RegistryException {
        AbderaClient abderaClient = new AbderaClient(abdera);
        ByteArrayInputStream is = new ByteArrayInputStream(newPath.getBytes());
        ClientResponse resp =
                abderaClient.post(baseURI + APPConstants.ATOM +
                        encodeURL(currentPath +
                                RegistryConstants.URL_SEPARATOR +
                                APPConstants.PARAMETER_MOVE),
                        is,
                        getAuthorization());
View Full Code Here

    public String copy(String sourcePath, String targetPath) throws RegistryException {
        AbderaClient abderaClient = new AbderaClient(abdera);
        ByteArrayInputStream is = new ByteArrayInputStream(targetPath.getBytes());
        ClientResponse resp =
                abderaClient.post(baseURI + APPConstants.ATOM +
                        encodeURL(sourcePath +
                                RegistryConstants.URL_SEPARATOR +
                                APPConstants.PARAMETER_COPY),
                        is,
                        getAuthorization());
View Full Code Here

    public void createVersion(String path) throws RegistryException {
        AbderaClient abderaClient = new AbderaClient(abdera);
        ByteArrayInputStream is = new ByteArrayInputStream("createVersion".getBytes());
        ClientResponse clientResponse =
                abderaClient.post(baseURI + APPConstants.ATOM +
                        encodeURL(path + RegistryConstants.URL_SEPARATOR +
                                APPConstants.CHECKPOINT),
                        is,
                        getAuthorization());
        final int status = clientResponse.getStatus();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.