Shouldn't spring boot starter autoconfiguration populate HttpServletRequestHolder?

33 views
Skip to first unread message

Trygve Aasjord

unread,
Jul 19, 2017, 11:30:08 AM7/19/17
to togglz-dev
I am using the spring boot starter and added a custom strategy to check HTTP header parameter for activation (didn't immediately find one out-of-the-box. But I noticed that HttpServletRequestHolder does not contain any request object, so I rolled my own filter to populate it. But shouldn't autoconfiguration do this by default, like the vanilla TogglzFilter does? I have not tested but I assume the other default servlet based strategies maybe doesn't work without it either. 

Christian Kaltepoth

unread,
Jul 20, 2017, 1:45:33 PM7/20/17
to toggl...@googlegroups.com
I'm not so familiar with Boot, but doesn't Spring Boot also work without a Servlet container? In this case it may be problematic to initialize the holder. 

Christian 

Trygve Aasjord

unread,
Jul 22, 2017, 9:52:42 AM7/22/17
to togglz-dev
The togglz spring-boot-starter auto configuration would add filter/interceptor to initialize holder only if in a web environment. I actually found that it registers SpringSecurityUserProvider if spring-security is on the classpath, so I guess username strategy is taken care of, but I think that the ClientIp and ServerName strategies cannot work without it.

Christian Kaltepoth

unread,
Jul 24, 2017, 5:44:04 AM7/24/17
to toggl...@googlegroups.com
Could you perhaps file an issue for this?

Trygve Aasjord

unread,
Jul 25, 2017, 12:14:22 PM7/25/17
to togglz-dev
Yes, sure. I just wanted to check first whether this was intentional or if I have missed something. 

Christian Kaltepoth

unread,
Jul 26, 2017, 4:52:59 AM7/26/17
to toggl...@googlegroups.com
I don't think that it is intentional. But we can discuss this with Marcel in the issue you create. Maybe we are missing something. Marcel is the expert for the Spring Boot integration. :-)
Reply all
Reply to author
Forward
0 new messages