Class PsaRstApiSvcBas

java.lang.Object
de.pisa.psa.rst.svc.PsaRstApiSvcBas
Direct Known Subclasses:
IplWsvPsaRstApiSvc, IplWsvPsaRstApiTestSvc

public class PsaRstApiSvcBas extends Object
REST API: service base class
Since:
23.05.2023
Author:
weiland
  • Field Details

    • Request

      @Context protected org.glassfish.jersey.server.ContainerRequest Request
      container request context
    • User

      protected String User
      the session user
    • IAM_Key

      protected String IAM_Key
      key for the IAM properties
    • IAM_Service

      protected String IAM_Service
      service URL for the IAM token
    • IAM_User_Info

      protected de.pisa.psa.com.dxhub.iam.UserInfo IAM_User_Info
      IAM user information for the access token
  • Constructor Details

    • PsaRstApiSvcBas

      public PsaRstApiSvcBas()
      Constructor
  • Method Details

    • getData

      public final PsaRstApiEvtHdlDat getData()
      get the request data
      Returns:
      data
    • setConfig

      public final void setConfig(de.pisa.psa.ifc.PsaDtoDat config)
      set the configuration
      Parameters:
      config - configuration object
    • setEvent

      public final void setEvent(de.pisa.psa.ifc.PsaDtoDat event)
      set the event
      Parameters:
      event - event object
    • getRequestHeader

      protected String getRequestHeader(String key)
      get a request header value
      Parameters:
      key - key of the header
      Returns:
      value
    • getRequestHeaders

      protected javax.ws.rs.core.MultivaluedMap<String,String> getRequestHeaders()
      get all request header
      Returns:
      headers
    • getRequestCookie

      protected Optional<javax.ws.rs.core.Cookie> getRequestCookie(String name)
      get a cookie from the request
      Parameters:
      name - name of the cookie
      Returns:
      cookie
    • getRequestPath

      protected String getRequestPath()
      get the request path
      Returns:
      path
    • getRequestMethod

      protected String getRequestMethod()
      get the request method
      Returns:
      method
    • getRequestQuery

      protected String getRequestQuery()
      get the request query string
      Returns:
      query
    • getRequestLanguages

      protected List<String> getRequestLanguages()
      get the acceptable languages for this request
      Returns:
      list of locale (e.g. de_DE, en_US)
    • getAuthorizationHeader

      protected String[] getAuthorizationHeader()
      get the value of the Authorization header
      Returns:
      prefix and token (Strings are never null)
    • newSsn

      protected de.pisa.psc.srv.glb.PscSsn newSsn() throws Exception
      get a new session
      Returns:
      session
      Throws:
      Exception
    • handleRequest

      protected javax.ws.rs.core.Response handleRequest(String gid, String body, String user, String language) throws Exception
      handle an incoming request
      Parameters:
      gid - PSC_GID of the requested record
      body - body of the request
      user - the session user for the event
      language - language of the data to return
      Returns:
      the generated response
      Throws:
      Exception
    • initialize

      protected void initialize(de.pisa.psc.srv.glb.PscSsn ssn) throws Exception
      initialize the request
      Parameters:
      ssn - session
      Throws:
      Exception
    • loadConfiguration

      protected de.pisa.psa.ifc.PsaDtoDat loadConfiguration(de.pisa.psc.srv.glb.PscSsn ssn, String method, List<String> path_tokens) throws Exception
      load the configuration
      Parameters:
      ssn - session
      method - request method
      path_tokens - request path tokens
      Returns:
      configuration dto
      Throws:
      Exception
    • validateKey

      protected void validateKey(de.pisa.psc.srv.glb.PscSsn ssn) throws Exception
      validate the authorization key
      Parameters:
      ssn - session
      Throws:
      Exception
    • validateIAM

      protected void validateIAM(de.pisa.psc.srv.glb.PscSsn ssn) throws Exception
      validate the IAM token
      Parameters:
      ssn - session
      Throws:
      Exception
    • getIAMUserInfo

      protected de.pisa.psa.com.dxhub.iam.UserInfo getIAMUserInfo(de.pisa.psc.srv.glb.PscSsn ssn, String account_id, String token) throws Exception
      get the IAM user information
      Parameters:
      ssn - session
      account_id - IAM account ID
      token - IAM token
      Returns:
      information
      Throws:
      Exception - if the token is invalid
    • getIAMUserInfo

      protected final de.pisa.psa.com.dxhub.iam.UserInfo getIAMUserInfo()
      get the current IAM user information
      Returns:
      information
    • createEvent

      protected void createEvent(de.pisa.psc.srv.glb.PscSsn ssn, String gid, String body, String user, String language, boolean store) throws Exception
      create an event record
      Parameters:
      ssn - session
      gid - PSC_GID of the requested record
      body - body of the request
      user - the session user for the event
      language - language of the data to return
      store - store the event record in the database?
      Throws:
      Exception
    • getLanguageFromRequest

      protected String getLanguageFromRequest(de.pisa.psc.srv.glb.PscSsn ssn) throws Exception
      get the language identifier from the requests accepted languages
      Parameters:
      ssn - session
      Returns:
      identifier or an empty string if the locale is unknown
      Throws:
      Exception
    • isSynchronous

      protected boolean isSynchronous() throws Exception
      check if the request should be handled synchronously
      Returns:
      true for a synchronous handling
      Throws:
      Exception
    • processEvent

      public javax.ws.rs.core.Response processEvent() throws Exception
      start processing the current event
      Returns:
      the generated response
      Throws:
      Exception