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
java night #2
ProtocolBuffer on HTTP
   shin1ogawa@
ApiProxy#getDelegate()

 Application              Stub


 LowLevelAPI

                          PB
            ApiProxy
 ...
Delegate#makeSyncCall()
Service   ,Method   ,Request(byte[])

    ApiProxy
 #getDelegate()
 #makeSyncCall()


  PB(byte[])...
Server                  …


•               ApiProxy.setDelegate(
    Delegate)
    ProtocolBuffer
•
    ProtocolBuffer
•               OreOreDelegate
    #makeSyncCall()              Stub


•
    ApiProxy.getDelegate().makeSyncCall()


•    ...
ProtocolBuffer on HTTP


 Application


 LowLevelAPI
                           PB
 PB              OreOreServlet
OreOreDe...
MakeSyncCallServlet
           makeSyncCall()
String serviceName =
  req.getHeader(SERVICE_NAME);
String methodName = req....
MakeSyncCallDelegate
MakeSyncCall
public byte[] makeSyncCall(
  Environment environment, String serviceName,
  String meth...
•       Datastore
    "         Datastore
•       Datastore
    "         Datastore
•       Memcache
    "         Memcache
shin1ogawa@
Upcoming SlideShare
Loading in …5
×

Appengine Java Night #2 LT

1,976 views

Published on

Published in: Technology
  • Be the first to comment

Appengine Java Night #2 LT

  1. 1. appengine java night #2 ProtocolBuffer on HTTP shin1ogawa@
  2. 2. ApiProxy#getDelegate() Application Stub LowLevelAPI PB ApiProxy PB #getDelegate()
  3. 3. Delegate#makeSyncCall() Service ,Method ,Request(byte[]) ApiProxy #getDelegate() #makeSyncCall() PB(byte[]) Stub/
  4. 4. Server … • ApiProxy.setDelegate( Delegate) ProtocolBuffer • ProtocolBuffer
  5. 5. • OreOreDelegate #makeSyncCall() Stub • ApiProxy.getDelegate().makeSyncCall() • OreOreDelegate Low-Level API • Low-Level API Application
  6. 6. ProtocolBuffer on HTTP Application LowLevelAPI PB PB OreOreServlet OreOreDelegate PB
  7. 7. MakeSyncCallServlet makeSyncCall() String serviceName = req.getHeader(SERVICE_NAME); String methodName = req.getHeader(METHOD_NAME); byte[] requestBytes = IOUtils.toByteArray(req.getInputStream()); byte[] responseBytes = ApiProxy.getDelegate().makeSyncCall( ApiProxy.getCurrentEnvironment(), serviceName, methodName, requestBytes); resp.getOutputStream().write(responseBytes);
  8. 8. MakeSyncCallDelegate MakeSyncCall public byte[] makeSyncCall( Environment environment, String serviceName, String methodName, byte[] request) throws ApiProxyException { return protocolBufferOnHttp( environment, serviceName, methodName, request); } byte[] protocolBufferOnHttp(.....) { // makeSyncCall Post byte[] }
  9. 9. • Datastore " Datastore • Datastore " Datastore • Memcache " Memcache
  10. 10. shin1ogawa@

×