} catch (ClassCastException e) {
// no Http request -> ignore
chain.doFilter(request, response);
return;
}
OverwriteableHeaderHttpServletRequest wrapped = null;
Enumeration<String> paramNames = request.getParameterNames();
while(paramNames.hasMoreElements()) {
String param = paramNames.nextElement();
if(param != null && param.startsWith(HEARDER_PREFIX) && param.length() > HEARDER_PREFIX.length()+1){
String header = param.substring(HEARDER_PREFIX.length());
String[] values = request.getParameterValues(param);
if(values != null && values.length > 0){
if(wrapped == null ){ //lazzy initialisation
wrapped = new OverwriteableHeaderHttpServletRequest(httpRequest);
}
wrapped.setHeader(header, values);
}
}
}
if(wrapped != null){
chain.doFilter(wrapped, response);