Package com.google.greaze.definition.webservice

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


  @SuppressWarnings({"rawtypes", "unchecked"})
  public void service(HttpServletRequest req, HttpServletResponse res,
      String queryName, CallPath callPath, ResourceQueryBase resourceQuery) {
    Preconditions.checkNotNull(resourceQuery);
    WebContextSpec webContextSpec = resourceQuery.getWebContextSpec();
    WebServiceCallSpec spec = ResourceQueryUtils.generateCallSpec(callPath,
        resourceQuery.getResourceType(), resourceQuery.getQueryType(),
        webContextSpec);
    RequestSpec requestSpec = spec.getRequestSpec();
    RequestReceiver requestReceiver = new RequestReceiver(gsonBuilder.get(), requestSpec);
    WebServiceRequest webServiceRequest = requestReceiver.receive(req);

    ResourceQueryParams queryParams =
      (ResourceQueryParams) webServiceRequest.getUrlParameters().getParamsObject();
View Full Code Here


  public ExampleClient() {
    wsClient = new WebServiceClient(new ServerConfig(SERVER_BASE_URL));
  }

  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())
      .put(TypedKeys.RequestBody.CART, cart)
      .build();
  WebServiceRequest request = new WebServiceRequest(
      HttpMethod.POST, requestHeaders, urlParams, requestBody, false);
  WebServiceResponse response = wsClient.getResponse(spec, request, gson);
View Full Code Here

  public WebServiceDispatcher(Injector injector) {
    this.injector = injector;
  }

  public void service(HttpServletRequest req, HttpServletResponse res) {
    WebServiceCallSpec spec = injector.getInstance(WebServiceCallSpec.class);
    RequestSpec requestSpec = spec.getRequestSpec();
    ResponseSpec responseSpec = spec.getResponseSpec();
    GsonBuilder gsonBuilder = injector.getInstance(GsonBuilder.class);
    RequestReceiver requestReceiver = new RequestReceiver(gsonBuilder, requestSpec);
    WebServiceRequest webServiceRequest = requestReceiver.receive(req);

    Gson gson = injector.getInstance(GsonBuilder.class)
View Full Code Here

TOP

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

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.