Package org.apache.solr.servlet
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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ServletUtils.ClosedServletInputStream
static class
ServletUtils.ClosedServletOutputStream
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description protected static io.opentracing.Span
buildSpan(io.opentracing.Tracer tracer, javax.servlet.http.HttpServletRequest request)
static javax.servlet.http.HttpServletRequest
closeShield(javax.servlet.http.HttpServletRequest request, boolean retry)
Wrap the request's input stream with a close shield.static javax.servlet.http.HttpServletResponse
closeShield(javax.servlet.http.HttpServletResponse response, boolean retry)
Wrap the response's output stream with a close shield.static String
getPathAfterContext(javax.servlet.http.HttpServletRequest request)
Use this to get the full path after context path "/solr", which is a combination of servletPath and pathInfo.
-
-
-
Method Detail
-
getPathAfterContext
public static String getPathAfterContext(javax.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 javax.servlet.http.HttpServletRequest closeShield(javax.servlet.http.HttpServletRequest request, boolean retry)
Wrap the request's input stream with a close shield. If this is a retry, we will assume that the stream has already been wrapped and do nothing.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.retry
- If this is an original request or a retry.- Returns:
- A request object with an
InputStream
that will ignore calls to close.
-
closeShield
public static javax.servlet.http.HttpServletResponse closeShield(javax.servlet.http.HttpServletResponse response, boolean retry)
Wrap the response's output stream with a close shield. If this is a retry, we will assume that the stream has already been wrapped and do nothing.Only the container should ever actually close the servlet request stream.
- Parameters:
response
- The response to wrap.retry
- If this response corresponds to an original request or a retry.- Returns:
- A response object with an
OutputStream
that will ignore calls to close.
-
buildSpan
protected static io.opentracing.Span buildSpan(io.opentracing.Tracer tracer, javax.servlet.http.HttpServletRequest request)
-
-