org.directwebremoting.extend
Interface Marshaller

All Known Implementing Classes:
BaseCallMarshaller, HtmlCallMarshaller, PlainCallMarshaller

public interface Marshaller

A Marshaller is responsible for all the on-the-wire communication between DWR on the server and the HTTP channel. engine.js does the corresponding work on the Javascript side.

Author:
Joe Walker [joe at getahead dot ltd dot uk]

Method Summary
 boolean isConvertable(java.lang.Class paramType)
          Check if we can coerce the given type
 void marshallException(HttpServletRequest request, HttpServletResponse response, java.lang.Exception ex)
          Try to find a batchId to send to the client so it knows what broke
 Calls marshallInbound(HttpServletRequest request, HttpServletResponse response)
          Marshall an incomming HttpRequest into an abstract Calls POJO that defines the functions that we need to call.
 void marshallOutbound(Replies replies, HttpServletRequest request, HttpServletResponse response)
          Marshall the return values from executing this batch of requests.
 

Method Detail

marshallInbound

Calls marshallInbound(HttpServletRequest request,
                      HttpServletResponse response)
                      throws java.io.IOException,
                             ServerException
Marshall an incomming HttpRequest into an abstract Calls POJO that defines the functions that we need to call.

Parameters:
request - The incoming Http request
response - An Ajax response, XML, JSON, Javascript, etc.
Returns:
Data specifying the methods to call
Throws:
java.io.IOException - If the connection breaks
ServerException - If an error occurs during parsing

marshallOutbound

void marshallOutbound(Replies replies,
                      HttpServletRequest request,
                      HttpServletResponse response)
                      throws java.io.IOException
Marshall the return values from executing this batch of requests.

Parameters:
replies - The objects to convert into a reply
request - The incoming Http request
response - An Ajax response, XML, JSON, Javascript, etc.
Throws:
java.io.IOException - If the connection breaks

marshallException

void marshallException(HttpServletRequest request,
                       HttpServletResponse response,
                       java.lang.Exception ex)
                       throws java.io.IOException
Try to find a batchId to send to the client so it knows what broke

Parameters:
request - The incoming Http request
response - An Ajax response, XML, JSON, Javascript, etc.
ex - The exception that we wish to propogate to the client
Throws:
java.io.IOException - If writing to the output stream fails

isConvertable

boolean isConvertable(java.lang.Class paramType)
Check if we can coerce the given type

Parameters:
paramType - The type to check
Returns:
true iff paramType is coercable