Appengine ja-night-sapporo#1 bt

1,194 views

Published on

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,194
On SlideShare
0
From Embeds
0
Number of Embeds
21
Actions
Shares
0
Downloads
8
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

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@

×