Webfilter + vraptor 3

29 views
Skip to first unread message

Biel Dantonio

unread,
Jan 2, 2015, 1:35:25 PM1/2/15
to caelum-...@googlegroups.com
Prezados,

estou tentando implementar um webfilter:

@WebFilter(
  filterName = "CompressResponseFilter",
  urlPatterns = { "/*" }
)

e quando ele chega nessa linha:

String servletResponse = new String(responseWrapper.toString());
    resp.getWriter().write(compressor.compress(servletResponse));

estoura a seguinte exception:

java.lang.IllegalStateException: getOutputStream() has already been called for this response
    at org.apache.catalina.connector.Response.getWriter(Response.java:648)
    at org.apache.catalina.connector.ResponseFacade.getWriter(ResponseFacade.java:213)
    at br.com.components.CompressResponseFilter.doFilter(CompressResponseFilter.java:34)

at br.com.caelum.vraptor.VRaptor.doFilter(VRaptor.java:79)

No VRaptor é essa linha:
staticHandler.deferProcessingToContainer(chain, baseRequest, baseResponse);

Alguma idéia de porque isso acontece? Ou não posso colocar um webfilter junto com o VRaptor?

Abs,

Marcão

Lucas Cavalcanti

unread,
Jan 3, 2015, 7:43:21 PM1/3/15
to caelum-vraptor
Olá,

já tentou usar esse filter numa aplicação sem o VRaptor? Ou melhor, na mesma, mas sem o filtro do VRaptor...

a linha do VRaptor aparece pq ele é um filtro, logo participa da request.

--
You received this message because you are subscribed to the Google Groups "caelum-vraptor" group.
To unsubscribe from this group and stop receiving emails from it, send an email to caelum-vrapto...@googlegroups.com.
To post to this group, send email to caelum-...@googlegroups.com.
Visit this group at http://groups.google.com/group/caelum-vraptor.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages