Announcement Announcement Module
Collapse
No announcement yet.
Scoped beans - checking if current thread is backed by a request Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Scoped beans - checking if current thread is backed by a request

    Hi folks - I've got a question:

    We use scoped beans (request and session) for holding some userdata.
    This is accessed by a logger to output more information when the current thread is backed by a user-request (e.g. http-request) thread.

    However - we want to use this logger both when backed by a http request thread and not.
    You'll get the infamous error message:

    No thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request
    outside of the originally receiving thread? If you are actually operating within a web request and still receive this
    message, your code is probably running outside of DispatcherServlet/DispatcherPortlet: In this case,
    use RequestContextListener or RequestContextFilter to expose the current request.


    if outside a thread.

    Are there any methods we can use to be able to know if it's request-backed?
    Maybe http://static.springframework.org/sp...RequestActive() ?
Working...
X