Eclipse Rich Ajax Platform Release 1.3

## org.eclipse.rwt.service
Interface IServiceHandler

public interface IServiceHandler

A service handler can be used to process requests that bypass the standard request lifecycle. Clients are free to implement custom service handlers to deliver custom content. Implementing a custom service handler involves three steps:

- Implementing the IServiceHandler interface, e.g.

       public class MyServiceHandler implements IServiceHandler {

         public void service() throws IOException, ServletException {
           HttpServletResponse response = RWT.getResponse();
           response.getWriter().write( "Hello World" );
         }
       }

- Registering the service handler and associating it with a request parameter value.

       RWT.getServiceManager().registerServiceHandler( "myServiceHandler",
                                                       new MyServiceHandler() );

- Constructing the URL to invoke the service handler. The URL must contain the agreed parameter value like this: `http://localhost:9090/rap?custom_service_handler=myServiceHandler`. The following example code snippet achieves this

       StringBuffer url = new StringBuffer();
       url.append( RWT.getRequest().getContextPath() );
       url.append( RWT.getRequest().getServletPath() );
       url.append( "?" );
       url.append( IServiceHandler.REQUEST_PARAM );
       url.append( "=myServiceHandler" );
       String encodedURL = RWT.getResponse().encodeURL( url.toString() );

Since:
  1.0

Field Summary
`static String` `REQUEST_PARAM` The request parameter name to hold the service handlers name as its value (value is custom_service_handler).

Method Summary
`void` `service()` This method is called by the request lifecycle to allow the service handler to respond to a request.

Field Detail

### REQUEST_PARAM

    public static final String REQUEST_PARAM

  The request parameter name to hold the service handlers name as its value (value is custom_service_handler).

  See Also:
    Constant Field Values

Method Detail

### service

    public void service()
                 throws IOException,
                        ServletException

  This method is called by the request lifecycle to allow the service handler to respond to a request.

  Throws:
    `IOException`
    `ServletException`

Eclipse Rich Ajax Platform Release 1.3

Copyright (c) Innoopract Informationssysteme GmbH and others 2002, 2011. All rights reserved.