org.webbitserver
Interface Endpoint<T>

All Known Subinterfaces:
WebServer, WebSocket
All Known Implementing Classes:
NettyWebServer, WebSocketClient

public interface Endpoint<T>


Method Summary
 T connectionExceptionHandler(Thread.UncaughtExceptionHandler handler)
          What to do when an exception occurs when attempting to read/write data from/to the underlying connection.
 Executor getExecutor()
          Get main work executor that all handlers will execute on.
 URI getUri()
          Get base URI that endpoint is serving on (or connected to).
 T setupSsl(InputStream keyStore, String pass)
          Setup SSL/TLS handler

This is shortcut for setupSsl(keyStore, pass, pass).

 Future<? extends T> start()
          Start in background.
 Future<? extends T> stop()
          Stop in background.
 T uncaughtExceptionHandler(Thread.UncaughtExceptionHandler handler)
          What to do when an exception gets thrown in a handler.
 

Method Detail

start

Future<? extends T> start()
Start in background. This returns immediately, but the endpoint may still not be ready to accept incoming requests (or have established a connection - if this is a client). To wait until it's fully started, call Future.get() on the returned future.


stop

Future<? extends T> stop()
Stop in background. This returns immediately, but the endpoint may still be shutting down. To wait until it's fully stopped, call Future.get() on the returned future.


uncaughtExceptionHandler

T uncaughtExceptionHandler(Thread.UncaughtExceptionHandler handler)
What to do when an exception gets thrown in a handler.

Defaults to using PrintStackTraceExceptionHandler. It is suggested that apps supply their own implementation (e.g. to log somewhere).


connectionExceptionHandler

T connectionExceptionHandler(Thread.UncaughtExceptionHandler handler)
What to do when an exception occurs when attempting to read/write data from/to the underlying connection. e.g. If an HTTP request disconnects before it was expected.

Defaults to using SilentExceptionHandler as this is a common thing to happen on a network, and most systems should not care.


getExecutor

Executor getExecutor()
Get main work executor that all handlers will execute on.


getUri

URI getUri()
Get base URI that endpoint is serving on (or connected to).


setupSsl

T setupSsl(InputStream keyStore,
           String pass)
           throws WebbitException
Setup SSL/TLS handler

This is shortcut for setupSsl(keyStore, pass, pass).

Parameters:
keyStore - Keystore InputStream
pass - Store and key password
Returns:
current WebServer instance
Throws:
WebbitException - A problem loading the keystore
See Also:
#setupSsl(String, String, String)


Copyright © 2012. All Rights Reserved.