Class ResourceRetriever

java.lang.Object
com.nimbusds.common.servlet.ResourceRetriever

public class ResourceRetriever extends Object
Servlet resource retriever. Can be used to retrieve the content of a file as java.io.InputStream, String or java.util.Properties.
  • Method Summary

    Modifier and Type
    Method
    Description
    static Properties
    getProperties(jakarta.servlet.ServletConfig servletConfig, String paramName, org.apache.logging.log4j.Logger logger)
    Gets the java.util.Properties in the specified servlet web.xml init parameter location.
    static Properties
    getProperties(jakarta.servlet.ServletContext servletCtx, String paramName, org.apache.logging.log4j.Logger logger)
    Gets the java.util.Properties in the specified servlet context web.xml init parameter location.
    getStream(jakarta.servlet.ServletConfig servletConfig, String paramName, org.apache.logging.log4j.Logger logger)
    Gets the resource in the specified servlet web.xml init parameter location.
    getStream(jakarta.servlet.ServletContext servletCtx, String paramName, org.apache.logging.log4j.Logger logger)
    Gets the resource in the specified servlet context web.xml init parameter location.
    static String
    getString(jakarta.servlet.ServletContext servletCtx, String paramName, org.apache.logging.log4j.Logger logger)
    Gets the resource in the specified servlet context web.xml init parameter location.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • getStream

      public static InputStream getStream(jakarta.servlet.ServletContext servletCtx, String paramName, org.apache.logging.log4j.Logger logger) throws Exception
      Gets the resource in the specified servlet context web.xml init parameter location.
      Parameters:
      servletCtx - The servlet context. Must not be null.
      paramName - The name of the servlet context init parameter specifying the resource file (relative to the web app root). For example, /WEB-INF/authService.properties. Must not be null.
      logger - To log exceptions at ERROR level, null if none.
      Returns:
      The resource as an input stream.
      Throws:
      Exception - On a missing servlet context parameter or a missing resource.
    • getStream

      public static InputStream getStream(jakarta.servlet.ServletConfig servletConfig, String paramName, org.apache.logging.log4j.Logger logger) throws Exception
      Gets the resource in the specified servlet web.xml init parameter location.
      Parameters:
      servletConfig - The servlet configuration. Must not be null.
      paramName - The name of the servlet init parameter specifying the resource file (relative to the web app root). For example, /WEB-INF/authService.properties. Must not be null.
      logger - To log exceptions at ERROR level, null if none.
      Returns:
      The resource as an input stream.
      Throws:
      Exception - On a missing servlet init parameter or a missing resource.
    • getString

      public static String getString(jakarta.servlet.ServletContext servletCtx, String paramName, org.apache.logging.log4j.Logger logger) throws Exception
      Gets the resource in the specified servlet context web.xml init parameter location.
      Parameters:
      servletCtx - The servlet context. Must not be null.
      paramName - The name of the servlet context init parameter specifying the resource file (relative to the web app root). For example, /WEB-INF/authService.properties. Must not be null.
      logger - To log exceptions at ERROR level, null if none.
      Returns:
      The resource as a string.
      Throws:
      Exception - On a missing servlet context parameter or a missing resource.
    • getProperties

      public static Properties getProperties(jakarta.servlet.ServletContext servletCtx, String paramName, org.apache.logging.log4j.Logger logger) throws Exception
      Gets the java.util.Properties in the specified servlet context web.xml init parameter location.
      Parameters:
      servletCtx - The servlet context. Must not be null.
      paramName - The name of the servlet context init parameter specifying the properties file (relative to the web app root). For example, /WEB-INF/authService.properties. Must not be null.
      logger - To log exceptions at ERROR level, null if none.
      Returns:
      The properties.
      Throws:
      Exception - On a missing servlet context parameter, missing or bad properties file.
    • getProperties

      public static Properties getProperties(jakarta.servlet.ServletConfig servletConfig, String paramName, org.apache.logging.log4j.Logger logger) throws Exception
      Gets the java.util.Properties in the specified servlet web.xml init parameter location.
      Parameters:
      servletConfig - The servlet configuration. Must not be null.
      paramName - The name of the servlet init parameter specifying the properties file (relative to the web app root). For example, /WEB-INF/authService.properties. Must not be null.
      logger - To log exceptions at ERROR level, null if none.
      Returns:
      The properties.
      Throws:
      Exception - On a missing servlet context parameter, missing or bad properties file.