Package de.kosmos_lab.web.server
Class WebServer
- java.lang.Object
-
- de.kosmos_lab.web.server.WebServer
-
- Direct Known Subclasses:
ExampleWebServer
public abstract class WebServer extends Object
-
-
Field Summary
Fields Modifier and Type Field Description protected org.eclipse.jetty.servlet.ServletContextHandlercontextprotected static StringDEFAULT_CONFIGprotected static intDEFAULT_PORTprotected org.eclipse.jetty.server.handler.ContextHandlerCollectionhandlersprotected HashSet<Class<? extends jakarta.servlet.http.HttpServlet>>loadedServletsstatic org.slf4j.Loggerloggerprotected HashSet<String>pathsprotected intportprotected HashSet<String>servclassesprotected org.eclipse.jetty.server.Serverserverprotected Set<Class<? extends jakarta.servlet.http.HttpServlet>>servletsstatic intSTATUS_CONFLICTstatic intSTATUS_DUPLICATEstatic intSTATUS_ERRORstatic intSTATUS_FAILEDstatic intSTATUS_FORBIDDENstatic intSTATUS_METHOD_NOT_ALLOWEDstatic intSTATUS_MISSING_VALUEstatic intSTATUS_NO_AUTHstatic intSTATUS_NO_RESPONSEstatic intSTATUS_NOT_FOUNDstatic intSTATUS_OKstatic intSTATUS_UNPROCESSABLEstatic intSTATUS_VALIDATION_FAILEDprotected booleanstoppedprotected HashSet<String>wsPathsprotected HashSet<String>wssclassesprotected Set<Class<? extends WebSocketService>>wsservices
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddStaticFile(File f, String name)abstract WebSocketServicecreate(Class<? extends WebSocketService> servlet, WebSocketEndpoint api)abstract jakarta.servlet.http.HttpServletcreate(Class<? extends jakarta.servlet.http.HttpServlet> servlet, ApiEndpoint api)voidcreateServlet(Class<? extends jakarta.servlet.http.HttpServlet> servlet)voidcreateWebSocketService(Class<? extends WebSocketService> c)voidfindServlets(String[] namespaces, Class<? extends jakarta.servlet.http.HttpServlet> baseServletClass, Class<? extends WebSocketService> baseSocketClass)abstract org.json.JSONObjectgetConfig()StringgetDefaultConfig()intgetDefaultPort()intgetPort()protected Set<Class<? extends WebSocketService>>getWebSocketServices()booleanisStopped()voidloadResources()voidprepare()org.json.JSONObjectreadConfig()StringreplaceHostName(String cached, String hostname)protected voidsetConfigFile(File configFile)voidstart()voidstop()
-
-
-
Field Detail
-
logger
public static final org.slf4j.Logger logger
-
STATUS_OK
public static final int STATUS_OK
- See Also:
- Constant Field Values
-
STATUS_NO_RESPONSE
public static final int STATUS_NO_RESPONSE
- See Also:
- Constant Field Values
-
STATUS_FORBIDDEN
public static final int STATUS_FORBIDDEN
- See Also:
- Constant Field Values
-
STATUS_VALIDATION_FAILED
public static final int STATUS_VALIDATION_FAILED
- See Also:
- Constant Field Values
-
STATUS_DUPLICATE
public static final int STATUS_DUPLICATE
- See Also:
- Constant Field Values
-
STATUS_FAILED
public static final int STATUS_FAILED
- See Also:
- Constant Field Values
-
STATUS_NO_AUTH
public static final int STATUS_NO_AUTH
- See Also:
- Constant Field Values
-
STATUS_NOT_FOUND
public static final int STATUS_NOT_FOUND
- See Also:
- Constant Field Values
-
STATUS_CONFLICT
public static final int STATUS_CONFLICT
- See Also:
- Constant Field Values
-
STATUS_UNPROCESSABLE
public static final int STATUS_UNPROCESSABLE
- See Also:
- Constant Field Values
-
STATUS_MISSING_VALUE
public static final int STATUS_MISSING_VALUE
- See Also:
- Constant Field Values
-
STATUS_ERROR
public static final int STATUS_ERROR
- See Also:
- Constant Field Values
-
STATUS_METHOD_NOT_ALLOWED
public static final int STATUS_METHOD_NOT_ALLOWED
- See Also:
- Constant Field Values
-
DEFAULT_PORT
protected static final int DEFAULT_PORT
- See Also:
- Constant Field Values
-
DEFAULT_CONFIG
protected static final String DEFAULT_CONFIG
- See Also:
- Constant Field Values
-
server
protected org.eclipse.jetty.server.Server server
-
port
protected int port
-
wsservices
protected Set<Class<? extends WebSocketService>> wsservices
-
handlers
protected org.eclipse.jetty.server.handler.ContextHandlerCollection handlers
-
context
protected org.eclipse.jetty.servlet.ServletContextHandler context
-
stopped
protected boolean stopped
-
-
Method Detail
-
create
public abstract jakarta.servlet.http.HttpServlet create(Class<? extends jakarta.servlet.http.HttpServlet> servlet, ApiEndpoint api) throws InstantiationException, IllegalAccessException, InvocationTargetException, NoSuchMethodException
-
create
public abstract WebSocketService create(Class<? extends WebSocketService> servlet, WebSocketEndpoint api) throws InstantiationException, IllegalAccessException, InvocationTargetException, NoSuchMethodException
-
createServlet
public void createServlet(Class<? extends jakarta.servlet.http.HttpServlet> servlet)
-
isStopped
public boolean isStopped()
-
createWebSocketService
public void createWebSocketService(Class<? extends WebSocketService> c)
-
getConfig
public abstract org.json.JSONObject getConfig()
-
findServlets
public void findServlets(String[] namespaces, Class<? extends jakarta.servlet.http.HttpServlet> baseServletClass, Class<? extends WebSocketService> baseSocketClass)
-
readConfig
public org.json.JSONObject readConfig()
-
getDefaultConfig
public String getDefaultConfig()
-
getDefaultPort
public int getDefaultPort()
-
getPort
public int getPort()
-
prepare
public void prepare()
-
stop
public void stop()
-
setConfigFile
protected void setConfigFile(File configFile)
-
getWebSocketServices
protected Set<Class<? extends WebSocketService>> getWebSocketServices()
-
loadResources
public void loadResources()
-
-