Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Eclipse Rich Ajax Platform
Release 1.2

org.eclipse.rwt.service
Interface IServiceHandler


public interface IServiceHandler

A service handler is responsible for taking a request and sending an appropriate response by bypassing the standard lifecycle. Clients are free to implement custom service handlers. 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 = ContextProvider.getResponse();
         response.getWriter().write( "Hello World" );
       }
     }
     
  • Writing an XML file which assigns the service handler to a request parameter value. In order to be found, the XML file must be located at the root of the classpath and named servicehandler.xml.
     <?xml version="1.0" encoding="UTF-8"?>
     <servicehandler>
       <handler 
         class="org.demo.MyServiceHandler" 
         requestparameter="myServiceHandler"/>
     </servicehandler>
     
    Each servicehandler.xml may contain any number of handler entries.

  • Constructing the URL to invoke the service handler. The URL must contain the agreed on parameter value like this: https://localhost:9090/rap?custom_service_handler=myServiceHandler. The following example code snippet achieves this
     StringBuffer url = new StringBuffer();
     url.append( URLHelper.getURLString( false ) );
     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 RAP 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 RAP lifecycle to allow the service handler to respond to a request.

    Throws:
    IOException
    ServletException

    Eclipse Rich Ajax Platform
    Release 1.2

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


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire