Accessing request state inside a scala function

40 views
Skip to first unread message

Trevor Hartman

unread,
Mar 6, 2012, 6:22:39 PM3/6/12
to sca...@googlegroups.com
Following the docs, I'm trying to get the `request` object inside a scala helper, but I'm getting the exception: "This threads RenderContext is not a ServletRenderContext as it is: null"

Using Spring 3.1 and Scalate 1.5.3. Is there something I need to manually wire up to make this work right?

Tristan Burch

unread,
Mar 6, 2012, 6:36:16 PM3/6/12
to sca...@googlegroups.com
You should be able to get a HttpServletRequest from Spring's RequestContextHolder

ServletRequestAttributes requestAttrs = (ServletRequestAttributes) RequestContextHolder.currentRequestAttributes();
HttpServletRequest request = requestAttrs.getRequest();

-Tristan

Joel Hegg

unread,
Jul 18, 2012, 5:05:45 PM7/18/12
to sca...@googlegroups.com

James Strachan

unread,
Jul 19, 2012, 4:11:28 AM7/19/12
to sca...@googlegroups.com
Applied with thanks!
--
James
-------
FuseSource
Email: ja...@fusesource.com
Web: http://fusesource.com
Twitter: jstrachan, fusenews
Blog: http://macstrac.blogspot.com/

FuseSource: integration everywhere
Reply all
Reply to author
Forward
0 new messages