Package com.ibm.sbt.services.client

Examples of com.ibm.sbt.services.client.Response


  }

  protected void deleteMembers(String requestUrl, List<Member> members, Map<String, String> parameters) throws ClientServicesException {
    try {
      MemberSerializer serializer = new MemberSerializer(members.get(0));
      Response response = delete(requestUrl, parameters, getAtomHeaders(), null, serializer.generateMemberFeed(members));
      checkResponseCode(response, HTTPCode.OK);
    } catch (ClientServicesException e) {
      throw e;
    } catch (Exception e) {
      throw new ClientServicesException(e);
View Full Code Here


        ActivitySerializer serializer = new ActivitySerializer(activity);
        payload = serializer.generateUpdate();
      }
      Map<String, String> headers = activity.hasAttachments() ? getMultipartHeaders() : getAtomHeaders();
      String uniqueId = (activity == null) ? null : activity.getActivityUuid();
      Response response = putData(requestUrl, parameters, headers, payload, uniqueId);
      checkResponseCode(response, expectedCode);
    } catch (ClientServicesException e) {
      throw e;
    } catch (Exception e) {
      throw new ClientServicesException(e);
View Full Code Here

    }
  }

  protected void deleteActivityEntity(String requestUrl, String activityUuid, Map<String, String> parameters) throws ClientServicesException {
    try {
      Response response = deleteData(requestUrl, parameters, activityUuid);
      checkResponseCode(response, HTTPCode.NO_CONTENT);
    } catch (ClientServicesException e) {
      throw e;
    } catch (Exception e) {
      throw new ClientServicesException(e);
View Full Code Here

      headers.put(TITLE, fileName);
      if (isLargeFile(fileContent)) {
        Map<String, String> xheaders = new HashMap<String, String>();
        xheaders.put(X_IBM_UPLOAD_METHOD, UPLOAD_METHOD_PHASES);
        xheaders.put(X_IBM_UPLOAD_SIZE, "" + fileContent.available());
        Response xresponse = createData(requestUrl, null, xheaders, null, null);
        checkResponseCode(xresponse, HTTPCode.OK);
        String token = xresponse.getResponseHeader(X_IBM_UPLOAD_TOKEN);

        headers.put(X_IBM_UPLOAD_TOKEN, token);
        headers.put(X_IBM_UPLOAD_METHOD, UPLOAD_METHOD_PHASES);       
      }

      Response response = createData(requestUrl, null, headers, fileContent, null);
      checkResponseCode(response, HTTPCode.OK);
    } catch (ClientServicesException e) {
      throw e;
    } catch (Exception e) {
      throw new ClientServicesException(e);
View Full Code Here

  protected void updateActivityNodeFile(String requestUrl, String fileName, InputStream fileContent, String mimeType) throws ClientServicesException {
    try {
      Map<String, String> xheaders = new HashMap<String, String>();
      xheaders.put(X_IBM_UPLOAD_METHOD, UPLOAD_METHOD_PHASES);
      xheaders.put(X_IBM_UPLOAD_SIZE, "" + fileContent.available());
      Response xresponse = putData(requestUrl, null, xheaders, null, null);
      checkResponseCode(xresponse, HTTPCode.OK);
      String token = xresponse.getResponseHeader(X_IBM_UPLOAD_TOKEN);

      Map<String, String> headers = new HashMap<String, String>();
      headers.put(SLUG, fileName);
      headers.put(CONTENT_TYPE, mimeType);
      headers.put(TITLE, fileName);
      headers.put(X_IBM_UPLOAD_TOKEN, token);
      headers.put(X_IBM_UPLOAD_METHOD, UPLOAD_METHOD_PHASES);

      Response response = putData(requestUrl, null, headers, fileContent, null);
      checkResponseCode(response, HTTPCode.OK);
    } catch (ClientServicesException e) {
      throw e;
    } catch (Exception e) {
      throw new ClientServicesException(e);
View Full Code Here

  protected ActivityNode createActivityNodeEntity(String requestUrl, ActivityNode activityNode, Map<String, String> parameters) throws ClientServicesException {
    try {
      ActivityNodeSerializer serializer = new ActivityNodeSerializer(activityNode);
      Map<String, String> headers = activityNode.hasAttachments() ? getMultipartHeaders() : getAtomHeaders();
      Response response = createData(requestUrl, parameters, headers, serializer.generateCreate());
      checkResponseCode(response, HTTPCode.CREATED);
      return updateActivityNodeEntityData(activityNode, response);
    } catch (ClientServicesException e) {
      throw e;
    } catch (Exception e) {
View Full Code Here

      List<ClientService.ContentPart> contentParts = new ArrayList<ClientService.ContentPart>();
      contentParts.add(new ContentPart("activityNode", serializer.generateCreate(), APPLICATION_ATOM_XML));
      contentParts.add(new ContentPart(fileName, fileContent, fileName, mimeType));

      Response response = createData(requestUrl, parameters, getMultipartHeaders(), contentParts);
      checkResponseCode(response, HTTPCode.CREATED);
      return updateActivityNodeEntityData(activityNode, response);
    } catch (ClientServicesException e) {
      throw e;
    } catch (Exception e) {
View Full Code Here

  protected void updateActivityNodeEntity(String requestUrl, ActivityNode activityNode, Map<String, String> parameters, HTTPCode expectedCode) throws ClientServicesException {
    try {
      ActivityNodeSerializer serializer = new ActivityNodeSerializer(activityNode);
      Map<String, String> headers = activityNode.hasAttachments() ? getMultipartHeaders() : getAtomHeaders();
      Response response = putData(requestUrl, parameters, headers, serializer.generateUpdate(), activityNode.getActivityNodeUuid());
      checkResponseCode(response, expectedCode);
    } catch (ClientServicesException e) {
      throw e;
    } catch (Exception e) {
      throw new ClientServicesException(e);
View Full Code Here

    }
  }

  protected void deleteActivityNodeEntity(String requestUrl, String activityNodeUuid, Map<String, String> parameters) throws ClientServicesException {
    try {
      Response response = deleteData(requestUrl, parameters, activityNodeUuid);
      checkResponseCode(response, HTTPCode.NO_CONTENT);
    } catch (ClientServicesException e) {
      throw e;
    } catch (Exception e) {
      throw new ClientServicesException(e);
View Full Code Here

     * @throws IOException
     */
    public JsonJavaObject addSubscriber(JsonJavaObject subscriberJson) throws BssException {
    try {
      String serviceUrl = BssUrls.API_RESOURCE_SUBSCRIBER.format(this);
      Response serverResponse = createData(serviceUrl, null, JsonHeader, subscriberJson, ClientService.FORMAT_JSON);
      return (serverResponse == null) ? null : (JsonJavaObject)serverResponse.getData();
    } catch (Exception e) {
      throw new BssException(e, "Error adding subscriber {0} caused by {1}", subscriberJson, e.getMessage());
    }
    }
View Full Code Here

TOP

Related Classes of com.ibm.sbt.services.client.Response

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.