- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
HttpServerImpl,JProServerImpl
Http server interface.
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidclose()static HttpServercreate(@Nullable javafx.stage.Stage stage) Creates a http server.decodeParams(String queryParams) Decodes parameters in percent-encoded URI-format and adds them to given Map.Return the full URL (with query string) the client used to request the server.Return the parameters of the request.default StringReturn the full URL (without the query string) the client used to request the server.Return the server host.intReturn the server port.Opens the given URL string in the browser.voidstart()Starts the server.voidstop()Stops the server.
-
Method Details
-
create
Creates a http server. If the application is running in a browser via JPro server, then a wrapper over JPro is returned. If the application is not running inside the browser, then a local http server is created.- Parameters:
stage- the application stage- Returns:
- the HTTP server instance
- Throws:
HttpServerException- if an error occurs
-
start
void start()Starts the server. If the application is running in a browser via JPro server, then this method does nothing. -
stop
void stop()Stops the server. If the application is running in a browser via JPro server, then this method does nothing. -
close
default void close()- Specified by:
closein interfaceAutoCloseable
-
getServerHost
String getServerHost()Return the server host.- Returns:
- the server host
-
getServerPort
int getServerPort()Return the server port.- Returns:
- the server port
-
getQueryParams
-
getParameters
Return the parameters of the request.- Returns:
- the parameters
-
decodeParams
Decodes parameters in percent-encoded URI-format and adds them to given Map.- Parameters:
queryParams- the parameters
-
getFullRequestedURL
String getFullRequestedURL()Return the full URL (with query string) the client used to request the server.- Returns:
- the URL
-
getRequestedURL
Return the full URL (without the query string) the client used to request the server.- Returns:
- the URL
-
openURL
Opens the given URL string in the browser.- Parameters:
url- the URL string to open
-