Package com.google.greaze.definition.webservice

Examples of com.google.greaze.definition.webservice.ResponseBody


      handleResponseCode(conn);
      HeaderMapSpec paramSpec = spec.getHeadersSpec();
      ResponseBodySpec bodySpec = spec.getBodySpec();
      // read response
      HeaderMap responseParams = readResponseHeaders(conn, paramSpec);
      ResponseBody responseBody = readResponseBody(conn, bodySpec);
      return new WebServiceResponse(responseParams, responseBody);
    } catch (IOException e) {
      throw new WebServiceSystemException(e);
    }
  }
View Full Code Here


    ConnectionPreconditions.checkArgument(connContentType.contains(bodySpec.getContentType()), conn);
    StringWriter writer = new StringWriter();
    Streams.copy(new InputStreamReader(conn.getInputStream()), writer, true, true);
    String json = writer.getBuffer().toString();
    if (LogConfig.INFO) logger.info("Response Body: " + json);
    ResponseBody body = gson.fromJson(json, ResponseBody.class);
    if (body == null) {
      body = new ResponseBody.Builder(spec.getBodySpec()).build();
    }
    return body;
  }
View Full Code Here

      .build();
    UrlParams urlParams = new UrlParams.Builder(requestSpec.getUrlParamsSpec(), query).build();
    WebServiceRequest request = new WebServiceRequest(
        HttpMethod.GET, requestHeadersBuilder.build(), urlParams, requestBody, inlined);
    WebServiceResponse response = stub.getResponse(callSpec, request, gson);
    ResponseBody body = response.getBody();
    // Using a local variable for listBody otherwise Maven freaks out while compiling
    List<Object> listBody = body.getListBody();
    return (List)listBody;
  }
View Full Code Here

    HeaderMapSpec headerSpec = new HeaderMapSpec.Builder().build();
    HeaderMap responseHeaders = new HeaderMap.Builder(headerSpec).build();
    ResponseBodySpec bodySpec = new ResponseBodySpec.Builder()
      .setListBody(resourceQuery.getResourceType())
      .build();
    ResponseBody responseBody = new ResponseBody.Builder(bodySpec)
      .setListBody(results)
      .build();
    WebServiceResponse response = new WebServiceResponse(responseHeaders, responseBody);
    Gson gson = gsonBuilder.get()
        .registerTypeAdapterFactory(new ResponseBodyGsonTypeAdapterFactory(bodySpec))
View Full Code Here

    Order order = placeOrder(cart, authToken);

    // Empty headers per the spec
    HeaderMap responseHeaders = new HeaderMap.Builder(responseSpec.getHeadersSpec()).build();
    ResponseBody responseBody = new ResponseBody.Builder(responseSpec.getBodySpec())
        .put(TypedKeys.ResponseBody.ORDER, order)
        .build();
    return new WebServiceResponse(responseHeaders, responseBody);
  }
View Full Code Here

TOP

Related Classes of com.google.greaze.definition.webservice.ResponseBody

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.