## com.saxonica.deploy
Interface SharedApplicationDataHandler

    public interface SharedApplicationDataHandler

`SharedApplicationDataHandler` is an interface that can be implemented by applications wanting to run generated servlet code in an environment offering shared access to resources, for example the ability to execute many compiled queries concurrently against the same pool of in-memory documents. The object that implements this interface must be accessible to the compiled query servlets when it calls `getServletContext().getAttribute("com.saxonica.servlet.applicationdata")`.

The shared application data handler is called at `init()` time to supply the Saxon `Configuration` in which the query should run, and again on each servlet request to initialize the `Controller` under which the query runs, for example with values for external variables and with serialization options. The application data handler may also call `Controller.setURIResolver()` to supply a URI handler for calls on the `doc()` function, and can thus manage a pool of named documents in memory that are used by all queries within the application.

Method Summary
`Configuration` `getConfiguration(javax.servlet.ServletContext servletContext)` Supply the Configuration in which queries will execute.
`void` `handleServletRequest(javax.servlet.http.HttpServletRequest req, Controller controller)` Handle a servlet request.

Method Detail

### getConfiguration

    Configuration getConfiguration(javax.servlet.ServletContext servletContext)

  Supply the Configuration in which queries will execute. This method will be called from the init() method of a servlet.

  Parameters:
    `servletContext` - defines the environment in which the servlet executes
  Returns:
    the Configuration in which the servlet is to run. If queries are schema-aware, this must be a `SchemaAwareConfiguration`

### handleServletRequest

    void handleServletRequest(javax.servlet.http.HttpServletRequest req,
                              Controller controller)

  Handle a servlet request.

Copyright (c) Saxonica Limited. All rights reserved.