English ▼
Skip to page content Skip to main navigation
e.g. "templates" or "datastore"

# The Webapp Module

#### Experimental!

ProtoRPC is an experimental, innovative, and rapidly changing new feature for App Engine. Unfortunately, being on the bleeding edge means that we may make backwards-incompatible changes to ProtoRPC. We will inform the community when this feature is no longer experimental.

This module contains classes that may be used to build a service on top of the App Engine Webapp framework.

You can configure the services request handler to handle a number of different request formats. Default formats use the default configuration. All wire formats must map the request to the request's `message.Message` class defined by the service handler. The handler can also send a response in any format that can be mapped from the response's `message.Message` class.

## Participants in an RPC

The lifecycle of an RPC uses four classes:

- Service factory – A parameterless function that returns a service instance. The methods of the Service instance intended for use as RPC methods must be decorated by the `remote` decorator. Service classes are factories, but can be further parameterized using Service.new_factory
- ServiceHandler – A `webapp.RequestHandler` sub-class that responds to the webapp framework. It mediates between the incoming HTTP request and service implementation classes. As determined by the Webapp framework, a new ServiceHandler instance is created to handle each user request. A handler is never used to handle more than one request.
- ServiceHandlerFactory – This class is responsible for creating a new, properly configured ServiceHandler instance for each request. Service handles are configured via new_factory.

## RPC mappers

RPC mappers translate between a single HTTP-based RPC protocol and the underlying service implementation. Each RPC mapper must configured with the following information to determine if it is an appropriate mapper for a given request:

- http_methods – Set of HTTP methods supported by handler.
- content_types – Set of supported content types.
- default_content_type – Default content type for handler responses.

## Built-in Mapper Implementations

- URLEncodedRPCMapper – Matches requests that are compatible with post forms with the `application/x-www-form-urlencoded` content-type. This content-type is the default if None is specified. It translates `POST` parameters into request parameters.
- ProtobufRPCMapper – Matches requests that are compatible with post forms with the `application/x-google-protobuf` content-type. It reads the contents of a binary post request.

- Overview
- WebApp Service Handlers