Announcement Announcement Module
Collapse
No announcement yet.
Spring Security and ExtJS Page Title Module
Move Remove Collapse
This topic is closed
X
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    Hi cornflakes,
    I tried to use the same custom authentication filter but I had the following exception
    Code:
    Sep 5, 2008 12:58:17 PM org.apache.catalina.core.StandardWrapperValve invoke
    SEVERE: Servlet.service() for servlet default threw exception
    java.lang.IllegalStateException
    	at org.apache.catalina.connector.ResponseFacade.sendRedirect(ResponseFacade.java:435)
    	at javax.servlet.http.HttpServletResponseWrapper.sendRedirect(HttpServletResponseWrapper.java:126)
    	at com.opensymphony.module.sitemesh.filter.PageResponseWrapper.sendRedirect(PageResponseWrapper.java:185)
    	at javax.servlet.http.HttpServletResponseWrapper.sendRedirect(HttpServletResponseWrapper.java:126)
    	at org.springframework.security.context.HttpSessionContextIntegrationFilter$OnRedirectUpdateSessionResponseWrapper.sendRedirect(HttpSessionContextIntegrationFilter.java:507)
    	at org.springframework.security.util.RedirectUtils.sendRedirect(RedirectUtils.java:60)
    	at org.springframework.security.ui.AbstractProcessingFilter.sendRedirect(AbstractProcessingFilter.java:345)
    	at org.springframework.security.ui.AbstractProcessingFilter.successfulAuthentication(AbstractProcessingFilter.java:379)
    	at org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp(AbstractProcessingFilter.java:266)
    	at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
    	at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
    	at org.springframework.security.ui.logout.LogoutFilter.doFilterHttp(LogoutFilter.java:89)
    	at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
    	at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
    	at org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:235)
    	at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
    	at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
    	at org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:174)
    	at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:183)
    	at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:138)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    	at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:413)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    	at com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:118)
    	at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:52)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    	at org.apache.struts2.dispatcher.ActionContextCleanUp.doFilter(ActionContextCleanUp.java:99)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
    	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
    	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
    	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
    	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
    	at java.lang.Thread.run(Thread.java:619)
    when I looked up the meaning of the exception it turned out because:

    The illegalStateException while sendRedirect happens because some content has already been submitted to client, thus the http code (OK) was already send and it's too late to change headers
    My question is how can we return only the json object back to the browser and skip redirecting to target URL.

    Code:
    protected void onSuccessfulAuthentication( HttpServletRequest request, HttpServletResponse response,
                Authentication authResult ) throws IOException {
    
            HttpServletResponseWrapper responseWrapper = new HttpServletResponseWrapper( response );
            Writer out = responseWrapper.getWriter();
    
            // FIXME This is too JSON-y. Use an object.
            String targetUrl = determineTargetUrl( request );
            out.write( "{success:true, targetUrl : \'" + targetUrl + "\'}" );        
    out.close();
        }
    Thanks in advance
    Souad

    Comment


    • #17
      Spring Security and ExtJS

      hi,
      Really great article! I wish
      had something like this when I started using .

      www.staffingpower.com

      sentersoftech.

      Comment


      • #18
        Spring Security and ExtJS

        hi,
        I ended up removing the scriplet portions in the jsp and moved everything to javascript because we are using jawr. That is, I commented out the error message scriplet (I still have to show that).

        Comment


        • #19
          Spring Security and ExtJS

          hi,

          Really great article! I wish
          had something like this when I started using .

          http://sentersoftech.com/senter/happy.gif

          www.sentersoftech.com

          Comment

          Working...
          X