Closed GoogleCodeExporter closed 9 years ago
Thank you for letting us know!
I will check this asap; i suppose you are using the latest jodd and jetty?
Original comment by igor.spasic
on 30 Mar 2012 at 3:18
I was using Jetty 7.0.1 and JODD 3.3.2.
The problem seems to be because one filter is using response.getWriter() and
another one is using response.getOutputStream().
Original comment by bandino....@gmail.com
on 30 Mar 2012 at 6:05
Hi,
Do you have any progress on this issue? Any tips how to resolve this?
I have found a "workaround" (below), but it introduces some other issues:
Set-Cookie header is not sent in the response (which is very serious since it
is used for JSESSIONID), so it is not a fix, but might give you a clue what is
the problem.
class jodd.lagarto.filter.SimpleLagartoServletFilter:
public void doFilter(ServletRequest servletRequest, ServletResponse
servletResponse, FilterChain filterChain) throws IOException, ServletException {
HttpServletRequest request = (HttpServletRequest) servletRequest;
HttpServletResponse response = (HttpServletResponse) servletResponse;
String actionPath = DispatcherUtil.getServletPath(request);
if (acceptActionPath(request, actionPath) == false) {
filterChain.doFilter(servletRequest, servletResponse);
return;
}
// JETTY FIX: Without this the below fix will not work
// However, this line makes issues with Set-Cookie header
servletResponse.getOutputStream().flush();
CharArrayResponseWrapper wrapper = new CharArrayResponseWrapper(response);
filterChain.doFilter(servletRequest, wrapper);
char[] content = wrapper.toCharArray();
if ((content != null) && (content.length != 0)) {
if (log.isDebugEnabled()) {
log.debug("Lagarto is about to parse: " + actionPath);
}
try {
content = parse(content, request);
} catch (Exception ex) {
log.error("Error parsing", ex);
throw new ServletException(ex);
}
// JETTY FIX: Original lines code
//Writer out = servletResponse.getWriter();
//out.write(content);
// JETTY FIX: Replaced code with the fix
ServletOutputStream sout = servletResponse.getOutputStream();
sout.write(new String(content).getBytes());
}
}
Original comment by bandino....@gmail.com
on 1 Apr 2012 at 9:16
thank you for the fix submission, will take a look!
sorry on slow response, was on a business trip :( btw, is there any reason for
not using the latest jetty 7.6.x? maybe they fixed it inside ;)))
Original comment by igor.spasic
on 1 Apr 2012 at 11:07
I have just tried with the latest stable build 7.6.2.v20120308 and the issue
still happens :(
Original comment by bandino....@gmail.com
on 2 Apr 2012 at 7:15
[deleted comment]
Ok, I am trying to recreate the issue:) It's interesting: I've deployed jodd
example application on Jetty (uphea; that uses all jodd frameworks) and the
demo seems to works on jetty.
However, the sample application from jodd codebase fails with exact exception.
Thank you for your patience, working on it!
Original comment by igor.spasic
on 2 Apr 2012 at 4:27
Update: I've figured that if both Lagarto and Decora filters are enabled, then
there is no exception. So now I will try not to use simple
CharArrayResponseWrapper, but to use BufferResponseWrapper (from Decora).
Original comment by igor.spasic
on 2 Apr 2012 at 9:12
Ok, the fix is ready (i hope;), just need couple of minor things to clean and
that's it;)
@bandino: please check the email, i want to send you a beta jars, so you can
test it/have it sooner.
Original comment by igor.spasic
on 3 Apr 2012 at 2:37
This issue was closed by revision r1044.
Original comment by igor.spasic
on 4 Apr 2012 at 9:51
Original issue reported on code.google.com by
bandino....@gmail.com
on 30 Mar 2012 at 1:38