public class NebaRequestContextFilter
extends org.springframework.web.filter.RequestContextFilter
RequestContextFilter
wrapping
sling background requests
using the BackgroundServletRequestWrapper
to prevent
unsupported operation exceptions
when
AbstractRequestAttributes.requestCompleted()
attempts to access the
session
, which is unsupported by
background requests
.RequestContextFilter
Constructor and Description |
---|
NebaRequestContextFilter() |
Modifier and Type | Method and Description |
---|---|
protected void |
doFilterInternal(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
javax.servlet.FilterChain filterChain) |
void |
setThreadContextInheritable(boolean threadContextInheritable)
Set whether to expose the LocaleContext and RequestAttributes as inheritable
for child threads (using an
InheritableThreadLocal ). |
shouldNotFilterAsyncDispatch, shouldNotFilterErrorDispatch
doFilter, doFilterNestedErrorDispatch, getAlreadyFilteredAttributeName, isAsyncDispatch, isAsyncStarted, shouldNotFilter
public void setThreadContextInheritable(boolean threadContextInheritable)
InheritableThreadLocal
).
Default is "false", to avoid side effects on spawned background threads. Switch this to "true" to enable inheritance for custom child threads which are spawned during request processing and only used for this request (that is, ending after their initial task, without reuse of the thread).
WARNING: Do not use inheritance for child threads if you are
accessing a thread pool which is configured to potentially add new threads
on demand (e.g. a JDK ThreadPoolExecutor
),
since this will expose the inherited context to such a pooled thread.
setThreadContextInheritable
in class org.springframework.web.filter.RequestContextFilter
protected void doFilterInternal(javax.servlet.http.HttpServletRequest request, @Nonnull javax.servlet.http.HttpServletResponse response, javax.servlet.FilterChain filterChain) throws javax.servlet.ServletException, IOException
doFilterInternal
in class org.springframework.web.filter.RequestContextFilter
javax.servlet.ServletException
IOException
Copyright © 2024. All rights reserved.