Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

proxy.bearer.http
Class TalkingWithMobiles  view TalkingWithMobiles download TalkingWithMobiles.java

java.lang.Object
  extended byjava.lang.Thread
      extended byproxy.bearer.http.TalkingWithMobiles
All Implemented Interfaces:
HttpConstants, java.lang.Runnable
Direct Known Subclasses:
Worker

public class TalkingWithMobiles
extends java.lang.Thread
implements HttpConstants

Multithread proxy server using own data structere for served data.


Nested Class Summary
 
Nested classes inherited from class java.lang.Thread
java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
static int HTTP_ACCEPTED
           
static int HTTP_BAD_GATEWAY
           
static int HTTP_BAD_METHOD
           
static int HTTP_BAD_REQUEST
          4XX: client error
static int HTTP_CLIENT_TIMEOUT
           
static int HTTP_CONFLICT
           
static int HTTP_CREATED
           
static int HTTP_ENTITY_TOO_LARGE
           
static int HTTP_FORBIDDEN
           
static int HTTP_GATEWAY_TIMEOUT
           
static int HTTP_GONE
           
static int HTTP_INTERNAL_ERROR
           
static int HTTP_LENGTH_REQUIRED
           
static int HTTP_MOVED_PERM
           
static int HTTP_MOVED_TEMP
           
static int HTTP_MULT_CHOICE
          3XX: relocation/redirect
static int HTTP_NO_CONTENT
           
static int HTTP_NOT_ACCEPTABLE
           
static int HTTP_NOT_AUTHORITATIVE
           
static int HTTP_NOT_FOUND
           
static int HTTP_NOT_MODIFIED
           
static int HTTP_OK
          2XX: generally "OK"
static int HTTP_PARTIAL
           
static int HTTP_PAYMENT_REQUIRED
           
static int HTTP_PRECON_FAILED
           
static int HTTP_PROXY_AUTH
           
static int HTTP_REQ_TOO_LONG
           
static int HTTP_RESET
           
static int HTTP_SEE_OTHER
           
static int HTTP_SERVER_ERROR
          5XX: server error
static int HTTP_UNAUTHORIZED
           
static int HTTP_UNAVAILABLE
           
static int HTTP_UNSUPPORTED_TYPE
           
static int HTTP_USE_PROXY
           
static int HTTP_VERSION
           
(package private)  java.io.PrintStream log
           
(package private)  proxy.bearer.PreparedMessages myPreparedMessages
          here are kept messages which waits for delivery
protected  proxy.protocol.ProxyRequestManager myProxyRequestManager
           
private  int port
           
protected  java.util.Properties props
          Server's configuration information is stored in these properties
(package private)  java.io.File root
          the web server's virtual root.
(package private)  java.util.Vector threads
          Where worker threads stand idle
(package private)  int timeout
          timeout on client connections
(package private)  int workers
          max # worker threads
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
protected TalkingWithMobiles()
           
  TalkingWithMobiles(proxy.protocol.ProxyRequestManager _prm)
          proper constructor
 
Method Summary
 void ForwardFromMobile(proxy.bearer.ClientIdentifier ci, proxy.bearer.PreparedMessage pm)
          Forward message received from mobile to ReqestManager
(package private)  void loadProps()
          load configuration file.
protected  void log(java.lang.String s)
          print to the log file
static void main(java.lang.String[] a)
          run me.
protected  void p(java.lang.String s)
           
(package private)  void printProps()
          print Properties servers was ran with.
 void putAcknowledge(int owner, int mobile, int[] acknArr)
          If some message received from one mobile/application was procesed, this must be acknowledged here.
 void putNext(int code, int owner, int id, int mobile, byte[] msg)
           Saves given message so it waits for delivery when apropriate client ask for it.
 void run()
          The method of Thread that will be run if there is no Runnable object associated with the Thread.
 void setProxyRequestManager(proxy.protocol.ProxyRequestManager prm)
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

log

java.io.PrintStream log

props

protected java.util.Properties props
Server's configuration information is stored in these properties


threads

java.util.Vector threads
Where worker threads stand idle


root

java.io.File root
the web server's virtual root. Rather not used since serving files where used for testing only.


timeout

int timeout
timeout on client connections


workers

int workers
max # worker threads


myProxyRequestManager

protected proxy.protocol.ProxyRequestManager myProxyRequestManager

port

private int port

myPreparedMessages

proxy.bearer.PreparedMessages myPreparedMessages
here are kept messages which waits for delivery


HTTP_OK

public static final int HTTP_OK
2XX: generally "OK"

See Also:
Constant Field Values

HTTP_CREATED

public static final int HTTP_CREATED
See Also:
Constant Field Values

HTTP_ACCEPTED

public static final int HTTP_ACCEPTED
See Also:
Constant Field Values

HTTP_NOT_AUTHORITATIVE

public static final int HTTP_NOT_AUTHORITATIVE
See Also:
Constant Field Values

HTTP_NO_CONTENT

public static final int HTTP_NO_CONTENT
See Also:
Constant Field Values

HTTP_RESET

public static final int HTTP_RESET
See Also:
Constant Field Values

HTTP_PARTIAL

public static final int HTTP_PARTIAL
See Also:
Constant Field Values

HTTP_MULT_CHOICE

public static final int HTTP_MULT_CHOICE
3XX: relocation/redirect

See Also:
Constant Field Values

HTTP_MOVED_PERM

public static final int HTTP_MOVED_PERM
See Also:
Constant Field Values

HTTP_MOVED_TEMP

public static final int HTTP_MOVED_TEMP
See Also:
Constant Field Values

HTTP_SEE_OTHER

public static final int HTTP_SEE_OTHER
See Also:
Constant Field Values

HTTP_NOT_MODIFIED

public static final int HTTP_NOT_MODIFIED
See Also:
Constant Field Values

HTTP_USE_PROXY

public static final int HTTP_USE_PROXY
See Also:
Constant Field Values

HTTP_BAD_REQUEST

public static final int HTTP_BAD_REQUEST
4XX: client error

See Also:
Constant Field Values

HTTP_UNAUTHORIZED

public static final int HTTP_UNAUTHORIZED
See Also:
Constant Field Values

HTTP_PAYMENT_REQUIRED

public static final int HTTP_PAYMENT_REQUIRED
See Also:
Constant Field Values

HTTP_FORBIDDEN

public static final int HTTP_FORBIDDEN
See Also:
Constant Field Values

HTTP_NOT_FOUND

public static final int HTTP_NOT_FOUND
See Also:
Constant Field Values

HTTP_BAD_METHOD

public static final int HTTP_BAD_METHOD
See Also:
Constant Field Values

HTTP_NOT_ACCEPTABLE

public static final int HTTP_NOT_ACCEPTABLE
See Also:
Constant Field Values

HTTP_PROXY_AUTH

public static final int HTTP_PROXY_AUTH
See Also:
Constant Field Values

HTTP_CLIENT_TIMEOUT

public static final int HTTP_CLIENT_TIMEOUT
See Also:
Constant Field Values

HTTP_CONFLICT

public static final int HTTP_CONFLICT
See Also:
Constant Field Values

HTTP_GONE

public static final int HTTP_GONE
See Also:
Constant Field Values

HTTP_LENGTH_REQUIRED

public static final int HTTP_LENGTH_REQUIRED
See Also:
Constant Field Values

HTTP_PRECON_FAILED

public static final int HTTP_PRECON_FAILED
See Also:
Constant Field Values

HTTP_ENTITY_TOO_LARGE

public static final int HTTP_ENTITY_TOO_LARGE
See Also:
Constant Field Values

HTTP_REQ_TOO_LONG

public static final int HTTP_REQ_TOO_LONG
See Also:
Constant Field Values

HTTP_UNSUPPORTED_TYPE

public static final int HTTP_UNSUPPORTED_TYPE
See Also:
Constant Field Values

HTTP_SERVER_ERROR

public static final int HTTP_SERVER_ERROR
5XX: server error

See Also:
Constant Field Values

HTTP_INTERNAL_ERROR

public static final int HTTP_INTERNAL_ERROR
See Also:
Constant Field Values

HTTP_BAD_GATEWAY

public static final int HTTP_BAD_GATEWAY
See Also:
Constant Field Values

HTTP_UNAVAILABLE

public static final int HTTP_UNAVAILABLE
See Also:
Constant Field Values

HTTP_GATEWAY_TIMEOUT

public static final int HTTP_GATEWAY_TIMEOUT
See Also:
Constant Field Values

HTTP_VERSION

public static final int HTTP_VERSION
See Also:
Constant Field Values
Constructor Detail

TalkingWithMobiles

protected TalkingWithMobiles()

TalkingWithMobiles

public TalkingWithMobiles(proxy.protocol.ProxyRequestManager _prm)
proper constructor

Method Detail

p

protected void p(java.lang.String s)

log

protected void log(java.lang.String s)
print to the log file


putNext

public void putNext(int code,
                    int owner,
                    int id,
                    int mobile,
                    byte[] msg)

Saves given message so it waits for delivery when apropriate client ask for it.


putAcknowledge

public void putAcknowledge(int owner,
                           int mobile,
                           int[] acknArr)
If some message received from one mobile/application was procesed, this must be acknowledged here.


ForwardFromMobile

public void ForwardFromMobile(proxy.bearer.ClientIdentifier ci,
                              proxy.bearer.PreparedMessage pm)
Forward message received from mobile to ReqestManager


loadProps

void loadProps()
         throws java.io.IOException
load configuration file. must be in path pointed by JAVA_HOME enviroment variable.


printProps

void printProps()
print Properties servers was ran with.


setProxyRequestManager

public void setProxyRequestManager(proxy.protocol.ProxyRequestManager prm)

run

public void run()
Description copied from class: java.lang.Thread
The method of Thread that will be run if there is no Runnable object associated with the Thread. Thread's implementation does nothing at all.

Specified by:
run in interface java.lang.Runnable

main

public static void main(java.lang.String[] a)
                 throws java.lang.Exception
run me.