/** * Creates a wrapper that implements either {@code ServletResponse} or {@code * HttpServletResponse}, depending on the type of {@code pImplementation.getResponse()}. * * @param pImplementation the servlet response to create a wrapper for * @return a {@code ServletResponse} or {@code HttpServletResponse}, depending on the type of * {@code pImplementation.getResponse()} */ public static ServletResponse createWrapper(final ServletResponseWrapper pImplementation) { // TODO: Get all interfaces from implementation if (pImplementation.getResponse() instanceof HttpServletResponse) { return (HttpServletResponse) Proxy.newProxyInstance( pImplementation.getClass().getClassLoader(), new Class[] {HttpServletResponse.class, ServletResponse.class}, new HttpServletResponseHandler(pImplementation)); } return pImplementation; }