|
LimeWire Consolidated API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.limewire.http.BasicHttpAcceptor
public class BasicHttpAcceptor
Processes HTTP requests which are forwarded to HttpRequestHandler
objects that can be registered for a URL pattern.
The acceptor uses HttpCore and LimeWire's HTTP component for connection
handling. BasicHttpAcceptor needs to be started by invoking
#start(ConnectionDispatcher) in order to accept connection.
| Field Summary | |
|---|---|
static String[] |
DEFAULT_METHODS
|
| Constructor Summary | |
|---|---|
BasicHttpAcceptor(org.apache.http.params.HttpParams params,
AuthenticationInterceptor authenticationInterceptor,
String... supportedMethods)
|
|
| Method Summary | |
|---|---|
void |
acceptConnection(String word,
Socket socket)
Notification that a new incoming socket has been opened. |
void |
addAcceptorListener(HttpAcceptorListener listener)
Adds a listener for acceptor events. |
void |
addRequestInterceptor(org.apache.http.HttpRequestInterceptor interceptor)
Adds an interceptor for incoming requests. |
void |
addResponseInterceptor(org.apache.http.HttpResponseInterceptor interceptor)
Adds an interceptor for outgoing responses. |
static org.apache.http.params.HttpParams |
createDefaultParams(String userAgent,
int timeout)
|
String[] |
getHttpMethods()
Returns the supported HTTP methods, e.g. |
protected DispatchedIOReactor |
getReactor()
Returns the reactor. |
String |
getServiceName()
|
void |
initialize()
|
boolean |
isBlocking()
Returns true, if ConnectionAcceptor.acceptConnection(String, Socket) needs to be
invoked in a separate thread. |
void |
registerHandler(String pattern,
org.apache.http.nio.protocol.NHttpRequestHandler handler)
Registers a request handler for a request pattern. |
void |
removeAcceptorListener(HttpAcceptorListener listener)
Removes listener from the list of acceptor listeners. |
void |
removeRequestInterceptor(org.apache.http.HttpRequestInterceptor interceptor)
Removes an interceptor for incoming requests. |
void |
removeResponseInterceptor(org.apache.http.HttpResponseInterceptor interceptor)
Adds an interceptor for outgoing responses. |
void |
start()
Initializes the reactor. |
void |
stop()
|
void |
unregisterHandler(String pattern)
Unregisters the handlers for pattern. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String[] DEFAULT_METHODS
| Constructor Detail |
|---|
public BasicHttpAcceptor(org.apache.http.params.HttpParams params,
AuthenticationInterceptor authenticationInterceptor,
String... supportedMethods)
| Method Detail |
|---|
public static org.apache.http.params.HttpParams createDefaultParams(String userAgent,
int timeout)
public void acceptConnection(String word,
Socket socket)
ConnectionAcceptor
acceptConnection in interface ConnectionAcceptorword - first word that arrived on the wiresocket - the newly opened socket.public boolean isBlocking()
ConnectionAcceptorConnectionAcceptor.acceptConnection(String, Socket) needs to be
invoked in a separate thread.
isBlocking in interface ConnectionAcceptorpublic String[] getHttpMethods()
public void addAcceptorListener(HttpAcceptorListener listener)
public void addRequestInterceptor(org.apache.http.HttpRequestInterceptor interceptor)
HttpProcessorpublic void addResponseInterceptor(org.apache.http.HttpResponseInterceptor interceptor)
HttpProcessorprotected DispatchedIOReactor getReactor()
Note: Needs to be called from the NIODispatcher thread.
public void removeAcceptorListener(HttpAcceptorListener listener)
listener from the list of acceptor listeners.
addAcceptorListener(HttpAcceptorListener)public void removeRequestInterceptor(org.apache.http.HttpRequestInterceptor interceptor)
addRequestInterceptor(HttpRequestInterceptor)public void removeResponseInterceptor(org.apache.http.HttpResponseInterceptor interceptor)
addResponseInterceptor(HttpResponseInterceptor)
public void registerHandler(String pattern,
org.apache.http.nio.protocol.NHttpRequestHandler handler)
HttpRequestHandlerRegistry for a description of valid patterns.
If a request matches multiple handlers, the handler with the longer pattern is preferred.
Only a single handler may be registered per pattern.
pattern - the URI pattern to handle requests forhandler - the handler that processes the requestpublic void unregisterHandler(String pattern)
pattern.
#registerHandler(String, HttpRequestHandler)public void start()
start in interface Servicestop()public void stop()
stop in interface Servicestart()public void initialize()
initialize in interface Servicepublic String getServiceName()
getServiceName in interface Service
|
LimeWire Consolidated API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||