@Test public void testCleanPath() { Assert.assertEquals( "", AuthenticationFilter.cleanPath( "" )); Assert.assertEquals( REST_CONTEXT, AuthenticationFilter.cleanPath( REST_CONTEXT )); Assert.assertEquals( "/", AuthenticationFilter.cleanPath( REST_CONTEXT + "/" )); Assert.assertEquals( REST_CONTEXT, AuthenticationFilter.cleanPath( REST_CONTEXT + REST_CONTEXT )); Assert.assertEquals( "/test", AuthenticationFilter.cleanPath( REST_CONTEXT + "/test" )); Assert.assertEquals( WEBSOCKET_CONTEXT, AuthenticationFilter.cleanPath( WEBSOCKET_CONTEXT )); Assert.assertEquals( "/", AuthenticationFilter.cleanPath( WEBSOCKET_CONTEXT + "/" )); Assert.assertEquals( "/ty", AuthenticationFilter.cleanPath( WEBSOCKET_CONTEXT + "/ty" )); Assert.assertEquals( WEBSOCKET_CONTEXT + "ty", AuthenticationFilter.cleanPath( WEBSOCKET_CONTEXT + "ty" )); Assert.assertEquals( "/test", AuthenticationFilter.cleanPath( REST_CONTEXT + "/test?p=toto/22" )); }
static String cleanPath( String path ) { return path .replaceFirst( "^" + ServletRegistrationComponent.REST_CONTEXT + "/", "/" ) .replaceFirst( "^" + ServletRegistrationComponent.WEBSOCKET_CONTEXT + "/", "/" ) .replaceFirst( "\\?.*", "" ); }
AuthenticationFilter implements Filter { static String cleanPath( String path ) { return path .replaceFirst( "^" + ServletRegistrationComponent.REST_CONTEXT + "/", "/" ) .replaceFirst( "^" + ServletRegistrationComponent.WEBSOCKET_CONTEXT + "/", "/" ) .replaceFirst( "\\?.*", "" ); } }
AuthenticationFilter implements Filter { static String cleanPath( String path ) { return path .replaceFirst( "^" + ServletRegistrationComponent.REST_CONTEXT + "/", "/" ) .replaceFirst( "^" + ServletRegistrationComponent.WEBSOCKET_CONTEXT + "/", "/" ) .replaceFirst( "\\?.*", "" ); } AuthenticationFilter( RestServicesMBean restServicesMBean ); }
AuthenticationFilter implements Filter { static String cleanPath( String path ) { return path .replaceFirst( "^" + ServletRegistrationComponent.REST_CONTEXT + "/", "/" ) .replaceFirst( "^" + ServletRegistrationComponent.WEBSOCKET_CONTEXT + "/", "/" ) .replaceFirst( "\\?.*", "" ); } AuthenticationFilter( RestServicesMBean restServicesMBean ); @Override void doFilter( ServletRequest req, ServletResponse resp, FilterChain chain ); @Override void destroy(); @Override void init( FilterConfig filterConfig ); void setAuthenticationEnabled( boolean authenticationEnabled ); void setAuthenticationManager( AuthenticationManager authenticationMngr ); void setSessionPeriod( long sessionPeriod ); void setEnableCors( boolean enableCors ); }
AuthenticationFilter implements Filter { static String cleanPath( String path ) { return path .replaceFirst( "^" + ServletRegistrationComponent.REST_CONTEXT + "/", "/" ) .replaceFirst( "^" + ServletRegistrationComponent.WEBSOCKET_CONTEXT + "/", "/" ) .replaceFirst( "\\?.*", "" ); } AuthenticationFilter( RestServicesMBean restServicesMBean ); @Override void doFilter( ServletRequest req, ServletResponse resp, FilterChain chain ); @Override void destroy(); @Override void init( FilterConfig filterConfig ); void setAuthenticationEnabled( boolean authenticationEnabled ); void setAuthenticationManager( AuthenticationManager authenticationMngr ); void setSessionPeriod( long sessionPeriod ); void setEnableCors( boolean enableCors );  }