Results 1 to 2 of 2

Thread: Newbish I know - but in ConnectInterceptor - get HttpServletRequest?

  1. #1
    Join Date
    Sep 2007
    Posts
    138

    Default 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. #2
    Join Date
    Aug 2004
    Posts
    1,099

    Default

    You should be able to cast WebRequest to NativeWebRequest, then call getNativeRequest().
    Craig Walls
    Spring Social Project Lead

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •