KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
In my filter bean class, I added some beans dependency (with @Autowired annotation). But in the method doFilter() , all my dependency beans have null ... public class FacebookOAuth implements Filter { @Autowired private BusinessLogger logger; @Autowired private IUserSessionInfo userSessionInfo; @Autowired private FacebookOAuthHelper oAuthHelper; public void init(FilterConfig fc) throws ServletException { // Nothing to do } public void doFilter(ServletRequest sr, ServletResponse sr1, FilterChain fc) throws IOException, ServletException { // HttpServletRequest req = (HttpServletRequest)sr; HttpServletResponse res = (HttpServletResponse) sr1; String code = sr.getParameter("code"); if (StringUtil.isNotBlankStr(code)) { String authURL = this.oAuthHelper.getAuthURL(code); this.oAuthHelper is equal at null (and other dependancy beans to) ... Could you help me ? In fact I don't use MVC notion on server side (Spring). For my side client I use Flex technology and BlazeDS servlet ton communicate with my server. So, that is the reason, I use the Filter bean notion. So, how can I handle my session bean notion in my Filter bean ? Skaffman, I implemented your idea, so I update my application.xml with : <bean id="FacebookOAuthHandler" class="com.xx.FacebookOAuthHandler" /> <bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping"> <property name="mappings"> <props> <prop key="/fbauth">FacebookOAuthHandler</prop> </props> </property> </bean> and my FacebookOAuthHandler class : public class FacebookOAuthHandler extends AbstractController { @Autowired private BusinessLogger logger; @Autowired private IUserSessionInfo userSessionInfo; @A
Tags (comma-separated)
Save Edits
Cancel