Closed GoogleCodeExporter closed 9 years ago
Original comment by alex.obj...@gmail.com
on 12 Dec 2013 at 4:31
I think one possible fix is to change
https://github.com/alexo/wro4j/blob/1.7.x/wro4j-core/src/main/java/ro/isdc/wro/h
ttp/WroContextFilter.java#L55 from this:
public final void doFilter(final ServletRequest req, final ServletResponse res, final FilterChain chain)
throws IOException, ServletException {
final HttpServletRequest request = (HttpServletRequest) req;
final HttpServletResponse response = (HttpServletResponse) res;
try {
Context.set(Context.webContext(request, response, this.filterConfig), getWroConfiguration());
chain.doFilter(request, response);
} finally {
Context.unset();
}
}
to this:
public final void doFilter(final ServletRequest req, final ServletResponse res, final FilterChain chain)
throws IOException, ServletException {
final HttpServletRequest request = (HttpServletRequest) req;
final HttpServletResponse response = (HttpServletResponse) res;
Context.set(Context.webContext(request, response, this.filterConfig), getWroConfiguration());
final String correlationId = Context.getCorrelationId();
try {
chain.doFilter(request, response);
} finally {
Context.setCorrelationId(correlationId);
Context.unset();
}
}
Original comment by candrews...@gmail.com
on 12 Dec 2013 at 4:45
I committed a workaround for the current snapshot version (1.7.2-SNAPSHOT) of
the grails plugin for testing purposes:
https://github.com/wro4j/wro4j-grails-plugin/commit/cb45ec94c58a5ddb0bf132c48a93
30ca69495d48
Original comment by candrews...@gmail.com
on 13 Dec 2013 at 1:06
Thinking about it more, I think treating the Context as a stack makes more
sense. So I propose this method:
public final void doFilter(final ServletRequest req, final ServletResponse res, final FilterChain chain)
throws IOException, ServletException {
final HttpServletRequest request = (HttpServletRequest) req;
final HttpServletResponse response = (HttpServletResponse) res;
String oldCorrelationId = null;
if(Context.isContextSet()) oldCorrelationId = Context.getCorrelationId();
Context.set(Context.webContext(request, response, this.filterConfig), getWroConfiguration());
final String correlationId = Context.getCorrelationId();
try {
chain.doFilter(request, response);
} finally {
Context.setCorrelationId(correlationId);
Context.unset();
if(oldCorrelationId != null) Context.setCorrelationId(oldCorrelationId);
}
}
Original comment by candrews...@gmail.com
on 13 Dec 2013 at 6:17
Submitted a pull request: https://github.com/alexo/wro4j/pull/166
Original comment by candrews...@gmail.com
on 13 Dec 2013 at 6:57
Fixed in branch 1.7.x. Thanks for the contribution!
Original comment by alex.obj...@gmail.com
on 13 Dec 2013 at 10:06
Original issue reported on code.google.com by
candrews...@gmail.com
on 12 Dec 2013 at 4:28