Announcement Announcement Module
Collapse
No announcement yet.
Newbish I know - but in ConnectInterceptor - get HttpServletRequest? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Newbish I know - but in ConnectInterceptor - get HttpServletRequest?

    the postConnect method of ConnectInterceptor has the signature:

    postConnect(Connection connection, WebRequest webRequest)

    In that method implementation of my own ConnectInterceptor I need to get a handle to the HttpServletRequest since another utility class that I have to call requires it as a param.

    Is this an ok way to get the HttpServletRequest or is there a more efficient/easier way?

    Code:
    public void postConnect(Connection connection, WebRequest webRequest) {
        ServletRequestAttributes requestAttributes = (ServletRequestAttributes) RequestContextHolder.currentRequestAttributes(); 
        HttpServletRequest request = requestAttributes.getRequest());
        ...

  • #2
    You should be able to cast WebRequest to NativeWebRequest, then call getNativeRequest().

    Comment

    Working...
    X