Hi Vidar and all, I think that this approach is not working. I have the exact same use case. We don't want to put the _charset_ parameter into every form. Therefore I tried to automatically add a _charset_ request parameter to the request in a filter. However that parameter never gets picked up as ParameterSupport is created before the filter gets called (and then uses the reference to the original servletrequest and not the wrapped one). I could theoretically reinstantiate Parametersupport but that requires knowledge of the servlet attribute key where parametersupport is stored. And that is a private variable in parametersupport.
Any other chance to not have the _charset_ parameter in every post request sent to the system? Thanks, Markus On Fri, Feb 11, 2011 at 2:25 PM, Vidar Ramdal <vi...@idium.no> wrote: > On Thu, Feb 10, 2011 at 11:56 PM, Peter Dotchev <dotc...@gmail.com> wrote: >> >> Hi, >> >> Recently >> http://dotev.blogspot.com/2011/02/posting-non-ascii-characters-in-web.html I >> stumbled over this issue too. >> >> I don't want to add _charset_ input to all the forms. >> Is there a way to set the request encoding to UTF-8? >> IMHO it would be better if the request encoding is configurable like it is >> done in Wicket. >> >> http://wiki.apache.org/tomcat/FAQ/CharacterEncoding Tomcat FAQ suggests >> using a filter. >> How can I do that in Sling? > > Hi, you can implement the javax.servlet.Filter interface and register > your implementation as a Filter service: > > @Component(immediate = true) > @Properties({ > @Property(name = "filter.scope", value = "request", > propertyPrivate = true), > @Property(name = "filter.order", value = "-9", propertyPrivate = true) > }) > @Services({@Service(javax.servlet.Filter.class)}) > public class YourFilter implements javax.servlet.Filter { > ... > } > > > > -- > Vidar S. Ramdal <vi...@idium.no> - http://www.idium.no > Sommerrogata 13-15, N-0255 Oslo, Norway > + 47 22 00 84 00 > Quando omni flunkus moritatus! >