Announcement Announcement Module
Collapse
No announcement yet.
filter BlazeDs Requests Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • filter BlazeDs Requests

    Hi,

    I want to log all request using filter. my application has fiex and mvc clients. So instead of having interceptors for each dispatcher, I decided to go with filter. I also have spring security.

    But My filter is not able to handle the flex/ remote object calls.

    filter declaration in web.xml looks like

    Code:
    <filter>
    		<filter-name>springSecurityFilterChain</filter-name>
    		<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
    	</filter>
    	<filter>
    		<filter-name>LoggingFilterChain</filter-name>
    		<filter-class>filter.LoggingFilter</filter-class>
    	</filter>
    	
    	<filter-mapping>
    		<filter-name>LoggingFilterChain</filter-name>
    		<url-pattern>/*</url-pattern>
    	</filter-mapping>
    	
    
    	<filter-mapping>
    		<filter-name>springSecurityFilterChain</filter-name>
    		<url-pattern>/*</url-pattern>
    		<dispatcher>REQUEST</dispatcher>
    		<dispatcher>FORWARD</dispatcher>
    	</filter-mapping>
    and my filter class is

    Code:
    public class LoggingFilter implements Filter {
    
    	public void destroy() {
    		// TODO Auto-generated method stub
    
    	}
    
    	public void doFilter(ServletRequest request, ServletResponse response,
    			FilterChain chain) throws IOException, ServletException {
    		long start = System.currentTimeMillis();
    
    		System.out.println(request.getRemoteAddr() + " for "
    				+ request.getServerName());
    		// Get all request-scoped attributes
    		java.util.Enumeration<String> e = request.getAttributeNames();
    		for (; e.hasMoreElements();) {
    			// Get the name of the attribute
    			String name = (String) e.nextElement();
    
    			// Get the value of the attribute
    			Object value = request.getAttribute(name);
    			System.out.println("ATTRI :"+name + " : " + value);
    		}
    		
    
    	
    		    e = request.getParameterNames();
    		    for (; e.hasMoreElements(); ) {
    		        // Get the name of the attribute
    		        String name = (String)e.nextElement();
    
    		        // Get the value of the attribute
    		        Object value = request.getParameter(name);
    
    				System.out.println("Param :"+name + " : " + value);
    	
    		}
    
    		chain.doFilter(request, response);
    		System.out.println((System.currentTimeMillis() - start));
    
    	}
    
    	public void init(FilterConfig arg0) throws ServletException {
    
    	}
    
    }
    my dispatcher servlets are
    Code:
    <!--Flex Client  Mapping  -->
    	<servlet>
    		<servlet-name>flex</servlet-name>
    		<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    		<load-on-startup>1</load-on-startup>
    	</servlet>
    
    	<servlet-mapping>
    		<servlet-name>flex</servlet-name>
    		<url-pattern>/messagebroker/*</url-pattern>
    	</servlet-mapping>
    
    	<!--End of Flex Client  Mapping  -->
    
    
    
    
    	<!--Spring MVC Client  Mapping  -->
    	<servlet>
    		<servlet-name>spring-mvc</servlet-name>
    		<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    		<load-on-startup>1</load-on-startup>
    	</servlet>
    	<servlet-mapping>
    		<servlet-name>spring-mvc</servlet-name>
    		<url-pattern>/spring/*</url-pattern>
    	</servlet-mapping> 	
    	<!--End of Spring MVC Client  Mapping  -->

    Please guide me how to log all request from flex client.

  • #2
    any hints atleast...

    Comment

    Working...
    X