# WebApp Service Handlers - Google App Engine - Google Code

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

# WebApp Service Handlers

#### 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.

The `protorpc.webapp.service_handlers` package provides the following functions:

service_mapping(services, registry_path=DEFAULT_REGISTRY_PATH)

  Creates a services mapping for use with webapp.

  Creates basic default configuration and registration for ProtoRPC services. Each service listed in the service mapping has a standard service handler factory created for it.

  The list of mappings can either be an explicit path to service mapping or just services. If mappings are just services, they will automatically be mapped to their default name. For example:

      from protorpc import remote
      from protorpc.webapp import service_handlers

      package = 'my_package'

      class MyService(remote.Service):
        ...

      service_handlers.service_mapping(
          [('/my_path', MyService),  # Maps to /my_path
           MyService,                # Maps to /my_package/MyService
          ])

  Normally, services are mapped to URL paths by specifying a tuple (path, service), where path is the path where the service resides, and service is the service class or service factory for creating new instances of the service. For more information about service factories, please see remote.Service.new_factory.

  If no tuple is provided, and therefore no path specified, a default path is calculated by using the fully qualified service name using a URL path separator for each of its components instead of a '.'.

  Arguments:

  services
    A tuple (path, service), where `path` is the path where the service resides, and `service` is the service class or service factory for creating new instances of the service. For more information about service factories, please see remote.Service.new_factory.
  registry_path=DEFAULT_REGISTRY_PATH
    Path to provide to the registry service. Use None to disable registry service.

  Returns a list of tuples defining a mapping of request handlers compatible with a WebApp application.

  Raises a ServiceConfigurationError when duplicate paths are provided.

run_services(services, registry_path=DEFAULT_REGISTRY_PATH)

  Handles CGI request using service mapping.

  Arguments:

  services
    A tuple (path, service), where `path` is the path where the service resides, and `service` is the service class or service factory for creating new instances of the service. For more information about service factories, please see remote.Service.new_factory.
  registry_path=DEFAULT_REGISTRY_PATH
    Path to provide to the registry service. Use None to disable registry service.