Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## nextapp.echo2.webrender.service
Class SynchronizeService

    java.lang.Object
      nextapp.echo2.webrender.service.SynchronizeService

All Implemented Interfaces:
  Service

Direct Known Subclasses:
  ContainerSynchronizeService

    public abstract class SynchronizeService

extends java.lang.Object
implements Service

A service which synchronizes the state of the client with that of the server. Requests made to this service are in the form of "ClientMessage" XML documents which describe the user's actions since the last synchronization, e.g., the input typed into text fields and the action taken (e.g., a button press) which caused the server interaction. The service parses this XML input from the client and performs updates to the server state of the application. Once the input has been processed by the server application, an output "ServerMessage" containing instructions to update the client state is generated as a response.

Nested Class Summary
`static interface` | `SynchronizeService.ClientMessagePartProcessor` An interface describing a ClientMessage MessagePart Processor.

Field Summary
`static java.lang.String` | `SERVICE_ID` `Service` identifier.

Fields inherited from interface nextapp.echo2.webrender.Service
`DO_NOT_CACHE`

Constructor Summary
`SynchronizeService()` Creates a new `SynchronizeService`.

Method Summary
`java.lang.String` | `getId()` Returns the unique identifier of this service.
`int` | `getVersion()` Returns the version of the service to be retrieved.
`protected void` | `processClientMessage(Connection conn, org.w3c.dom.Document clientMessageDocument)` Processes a "ClientMessage" XML document containing application UI state change information from the client.
`protected void` | `registerClientMessagePartProcessor(SynchronizeService.ClientMessagePartProcessor processor)` Registers a `ClientMessagePartProcessor` to handle a specific type of message part.
`protected abstract ServerMessage` | `renderInit(Connection conn, org.w3c.dom.Document clientMessageDocument)` Renders a `ServerMessage` in response to the initial synchronization.
`protected abstract ServerMessage` | `renderUpdate(Connection conn, org.w3c.dom.Document clientMessageDocument)` Renders a `ServerMessage` in response to a synchronization other than the initial synchronization.
`void` | `service(Connection conn)` Services an HTTP request.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### SERVICE_ID

    public static final java.lang.String SERVICE_ID

  `Service` identifier.

  See Also:
    Constant Field Values

Constructor Detail

### SynchronizeService

    public SynchronizeService()

  Creates a new `SynchronizeService`.

Method Detail

### getId

    public java.lang.String getId()

  Description copied from interface: `Service`
  Returns the unique identifier of this service.

  Specified by:
    `getId` in interface `Service`
  Returns:
    The unique identifier of this service.
  See Also:
    `Service.getId()`

### getVersion

    public int getVersion()

  Description copied from interface: `Service`
  Returns the version of the service to be retrieved. When a service is requested with an updated version number, a non-cached copy will be used. `getVersion()` should return distinct values whenever the service's content may have changed.

  Specified by:
    `getVersion` in interface `Service`
  Returns:
    The current version number of the service.
  See Also:
    `Service.getVersion()`

### processClientMessage

    protected void processClientMessage(Connection conn,
                                        org.w3c.dom.Document clientMessageDocument)

  Processes a "ClientMessage" XML document containing application UI state change information from the client. This method will parse the message parts of the ClientMessage and invoke the `ClientMessagePartProcessor`s registered to process them.

  Parameters:
    `conn` - the relevant `Connection`
    `clientMessageDocument` - the ClientMessage XML document to process
  See Also:
    `SynchronizeService.ClientMessagePartProcessor`

### registerClientMessagePartProcessor

    protected void registerClientMessagePartProcessor(SynchronizeService.ClientMessagePartProcessor processor)

  Registers a `ClientMessagePartProcessor` to handle a specific type of message part.

  Parameters:
    `processor` - the `ClientMessagePartProcessor` to register
  Throws:
    `java.lang.IllegalStateException` - if a processor with the same name is already registered

### renderInit

    protected abstract ServerMessage renderInit(Connection conn,
                                                org.w3c.dom.Document clientMessageDocument)

  Renders a `ServerMessage` in response to the initial synchronization.

  Parameters:
    `conn` - the relevant `Connection`
    `clientMessageDocument` - the ClientMessage XML document
  Returns:
    the generated `ServerMessage`

### renderUpdate

    protected abstract ServerMessage renderUpdate(Connection conn,
                                                  org.w3c.dom.Document clientMessageDocument)

  Renders a `ServerMessage` in response to a synchronization other than the initial synchronization.

  Parameters:
    `conn` - the relevant `Connection`
    `clientMessageDocument` - the ClientMessage XML document
  Returns:
    the generated `ServerMessage`

### service

    public void service(Connection conn)
                 throws java.io.IOException

  Description copied from interface: `Service`
  Services an HTTP request. Information about the HTTP request as well as methods for issuing a response are available from the provided Connection object.

  Specified by:
    `service` in interface `Service`
  Parameters:
    `conn` - A `Connection` object which wraps `HttpServletRequest` and `HttpServletResponse` objects and provides access to the facilities of the Echo application container.
  Throws:
    `java.io.IOException` - in the event of errors related to processing the HTTP request or producing a response.
  See Also:
    `Service.service(nextapp.echo2.webrender.Connection)`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD