protected boolean trigger ( ServletRequest pRequest ) { boolean trigger = false ; if ( pRequest instanceof HttpServletRequest ) { HttpServletRequest request = ( HttpServletRequest ) pRequest ; String accept = getAcceptedFormats ( request ) ; String originalFormat = getServletContext ( ) . getMimeType ( request . getRequestURI ( ) ) ; //System.out.println("Accept: " + accept); //System.out.println("Original format: " + originalFormat); // Only override original format if it is not accpeted by the client // Note: Only explicit matches are okay, */* or image/* is not. if ( ! StringUtil . contains ( accept , originalFormat ) ) { trigger = true ; } } // Call super, to allow content negotiation even though format is supported return trigger || super . trigger ( pRequest ) ; }
Makes sure the filter triggers for unknown file formats .