Package com.google.greaze.definition

Examples of com.google.greaze.definition.CallPath


    if (LogConfig.FINE) log.fine("Received ServletPath: " + servletPath);
    String incomingPath =  servletPath.substring(greazeDispatcherServletPath.length());
    for (CallPath servicePath : servicePaths) {
      CallPathParser callPathParser = servicePath.toParser();
      try {
        CallPath incomingCallPath = callPathParser.parse(incomingPath);
        if (incomingCallPath.matches(servicePath)) {
          if (LogConfig.FINE) {
            log.fine(String.format(
                "Matched: Incoming path: %s, servicePath: %s", incomingPath, servicePath));
          }
          return callPathParser.parse(incomingPath);
View Full Code Here


  @SuppressWarnings("unchecked")
  @Override
  public boolean service(HttpServletRequest req, HttpServletResponse res)
      throws WebServiceSystemException {
    try {
      CallPath callPath = injector.getInstance(CallPath.class);
      if (callPath.equals(CallPath.NULL_PATH)) {
        throw new WebServiceSystemException(
            ErrorReason.INVALID_CALLPATH, req.getServletPath());
      }
      String queryName = RequestType.getQueryName(req.getParameterMap());
      RequestType requestType = RequestType.getRequestType(callPath, queryName, resourcePrefix);
View Full Code Here

  public RestCallSpec get(CallPath callPath) {
    if (callPath.getResourceId() != null) {
      // Rest call spec is the same for all resources of the same type irrespective of the id.
      // Since we are looking up in a Map, revise the callPath to ignore the id.
      callPath = new CallPath(callPath.getBasePath(), callPath.getVersion(),
          callPath.getServicePath(), null);
    }
    return resources.get(callPath);
  }
View Full Code Here

    super.setUp();
    this.gson = new Gson();
    ServerConfig serverConfig = new ServerConfig(SERVER_URL);
    this.client = new WebServiceClient(serverConfig);

    CallPath callPath = new CallPathParser(null, false, "/resource").parse(CALL_PATH);
    callSpec = new WebServiceCallSpec.Builder(callPath).build();
    HeaderMapSpec headerSpec = new HeaderMapSpec.Builder().build();
    requestHeaders = new HeaderMap.Builder(headerSpec).build();
    RequestBodySpec requestBodySpec = new RequestBodySpec.Builder().build();
    requestBody = new RequestBody.Builder(requestBodySpec).build();
View Full Code Here

  @Override
  protected void setUp() throws Exception {
    super.setUp();
    String resourcePrefix = "/rest";
    CallPath resourcePath = new CallPathParser(
        resourcePrefix, false, "/employee").parse(resourcePrefix + "/employee");
    ResourceUrlPaths urlPaths = new ResourceUrlPaths("http://localhost/fake/service/rest",
        "/fake", "/service", resourcePrefix);

    this.employees = new RepositoryInMemory<Employee>();
View Full Code Here

    super.setUp();
    this.gsonBuilder = new GsonBuilder().registerTypeAdapterFactory(new IdGsonTypeAdapterFactory());
    this.employees = new RepositoryInMemory<Employee>();
    this.queryHandler = new QueryHandlerEmployee(employees);

    CallPath queryPath =
        new CallPathParser("/rest", true, "/employee").parse("/rest/1.2/employee");
    this.urlPaths = new ResourceUrlPaths("http://localhost/fake/service/rest",
        "/fake", "/service", "/rest");
    ResourceQueryClientFake<Employee, QueryEmployeeByName> stub =
      new ResourceQueryClientFake<Employee, QueryEmployeeByName>(queryHandler, gsonBuilder,
View Full Code Here

    employees.put(new Employee(null, "foo"));
    employees.put(new Employee(null, "bar"));
  }

  public void testParamsRoundTripWithoutVersion() throws Exception {
    CallPath queryPath =
      new CallPathParser("/rest", false, "/employee").parse("/rest/employee");
    ResourceQueryClientFake<Employee, QueryEmployeeByName> stub =
      new ResourceQueryClientFake<Employee, QueryEmployeeByName>(
          queryHandler, gsonBuilder, urlPaths, queryPath, null);
    ResourceQueryClient<Employee, QueryEmployeeByName> queryClient =
View Full Code Here

      assertEquals("foo", employee.getName());
    }
  }

  public void testParamsRoundTripInlined() throws Exception {
    CallPath queryPath =
        new CallPathParser("/rest", true, "/employee").parse("/rest/1.2/employee");
    ResourceQueryClientFake<Employee, QueryEmployeeByName> stub =
      new ResourceQueryClientFake<Employee, QueryEmployeeByName>(
          queryHandler, gsonBuilder, urlPaths, queryPath, null);
    ResourceQueryClient<Employee, QueryEmployeeByName> queryClient =
View Full Code Here

TOP

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

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.