Interceptor Demo  Locate

Overview  Locate

This demo shows how to write and use transport interceptors. You can find out what interceptors are in the Developer's Guide.

This interceptor monitors all readings and writings on input and output streams and dumps bytes onto System.out.

Demo Package Description  Locate

The files for this demo are as described in Files and Directories.

Pattern, Class, and Code Discussion  Locate

The implementation consists of following files:

src/demo/advanced/interceptor/server/InterceptorService.java
	- implementation of the Web Service. This class is used
	for the WSDL generation by SESJ Java2WSDL tool

src/demo/advanced/interceptor/server/InterceptorServer.java
	- runs server, publishes service and inserts interceptor

src/demo/advanced/interceptor/MyInterceptor.java
	- implementation class of the interceptor

src/demo/advanced/interceptor/client/InterceptorClient.java
	- client implementation containing the main() method

src/package.xml
	- deployment descriptor of the service package used
	during persistent deployment

Building and Running Demos  Locate

You can run the demo using the "run.sh" (for UNIX) or "run.bat" (for Windows) scripts. Running the script without arguments prints out a help message on screen.

The demo can be run in two different ways:

Runtime Publishing  Locate

To use Runtime Publishing, follow these steps:

  1. Be sure that you have not started SESJ.

  2. Compile the classes in the "demo.advanced.interceptor.server" package.

    Linux:   ./run.sh make_server
    Windows: run.bat make_server
    
  3. Run the InterceptorServer class (it starts SESJ and publishes InterceptorService).

    Linux:   ./run.sh run_server
    Windows: run.bat run_server
    
  4. Compile InterceptorClient.

    Linux:   ./run.sh make_client
    Windows: run.bat make_client
    
  5. Run InterceptorClient (it will call InterceptorService).

    Linux:   ./run.sh run_client
    Windows: run.bat run_client
    

Persistent Deployment  Locate

To run using Persistent Deployment:

Publish InterceptorService on SESJ which is already running.

  1. Be sure that you've started SESJ.

  2. Compile the InterceptorService class.

    Linux:   ./run.sh make_service
    Windows: run.bat make_service
    
  3. Deploy the service on the SESJ.

    Linux:   ./run.sh deploy_service
    Windows: run.bat deploy_service
    
  4. Compile InterceptorClient.

    Linux:   ./run.sh make_client
    Windows: ./run.bat make_client
    
  5. Run InterceptorClient (it will call InterceptorService).

    Linux:   ./run.sh run_client
    Windows: ./run.bat run_client
    
  6. Undeploy InterceptorService from the SESJ.

    Linux:   ./run.sh undeploy_service
    Windows: run.bat undeploy_service