use of org.apache.knox.gateway.filter.rewrite.impl.UrlRewriteResponse in project knox by apache.
the class UrlRewriteServletFilter method doFilter.
@Override
protected void doFilter(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws IOException, ServletException {
FilterConfig config = getConfig();
UrlRewriteRequest rewriteRequest = new UrlRewriteRequest(config, request);
UrlRewriteResponse rewriteResponse = new UrlRewriteResponse(config, rewriteRequest, response);
chain.doFilter(rewriteRequest, rewriteResponse);
}
use of org.apache.knox.gateway.filter.rewrite.impl.UrlRewriteResponse in project knox by apache.
the class InboundUrlFunctionProcessorTest method getRewriteResponse.
private UrlRewriteResponse getRewriteResponse() throws Exception {
UrlRewriteProcessor rewriter = EasyMock.createNiceMock(UrlRewriteProcessor.class);
EasyMock.expect(rewriter.getConfig()).andReturn(null).anyTimes();
ServletContext context = EasyMock.createNiceMock(ServletContext.class);
EasyMock.expect(context.getAttribute(UrlRewriteServletContextListener.PROCESSOR_ATTRIBUTE_NAME)).andReturn(rewriter).anyTimes();
FilterConfig config = EasyMock.createNiceMock(FilterConfig.class);
EasyMock.expect(config.getInitParameter(UrlRewriteServletFilter.RESPONSE_BODY_FILTER_PARAM)).andReturn("test-filter").anyTimes();
EasyMock.expect(config.getServletContext()).andReturn(context).anyTimes();
HttpServletRequest request = EasyMock.createNiceMock(HttpServletRequest.class);
EasyMock.expect(request.getParameterValues("host")).andReturn(new String[] { "http://foo:50075" }).anyTimes();
HttpServletResponse response = EasyMock.createNiceMock(HttpServletResponse.class);
EasyMock.replay(rewriter, context, config, request, response);
return new UrlRewriteResponse(config, request, response);
}
Aggregations