Interface Rest.RestServer

All Superinterfaces:
de.iip_ecosphere.platform.support.Server
Enclosing class:
Rest

public static interface Rest.RestServer extends de.iip_ecosphere.platform.support.Server
Represents a rest server.
Author:
Holger Eichelberger, SSE
  • Method Details

    • definePost

      void definePost(String path, Rest.Route route)
      Defines a post route.
      Parameters:
      path - the path
      route - the route
    • defineGet

      void defineGet(String path, Rest.Route route)
      Defines a get route.
      Parameters:
      path - the path
      route - the route
    • definePut

      void definePut(String path, Rest.Route route)
      Defines a put route.
      Parameters:
      path - the path
      route - the route
    • defineDelete

      void defineDelete(String path, Rest.Route route)
      Defines a delete route.
      Parameters:
      path - the path
      route - the route
    • defineBefore

      void defineBefore(Rest.Filter filter)
      Defines a filter on all paths.
      Parameters:
      filter - the filter
    • defineBefore

      void defineBefore(String path, Rest.Filter filter)
      Defines a filter on a given path.
      Parameters:
      path - the path
      filter - the filter
    • halt

      void halt(int status, String body)
      Halts processing a request.
      Parameters:
      status - the status
      body - the body
    • supportsPathVariables

      boolean supportsPathVariables()
      Returns whether path variables are supported.
      Returns:
      true for path variables, false else
    • toPathVariable

      String toPathVariable(String name)
      Turns a name to a path variable.
      Parameters:
      name - the name
      Returns:
      the path variable for name, may be name if no path variables are supported
      See Also:
    • secure

      void secure(String keystoreFile, String keystorePassword, String certAlias)
      Set the connection to be secure, using the specified keystore and truststore. This has to be called before any route mapping is done.
      Parameters:
      keystoreFile - The keystore file location as string
      keystorePassword - the password for the keystore
      certAlias - the default certificate Alias
    • addExceptionHandler

      void addExceptionHandler(Class<Exception> cls, Rest.ExceptionHandler handler)
      Adds an exception handler for a specified type.
      Parameters:
      cls - the exception type
      handler - the handler