Class PsaRstApiEvtHdlOut

java.lang.Object
de.pisa.psa.rst.hdl.PsaRstApiEvtHdl
de.pisa.psa.rst.hdl.out.PsaRstApiEvtHdlOut
All Implemented Interfaces:
AutoCloseable
Direct Known Subclasses:
PsaRstApiEvtHdlOutDelete, PsaRstApiEvtHdlOutGet, PsaRstApiEvtHdlOutPatch, PsaRstApiEvtHdlOutPost, PsaRstApiEvtHdlOutPut

public abstract class PsaRstApiEvtHdlOut extends PsaRstApiEvtHdl
REST API: outgoing event handler
Since:
07.08.2023
Author:
weiland
  • Constructor Details

    • PsaRstApiEvtHdlOut

      public PsaRstApiEvtHdlOut(PsaRstApiEvtHdlDat data)
      Constructor
      Parameters:
      data - event data
  • Method Details

    • setBufferResponseEntity

      public void setBufferResponseEntity(boolean buffer)
      Control whether the received response entity should be buffered or not
      Parameters:
      buffer - if true it will be buffered (default=false)
    • setRequest

      public void setRequest(de.pisa.psc.srv.rst.PscRstCli client, Object entity)
      set the request data
      Parameters:
      client - REST client
      entity - payload entity
    • setRequestPath

      public void setRequestPath(String path)
      set the request path
      Parameters:
      path - path
    • getRequestPath

      public String getRequestPath()
      get the request path
      Returns:
      path
    • setRequestBody

      public void setRequestBody(Object body)
      set the request body
      Parameters:
      body - body
    • getRequestBody

      public String getRequestBody()
      get the request body
      Returns:
      body
    • setRequestHeader

      public void setRequestHeader(String header)
      set the request header
      Parameters:
      header - header
    • getRequestHeader

      public String getRequestHeader()
      get the request header
      Returns:
      header
    • setIAMKey

      public void setIAMKey(String key)
      get the key for the IAM properties
      Parameters:
      key - key
    • getIAMKey

      public String getIAMKey()
      set the key for the IAM properties
      Returns:
      key
    • sendRequest

      public javax.ws.rs.core.Response sendRequest(javax.ws.rs.core.Response record) throws Exception
      send a REST request
      Parameters:
      record - record data to send
      Returns:
      response of the called end point
      Throws:
      Exception
    • newRestClient

      protected de.pisa.psc.srv.rst.PscRstCli newRestClient(String url) throws URISyntaxException
      create a new REST client
      Parameters:
      url - target URL
      Returns:
      client
      Throws:
      URISyntaxException
    • sendRequest

      public javax.ws.rs.core.Response sendRequest(Object entity, javax.ws.rs.core.MediaType type) throws Exception
      send a REST request
      Parameters:
      entity - payload entity
      type - media type of the entity
      Returns:
      response of the called end point
      Throws:
      Exception
    • setAuthorization

      protected void setAuthorization(de.pisa.psc.srv.rst.PscRstCli client) throws Exception
      set the authorization for the REST client
      Parameters:
      client - REST client
      Throws:
      Exception
    • getEntity

      protected javax.ws.rs.client.Entity<?> getEntity(Object entity, javax.ws.rs.core.MediaType type)
      get an entity
      Parameters:
      entity - entity object
      type - type of the entity
      Returns:
      entity
    • sendPostRequest

      protected javax.ws.rs.core.Response sendPostRequest(de.pisa.psc.srv.rst.PscRstCli client, Object entity, javax.ws.rs.core.MediaType type) throws Exception
      send a POST request
      Parameters:
      client - REST client
      entity - payload entity
      type - media type of the entity
      Returns:
      response of the called end point
      Throws:
      Exception
    • sendPutRequest

      protected javax.ws.rs.core.Response sendPutRequest(de.pisa.psc.srv.rst.PscRstCli client, Object entity, javax.ws.rs.core.MediaType type) throws Exception
      send a PUT request
      Parameters:
      client - REST client
      entity - payload entity
      type - media type of the entity
      Returns:
      response of the called end point
      Throws:
      Exception
    • sendPatchRequest

      protected javax.ws.rs.core.Response sendPatchRequest(de.pisa.psc.srv.rst.PscRstCli client, Object entity, javax.ws.rs.core.MediaType type) throws Exception
      send a PATCH request
      Parameters:
      client - REST client
      entity - payload entity
      type - media type of the entity
      Returns:
      response of the called end point
      Throws:
      Exception
    • sendGetRequest

      protected javax.ws.rs.core.Response sendGetRequest(de.pisa.psc.srv.rst.PscRstCli client, Object entity, javax.ws.rs.core.MediaType type) throws Exception
      send a GET request
      Parameters:
      client - REST client
      entity - payload entity
      type - media type of the entity
      Returns:
      response of the called end point
      Throws:
      Exception
    • sendDeleteRequest

      protected javax.ws.rs.core.Response sendDeleteRequest(de.pisa.psc.srv.rst.PscRstCli client, Object entity, javax.ws.rs.core.MediaType type) throws Exception
      send a DELETE request
      Parameters:
      client - REST client
      entity - payload entity
      type - media type of the entity
      Returns:
      response of the called end point
      Throws:
      Exception
    • bufferEntity

      protected void bufferEntity(javax.ws.rs.core.Response response)
      Buffer the response entity.
      In case of an exception, the exception is logged.
      Parameters:
      response - response