com.jproxy.proxy.callback
Class HttpCallbackClient

java.lang.Object
  extended bycom.jproxy.proxy.util.ThreadSupport
      extended bycom.jproxy.proxy.callback.HttpCallbackClient
All Implemented Interfaces:
CallbackClient, java.lang.Runnable, java.io.Serializable

public class HttpCallbackClient
extends ThreadSupport
implements java.io.Serializable, CallbackClient

The HttpCallbackClient class. The class implemnts client-side Tunnel server for callback support. It uses CallbackServer to get asynchronous requests. Then it delegates requests to instance of Invocator that perform a requests. The class also has methods to control thread that handles polling. The class has several static helper-methods.

See Also:
HttpCallbackClient, CallbackServer, Invocator, com.jproxy.server.ClassFileServer, Serialized Form

Field Summary
static java.lang.String CLASSSERVER_CLASSPATH
          The classpath for dynamic class downloading for client-side HttpServer
static int MIN_POLLING_DELAY
          If CALLBACK_POLLING_TIME is not set then DEFAULT_POLLING_TIME is used
 
Fields inherited from class com.jproxy.proxy.util.ThreadSupport
threads
 
Constructor Summary
HttpCallbackClient(java.lang.String _serverUrlStr, java.util.Hashtable env, CallbackServer _server)
          Contructs instance.
 
Method Summary
 void body()
           
 void call(java.lang.Object _arg)
          Passes request for method call to Invocator
static CallbackClient createCallbackClient(java.lang.String serverUrlStr, java.util.Hashtable env)
           
 java.lang.Object createCallbackProxy(java.lang.String[] interNames, java.lang.Object listener)
          Creates callback proxy
static CallbackServer createCallbackServer(java.lang.String serverUrlStr, java.util.Hashtable env)
          The static method-helper that creates instance of HttpCallbackServer on Tunneling server.
static void destroyCallbackClient(java.lang.String serverUrlStr)
           
 CallbackServer getCallbackServer()
          Returns proxy to CallbackServer.
 Invocator getInvocator()
          Returns Invocator.
 void start()
          Starts the thread that performs polling of CallbackServer located on Tunneling server.
 void stop()
          Stops the thread that performs polling of CallbackServer remote object.
 
Methods inherited from class com.jproxy.proxy.util.ThreadSupport
getThread, isRunning, isStopping, run, start, stop, stopAll
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.jproxy.proxy.callback.CallbackClient
isRunning
 

Field Detail

CLASSSERVER_CLASSPATH

public static final java.lang.String CLASSSERVER_CLASSPATH
The classpath for dynamic class downloading for client-side HttpServer

See Also:
Constant Field Values

MIN_POLLING_DELAY

public static final int MIN_POLLING_DELAY
If CALLBACK_POLLING_TIME is not set then DEFAULT_POLLING_TIME is used

See Also:
Constant Field Values
Constructor Detail

HttpCallbackClient

public HttpCallbackClient(java.lang.String _serverUrlStr,
                          java.util.Hashtable env,
                          CallbackServer _server)
                   throws TunnelException
Contructs instance. During construction instance of client-side Invocator is created.

Parameters:
env - the environment hashtable
Method Detail

createCallbackProxy

public java.lang.Object createCallbackProxy(java.lang.String[] interNames,
                                            java.lang.Object listener)
                                     throws TunnelException
Creates callback proxy

Specified by:
createCallbackProxy in interface CallbackClient
Parameters:
listener - the listener for the callback
Throws:
TunnelException

getCallbackServer

public CallbackServer getCallbackServer()
Returns proxy to CallbackServer.

Specified by:
getCallbackServer in interface CallbackClient

start

public void start()
Starts the thread that performs polling of CallbackServer located on Tunneling server.

Specified by:
start in interface CallbackClient

stop

public void stop()
Stops the thread that performs polling of CallbackServer remote object. It just sets stop flag and returns. You have to check isRunning flag to be sure if thread is stopped.

Specified by:
stop in interface CallbackClient
Overrides:
stop in class ThreadSupport

getInvocator

public Invocator getInvocator()
Returns Invocator. The instance of Invocator is used to perform requests.

Specified by:
getInvocator in interface CallbackClient

body

public void body()
          throws java.lang.InterruptedException
Throws:
java.lang.InterruptedException

call

public void call(java.lang.Object _arg)
Passes request for method call to Invocator

Specified by:
call in interface CallbackClient
Parameters:
_arg - the argument passed to Invocator

createCallbackClient

public static CallbackClient createCallbackClient(java.lang.String serverUrlStr,
                                                  java.util.Hashtable env)
                                           throws java.lang.Throwable
Throws:
java.lang.Throwable

createCallbackServer

public static CallbackServer createCallbackServer(java.lang.String serverUrlStr,
                                                  java.util.Hashtable env)
                                           throws java.lang.Throwable
The static method-helper that creates instance of HttpCallbackServer on Tunneling server.

Parameters:
serverUrlStr - URL String of Tunneling server where object must be created
Throws:
java.lang.Throwable

destroyCallbackClient

public static void destroyCallbackClient(java.lang.String serverUrlStr)
                                  throws TunnelException
Throws:
TunnelException


Copyright © JProxy LLC. All Rights Reserved.