Skip to content

Instantly share code, notes, and snippets.

@lefloh
Created July 13, 2015 20:07
Show Gist options
  • Save lefloh/e6bf1d9393120e471980 to your computer and use it in GitHub Desktop.
Save lefloh/e6bf1d9393120e471980 to your computer and use it in GitHub Desktop.
RESTesy ContainerRequestFilter overwriting the DefaultEncoding
@Provider
public class CharsetFilter implements ContainerRequestFilter {
@Override
public void filter(ContainerRequestContext requestContext) throws IOException {
String charset = requestContext.getHeaderString("X-Charset");
if (charset != null) {
requestContext.setProperty(InputPart.DEFAULT_CHARSET_PROPERTY, charset);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment