Package no.polaric.core.httpd
Class ServerBase
java.lang.Object
no.polaric.core.httpd.ServerBase
- Direct Known Subclasses:
Services,WsNotifier
Abstract base class for REST API implementations, etc.
Contains some useful methods..
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddSubtype(Class type, String name) Add a subtype to be used in JSON mapper.static Stringprotected StringclientIpAddr(io.javalin.http.Context ctx) protected ServerConfigconf()Get interface to the server-configstatic ObjectdeserializeJson(String text, Class cls) Deserialize object from JSONprotected StringSanitize text that can be used in HTML output.static ObjectDeserialize object from JSONprotected AuthInfogetAuthInfo(io.javalin.http.Context ctx) Get info about logged-in user and authorizationprotected Stringicon()protected Stringprotected voidProtect an URL.protected voidProtect an URL.protected static doubleroundDeg(double x) static StringserializeJson(Object obj) Serialize object to JSONvoidsystemNotification(String user, String txt, int ttl) Send a system notification to a user.static StringSerialize object to JSONprotected Stringprotected WebServerwServer()Get interface to the web-server
-
Field Details
-
_conf
-
a
protected io.javalin.Javalin a -
_encoding
- See Also:
-
utcTime
-
localTime
-
mapper
protected static final com.fasterxml.jackson.databind.ObjectMapper mapper
-
-
Constructor Details
-
ServerBase
-
-
Method Details
-
toJson
Serialize object to JSON -
fromJson
Deserialize object from JSON -
serializeJson
Serialize object to JSON -
deserializeJson
Deserialize object from JSON -
addSubtype
Add a subtype to be used in JSON mapper. -
icon
-
conf
Get interface to the server-config -
wServer
Get interface to the web-server -
roundDeg
protected static double roundDeg(double x) -
protect
Protect an URL. Require login and the given authorization level -
protect
Protect an URL. Require login -
getAuthInfo
Get info about logged-in user and authorization- Returns:
- AuthInfo.
-
clientIpAddr
-
systemNotification
Send a system notification to a user. TTL is in minutes -
fixText
Sanitize text that can be used in HTML output. -
cleanPath
-
metaTag
-
urlDecode
-