My purpose is to use a custom annotation within the REST method that automatically transform the parameter in some desired form. Something like:
Response get(@StringNormalizer(UPPERCASE) String myparam)
I know there is the HttpServletRequestWrapper class that can be used to intercept and modify input URI:
@WebFilter(urlPatterns="/*")
public class ApiOriginFilter implements Filter {
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException
{
HttpServletRequest wrappedRequest = new MyWrappedRequest(request);
chain.doFilter(wrappedRequest, response);
}
}
public class MyWrappedRequest extends HttpServletRequestWrapper
{
@Override
public String getQueryString() {
// return modified query
}
}
However I don't know how to retrieve annotations for method parameters (which, in the above example, is StringNormalizer class).
Any hints?