Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Appengine ja-night-sapporo#1 bt

1,280 views

Published on

  • Be the first to comment

Appengine ja-night-sapporo#1 bt

  1. 1. appengine ja night sapporo#1 AppEngine Lower shin1ogawa@
  2. 2. Delegate
  3. 3. final ApiProxy.Delegate defaultDelegate = ApiProxy.getDelegate(); public byte[] makeSyncCall( Environment environment, String service, String method, byte[] request) throws ApiProxyException { System.out.println(service + “#” + method); defaultDelegate.makeSyncCall( serviceName, methodName, request); }
  4. 4. public byte[] makeSyncCall( Environment environment, String service, String method, byte[] request) throws ApiProxyException { if (service.equals(“datastore_v3”) && method.equalsIgnoreCase(“Put”) ){ throw new CapabilityDisabledException(); } defaultDelegate.makeSyncCall( serviceName, methodName, request); }
  5. 5. String service = req.getHeader(SERVICE_NAME); String method = req.getHeader(METHOD_NAME); byte[] requestBytes = IOUtils.toByteArray(req.getInputStream()); byte[] responseBytes = ApiProxy.getDelegate().makeSyncCall( ApiProxy.getCurrentEnvironment(), service, method, requestBytes); resp.getOutputStream().write(responseBytes);
  6. 6. public byte[] makeSyncCall( Environment environment, String service, String method, byte[] request) throws ApiProxyException { return protocolBufferOnHttp( environment, service, method, request); } byte[] protocolBufferOnHttp(.....) { // makeSyncCallServlet Post // byte[] }
  7. 7. shin1ogawa@

×