Package com.google.greaze.definition

Examples of com.google.greaze.definition.HeaderMap


    try {
      handleResponseCode(conn);
      HeaderMapSpec paramSpec = getSpec().getHeadersSpec();
      Type bodyType = getSpec().getResourceType();
      // read response
      HeaderMap responseParams = readResponseHeaders(conn, paramSpec);
      R responseBody = readResponseBody(conn, bodyType);
      return new RestResponseBase<I, R>(getSpec(), responseParams, responseBody);
    } catch (IOException e) {
      ErrorReason reason = ErrorReason.fromValue(conn, e);
      throw new WebServiceSystemException(reason, e);
View Full Code Here


    RestRequestSpec requestSpec = callSpec.getRequestSpec();
    HeaderMap.Builder requestHeadersBuilder = new HeaderMap.Builder(requestSpec.getHeadersSpec());
    if (context != null) {
      context.populate(requestHeadersBuilder);
    }
    HeaderMap requestHeaders = requestHeadersBuilder.build();
    UrlParamsSpec urlParamsSpec = callSpec.getRequestSpec().getUrlParamsSpec();
    UrlParams urlParams = new UrlParams.Builder(urlParamsSpec).build();
    RestRequestBase<I, R> request = new RestRequestBase<I, R>(
        HttpMethod.GET, requestHeaders, urlParams, resourceId, null, resourceType, inlined);
    RestResponseBase<I, R> response = stub.getResponse(callSpec, request, gson);
View Full Code Here

    RestRequestSpec requestSpec = callSpec.getRequestSpec();
    HeaderMap.Builder requestHeadersBuilder = new HeaderMap.Builder(requestSpec.getHeadersSpec());
    if (context != null) {
      context.populate(requestHeadersBuilder);
    }
    HeaderMap requestHeaders = requestHeadersBuilder.build();
    UrlParamsSpec urlParamsSpec = callSpec.getRequestSpec().getUrlParamsSpec();
    UrlParams urlParams = new UrlParams.Builder(urlParamsSpec).build();
    RestRequestBase<I, R> request = new RestRequestBase<I, R>(
        HttpMethod.POST, requestHeaders, urlParams, resource.getId(), resource, resourceType, inlined);
    RestResponseBase<I, R> response = stub.getResponse(callSpec, request, gson);
View Full Code Here

    RestRequestSpec requestSpec = callSpec.getRequestSpec();
    HeaderMap.Builder requestHeadersBuilder = new HeaderMap.Builder(requestSpec.getHeadersSpec());
    if (context != null) {
      context.populate(requestHeadersBuilder);
    }
    HeaderMap requestHeaders = requestHeadersBuilder.build();
    UrlParamsSpec urlParamsSpec = callSpec.getRequestSpec().getUrlParamsSpec();
    UrlParams urlParams = new UrlParams.Builder(urlParamsSpec).build();
    RestRequestBase<I, R> request = new RestRequestBase<I, R>(
        HttpMethod.PUT, requestHeaders, urlParams, resource.getId(), resource, resourceType, inlined);
    RestResponseBase<I, R> response = stub.getResponse(callSpec, request, gson);
View Full Code Here

    RestRequestSpec requestSpec = callSpec.getRequestSpec();
    HeaderMap.Builder requestHeadersBuilder = new HeaderMap.Builder(requestSpec.getHeadersSpec());
    if (context != null) {
      context.populate(requestHeadersBuilder);
    }
    HeaderMap requestHeaders = requestHeadersBuilder.build();
    UrlParamsSpec urlParamsSpec = callSpec.getRequestSpec().getUrlParamsSpec();
    UrlParams urlParams = new UrlParams.Builder(urlParamsSpec).build();
    RestRequestBase<I, R> request = new RestRequestBase<I, R>(
        HttpMethod.DELETE, requestHeaders, urlParams, resourceId, null, resourceType, inlined);
    stub.getResponse(callSpec, request, gson);
View Full Code Here

    try {
      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

  public Order placeOrder(Cart cart, String authToken) {
    WebServiceCallSpec spec = SampleJsonService.PLACE_ORDER;
    Gson gson = spec.addTypeAdapters(new GsonBuilder()).create();
   
  HeaderMap requestHeaders = new HeaderMap.Builder(spec.getRequestSpec().getHeadersSpec())
      .put(TypedKeys.Request.AUTH_TOKEN, authToken)
      .build();
  UrlParams urlParams = new UrlParams.Builder(spec.getRequestSpec().getUrlParamsSpec())
      .build();
  RequestBody requestBody = new RequestBody.Builder(spec.getRequestSpec().getBodySpec())
View Full Code Here

    ResourceQueryParams queryParams =
      (ResourceQueryParams) webServiceRequest.getUrlParameters().getParamsObject();
    WebContext context = new WebContextExtractor(webContextSpec).extract(webServiceRequest.getHeaders());
    List results = resourceQuery.query(queryParams, context);
    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)
View Full Code Here

    sender = new RequestSender(new Gson());
  }

  public void testContentTypeHeaderSkippedForGetAndDelete() {
    HeaderMapSpec requestHeaderSpec = new HeaderMapSpec.Builder().build();
    HeaderMap requestHeaders = new HeaderMap.Builder(requestHeaderSpec).build();
    RequestBodySpec requestBodySpec = new RequestBodySpec.Builder()
      .setSimpleBody(String.class)
      .build();
    RequestBody requestBody = new RequestBody.Builder(requestBodySpec).build();
    for (HttpMethod method : new HttpMethod[]{HttpMethod.GET, HttpMethod.DELETE}) {
View Full Code Here

    }
  }

  public void testBodyAndContentTypeHeaderForPostAndPut() {
    HeaderMapSpec requestHeaderSpec = new HeaderMapSpec.Builder().build();
    HeaderMap requestHeaders = new HeaderMap.Builder(requestHeaderSpec).build();
    RequestBodySpec requestBodySpec = new RequestBodySpec.Builder()
      .setSimpleBody(String.class)
      .build();
    RequestBody requestBody = new RequestBody.Builder(requestBodySpec)
      .setSimpleBody("hello world")
View Full Code Here

TOP

Related Classes of com.google.greaze.definition.HeaderMap

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.