servlet-filters

Replacing the default filter at position SESSION_MANAGEMENT_FILTER

大憨熊 提交于 2021-02-16 15:14:08
问题 I want to replace the default SessionManagementFilter with my own, but I'm running into this 17:31:32,901 ERROR [[/accounts]] Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Filter beans '<accountsSessionManageFilter>' and 'Root bean: class [org.springframework.security.web.session.SessionManagementFilter]; scope=;

how to modify query params in a Jersey Filter

一个人想着一个人 提交于 2021-02-10 06:34:45
问题 According to Jersey documentation Filters can be used when you want to modify any request or response parameters like headers So I believe modifying query params is possible but I don't know how and I haven't been able to find anything on Google or stackoverflow... This the functionality I would like to achieve: public class EreturnLookupFilter implements ContainerRequestFilter { private static final Logger logger = Logger.getLogger(UserResource.class.getName()); @Override public void filter

getOutputStream in HttpServletResponseWrapper getting called multiple times

这一生的挚爱 提交于 2021-02-08 10:21:05
问题 We are using a servlet filter to inject a string into the response before returning it. We are using an implementation of HttpServletResponseWrapper to do this. The wrapper class is called from the `doFilter() method: chain.doFilter(request, responseWrapper); The code snipppet from our ResponseWrapper class is: @Override public ServletOutputStream getOutputStream() throws IOException { String theString = "someString"; // Get a reference to the superclass's outputstream. ServletOutputStream

Add ShallowEtagHeaderFilter in Spring Boot MVC

青春壹個敷衍的年華 提交于 2021-02-07 04:00:49
问题 I'm trying to adjust my application configuration in order to setup ETag support. I have just checked this SO question, so let me say where my code is different from it: I don't use any xml configuration file whatsoever. I'm using different configuration classes for each aspect of the system. My WebConfig looks like this: @Configuration @EnableAutoConfiguration @ComponentScan(basePackages = { "xxx", "yyy" }) public class WebConfig extends WebMvcConfigurerAdapter { @Bean public Filter

Add ShallowEtagHeaderFilter in Spring Boot MVC

烈酒焚心 提交于 2021-02-07 04:00:39
问题 I'm trying to adjust my application configuration in order to setup ETag support. I have just checked this SO question, so let me say where my code is different from it: I don't use any xml configuration file whatsoever. I'm using different configuration classes for each aspect of the system. My WebConfig looks like this: @Configuration @EnableAutoConfiguration @ComponentScan(basePackages = { "xxx", "yyy" }) public class WebConfig extends WebMvcConfigurerAdapter { @Bean public Filter

CORS Angular 8 it gives me

三世轮回 提交于 2021-02-05 12:22:59
问题 I have a CORS problem in my project. From Angular 8 I do: httpOptions = { headers: new HttpHeaders({ 'Content-Type':'application/json', 'Authorization':'Basic bm92Z*********************' }) }; and I do get operation in this way: public getStudents() : Observable<IStudent[]>{ return this.http.get<IStudent[]>(this.writeUrl, this.httpOptions)...// this.writeUrl is the request url } In my server with java I do: public void filter(ContainerRequestContext requestContext, ContainerResponseContext

Jersey error when trying to suspend a connection of an asynchronous request

こ雲淡風輕ζ 提交于 2021-01-28 11:58:00
问题 Im doing a small test on suspending a asynch request using jersey but im getting an error. Let me show you what im trying to do and by the way the server is up and running just this request is failing: Path("/json/metallica") public class JSONService { @GET @Path("/test") @Produces(MediaType.APPLICATION_JSON) public void getAsynchHealthyTracks(@Suspended AsyncResponse asyncResponse){ HealthService.getInstance().getHealththyTracks(asyncResponse); } } when i call this from my local host on

what happens when I configure a servlet before a filter in tomcat's web.xml?

有些话、适合烂在心里 提交于 2021-01-28 11:57:18
问题 In tomcat for a certain url, I want to skip all the filters and execute a servlet and I thought placing the servlet before the filter will to as I expected but still the filters behind the servlet mappings are executing. Am I doing anything wrong? For instance, this is my web.xml <servlet> <servlet-name>APIRedirection</servlet-name> <servlet-class>com.test.APIRedirection</servlet-class> </servlet> <servlet-mapping> <servlet-name>APIRedirection</servlet-name> <url-pattern>/abc/*</url-pattern>

Servlet filter prevents css from working

无人久伴 提交于 2020-12-08 02:19:24
问题 I'm working on a java project based on spring-MVC. I have users - students in this issue - which I'd like to check on each page they navigate, if they are logged it. So I wrote a web filter, that runs before each page loading and assures that user is logged in and is a student- except for login page ( obviously user is not logged in there :D) and home page which is reachable for everyone- however, when I added this filter to the project, all css got disabled, all images disappeared, and I