Class AbstractHTTPServerProtocol<T extends AbstractHTTPServerProtocol<T,U,V>,U extends AbstractHTTPServerAgent<U,T,V>,V extends org.openremote.model.asset.agent.AgentLink<?>>

java.lang.Object
org.openremote.agent.protocol.AbstractProtocol<U,V>
org.openremote.agent.protocol.http.AbstractHTTPServerProtocol<T,U,V>
All Implemented Interfaces:
org.openremote.model.asset.agent.Protocol<U>

public abstract class AbstractHTTPServerProtocol<T extends AbstractHTTPServerProtocol<T,U,V>,U extends AbstractHTTPServerAgent<U,T,V>,V extends org.openremote.model.asset.agent.AgentLink<?>> extends AbstractProtocol<U,V>
This is an abstract protocol for creating JAX-RS deployments; a concrete implementation should be created for each required JAX-RS deployment. Multiple instances of the same deployment can be created by creating multiple protocol instances for the desired concrete implementation.

The deployment is deployed by creating an instance of a concrete AbstractHTTPServerAgent implementation with the following Attributes:

The path used for the deployment is determined by getDeploymentPath(). The realm that the Agent belongs to will be used implicitly for all incoming requests to any deployments that this protocol creates and therefore only users of that realm will be able to make calls to the deployment when AbstractHTTPServerAgent.ROLE_BASED_SECURITY is true.
  • Field Details

    • DEFAULT_DEPLOYMENT_PATH_PREFIX

      public static final String DEFAULT_DEPLOYMENT_PATH_PREFIX
      This is the default path prefix for all deployments. Should not be overridden unless you know what you are doing and there is a good reason to override.
      See Also:
    • PATH_REGEX

      public static final Pattern PATH_REGEX
      The regex used to validate the deployment path.
    • DEFAULT_ALLOWED_METHODS

      public static final org.openremote.model.http.HTTPMethod[] DEFAULT_ALLOWED_METHODS
    • deployment

    • defaultResteasyExceptionMapper

      protected static org.openremote.container.web.WebServiceExceptions.DefaultResteasyExceptionMapper defaultResteasyExceptionMapper
    • forbiddenResteasyExceptionMapper

      protected static org.openremote.container.web.WebServiceExceptions.ForbiddenResteasyExceptionMapper forbiddenResteasyExceptionMapper
    • jacksonConfig

      protected static org.openremote.container.json.JacksonConfig jacksonConfig
    • alreadyGzippedWriterInterceptor

      protected static org.openremote.container.web.AlreadyGzippedWriterInterceptor alreadyGzippedWriterInterceptor
    • clientErrorExceptionHandler

      protected static org.openremote.container.web.ClientErrorExceptionHandler clientErrorExceptionHandler
    • undertowExceptionHandler

      protected static org.openremote.container.web.WebServiceExceptions.ServletUndertowExceptionHandler undertowExceptionHandler
    • container

      protected org.openremote.model.Container container
    • devMode

      protected boolean devMode
    • identityService

      protected org.openremote.container.security.IdentityService identityService
    • webService

      protected org.openremote.container.web.WebService webService
  • Constructor Details

    • AbstractHTTPServerProtocol

      public AbstractHTTPServerProtocol(U agent)
  • Method Details

    • doStart

      public void doStart(org.openremote.model.Container container) throws Exception
      Description copied from class: AbstractProtocol
      Start this protocol instance
      Specified by:
      doStart in class AbstractProtocol<U extends AbstractHTTPServerAgent<U,T,V>,V extends org.openremote.model.asset.agent.AgentLink<?>>
      Throws:
      Exception
    • doStop

      protected void doStop(org.openremote.model.Container container) throws Exception
      Description copied from class: AbstractProtocol
      Stop this protocol instance
      Specified by:
      doStop in class AbstractProtocol<U extends AbstractHTTPServerAgent<U,T,V>,V extends org.openremote.model.asset.agent.AgentLink<?>>
      Throws:
      Exception
    • createApplication

      protected jakarta.ws.rs.core.Application createApplication()
    • createDeployment

      protected org.jboss.resteasy.spi.ResteasyDeployment createDeployment(jakarta.ws.rs.core.Application application)
    • createDeploymentInfo

      protected io.undertow.servlet.api.DeploymentInfo createDeploymentInfo(org.jboss.resteasy.spi.ResteasyDeployment resteasyDeployment)
    • getApiSingletons

      protected abstract Set<Object> getApiSingletons()
      Should return instances of all JAX-RS interface implementations that make up this protocol's deployment.
    • getDeploymentPathPrefix

      protected String getDeploymentPathPrefix()
      Get the path prefix to use for this protocol instance; should use "/rest" unless there is a good reason to override this.
    • getDeploymentPath

      protected String getDeploymentPath() throws IllegalArgumentException
      Deployment path will always be prefixed with getDeploymentPathPrefix(); default implementation combines the prefix with the value of AbstractHTTPServerAgent.DEPLOYMENT_PATH, for example:

      Full path to deployment = "/rest/complaints"

      If the AbstractHTTPServerAgent.DEPLOYMENT_PATH is missing or not a String or the generated path does not match the PATH_REGEX regex then an IllegalArgumentException will is thrown.

      Throws:
      IllegalArgumentException
    • getStandardProviders

      protected List<Object> getStandardProviders()
      Get standard JAX-RS providers that are used in the deployment.
    • configureDeploymentInfo

      protected void configureDeploymentInfo(io.undertow.servlet.api.DeploymentInfo deploymentInfo)
    • getDeploymentName

      protected String getDeploymentName()
      Get a unique deployment name for this instance.
    • deploy

      protected void deploy(io.undertow.servlet.api.DeploymentInfo deploymentInfo)
    • undeploy

      protected void undeploy()
    • getProtocolInstanceUri

      public String getProtocolInstanceUri()
      Description copied from interface: org.openremote.model.asset.agent.Protocol
      Get a URI that describes this specific protocol instance