Interface HttpServer

All Superinterfaces:
AutoCloseable
All Known Implementing Classes:
HttpServerImpl, JProServerImpl

public interface HttpServer extends AutoCloseable
Http server interface.
  • Method Details

    • create

      static HttpServer create(@Nullable @Nullable javafx.stage.Stage stage) throws HttpServerException
      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:
      close in interface AutoCloseable
    • getServerHost

      String getServerHost()
      Return the server host.
      Returns:
      the server host
    • getServerPort

      int getServerPort()
      Return the server port.
      Returns:
      the server port
    • getQueryParams

      default Map<String,String> getQueryParams()
    • getParameters

      default Map<String,List<String>> getParameters()
      Return the parameters of the request.
      Returns:
      the parameters
    • decodeParams

      default Map<String,List<String>> decodeParams(String queryParams)
      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

      default String getRequestedURL()
      Return the full URL (without the query string) the client used to request the server.
      Returns:
      the URL
    • openURL

      CompletableFuture<String> openURL(@NotNull @NotNull String url)
      Opens the given URL string in the browser.
      Parameters:
      url - the URL string to open