Class ServletUtils

java.lang.Object
org.apache.solr.servlet.ServletUtils

public abstract class ServletUtils extends Object
Various Util methods for interaction on servlet level, i.e. HttpServletRequest
  • Method Details

    • getPathAfterContext

      public static String getPathAfterContext(jakarta.servlet.http.HttpServletRequest request)
      Use this to get the full path after context path "/solr", which is a combination of servletPath and pathInfo.
      Parameters:
      request - the HttpServletRequest object
      Returns:
      String with path starting with a "/", or empty string if no path
    • closeShield

      public static jakarta.servlet.http.HttpServletRequest closeShield(jakarta.servlet.http.HttpServletRequest request)
      Wrap the request's input stream with a close shield.

      Only the container should ever actually close the servlet output stream. This method possibly should be turned into a servlet filter

      Parameters:
      request - The request to wrap.
      Returns:
      A request object with an InputStream that will ignore calls to close.
    • closeShield

      public static jakarta.servlet.http.HttpServletResponse closeShield(jakarta.servlet.http.HttpServletResponse response)
      Wrap the response's output stream with a close shield.

      Only the container should ever actually close the servlet request stream.

      Parameters:
      response - The response to wrap.
      Returns:
      A response object with an OutputStream that will ignore calls to close.