/** * Deletes all filters in the filter chain. */ public void releaseFilters() { mockFactory.getMockFilterChain().release(); mockFactory.getMockFilterChain().setServlet(servlet); }
/** * Deletes all filters in the filter chain. */ public void releaseFilters() { mockFactory.getMockFilterChain().release(); mockFactory.getMockFilterChain().setServlet(servlet); }
/** * Deletes all filters in the filter chain. */ public void releaseFilters() { mockFactory.getMockFilterChain().release(); mockFactory.getMockFilterChain().setServlet(servlet); }
/** * Returns the last request from the filter chain. Since * filters can replace the request with a request wrapper, * this method makes only sense after calling at least * one filter, i.e. after calling {@link #doFilter} or * after calling one servlet method with <i>doChain</i> * set to <code>true</code>. * @return the filtered request */ public ServletRequest getFilteredRequest() { return mockFactory.getMockFilterChain().getLastRequest(); }
/** * Returns the last request from the filter chain. Since * filters can replace the request with a request wrapper, * this method makes only sense after calling at least * one filter, i.e. after calling {@link #doFilter} or * after calling one servlet method with <i>doChain</i> * set to <code>true</code>. * @return the filtered request */ public ServletRequest getFilteredRequest() { return mockFactory.getMockFilterChain().getLastRequest(); }
/** * Returns the last response from the filter chain. Since * filters can replace the response with a response wrapper, * this method makes only sense after calling at least * one filter, i.e. after calling {@link #doFilter} or * after calling one servlet method with <i>doChain</i> * set to <code>true</code>. * @return the filtered response */ public ServletResponse getFilteredResponse() { return mockFactory.getMockFilterChain().getLastResponse(); }
/** * Returns the last response from the filter chain. Since * filters can replace the response with a response wrapper, * this method makes only sense after calling at least * one filter, i.e. after calling {@link #doFilter} or * after calling one servlet method with <i>doChain</i> * set to <code>true</code>. * @return the filtered response */ public ServletResponse getFilteredResponse() { return mockFactory.getMockFilterChain().getLastResponse(); }
/** * Returns the last request from the filter chain. Since * filters can replace the request with a request wrapper, * this method makes only sense after calling at least * one filter, i.e. after calling {@link #doFilter} or * after calling one servlet method with <i>doChain</i> * set to <code>true</code>. * @return the filtered request */ public ServletRequest getFilteredRequest() { return mockFactory.getMockFilterChain().getLastRequest(); }
/** * Returns the last response from the filter chain. Since * filters can replace the response with a response wrapper, * this method makes only sense after calling at least * one filter, i.e. after calling {@link #doFilter} or * after calling one servlet method with <i>doChain</i> * set to <code>true</code>. * @return the filtered response */ public ServletResponse getFilteredResponse() { return mockFactory.getMockFilterChain().getLastResponse(); }
/** * Sets the specified servlet as the current servlet. * Initializes it, if <code>doInit</code> is <code>true</code>. * @param servlet the servlet * @param doInit should <code>init</code> be called */ public void setServlet(HttpServlet servlet, boolean doInit) { try { this.servlet = servlet; if(doInit) { servlet.init(mockFactory.getMockServletConfig()); } mockFactory.getMockFilterChain().setServlet(servlet); } catch(Exception exc) { throw new NestedApplicationException(exc); } }
/** * Sets the specified servlet as the current servlet. * Initializes it, if <code>doInit</code> is <code>true</code>. * @param servlet the servlet * @param doInit should <code>init</code> be called */ public void setServlet(HttpServlet servlet, boolean doInit) { try { this.servlet = servlet; if(doInit) { servlet.init(mockFactory.getMockServletConfig()); } mockFactory.getMockFilterChain().setServlet(servlet); } catch(Exception exc) { throw new NestedApplicationException(exc); } }
/** * Sets the specified servlet as the current servlet. * Initializes it, if <code>doInit</code> is <code>true</code>. * @param servlet the servlet * @param doInit should <code>init</code> be called */ public void setServlet(HttpServlet servlet, boolean doInit) { try { this.servlet = servlet; if(doInit) { servlet.init(mockFactory.getMockServletConfig()); } mockFactory.getMockFilterChain().setServlet(servlet); } catch(Exception exc) { throw new NestedApplicationException(exc); } }
/** * Loops through the filter chain and calls the current servlets * <code>service</code> method at the end (only if a current servlet * is set). You can use it to test single filters or the interaction * of filters and servlets. * If you set <i>doChain</i> to <code>true</code> (use {@link #setDoChain}), * this method is called before any call of a servlet method. If a filter * does not call it's chains <code>doFilter</code> method, the chain * breaks and the servlet will not be called (just like it in the * real container). */ public void doFilter() { try { mockFactory.getMockFilterChain().doFilter(mockFactory.getWrappedRequest(), mockFactory.getWrappedResponse()); mockFactory.getMockFilterChain().reset(); } catch(Exception exc) { throw new NestedApplicationException(exc); } }
/** * Loops through the filter chain and calls the current servlets * <code>service</code> method at the end (only if a current servlet * is set). You can use it to test single filters or the interaction * of filters and servlets. * If you set <i>doChain</i> to <code>true</code> (use {@link #setDoChain}), * this method is called before any call of a servlet method. If a filter * does not call it's chains <code>doFilter</code> method, the chain * breaks and the servlet will not be called (just like it in the * real container). */ public void doFilter() { try { mockFactory.getMockFilterChain().doFilter(mockFactory.getWrappedRequest(), mockFactory.getWrappedResponse()); mockFactory.getMockFilterChain().reset(); } catch(Exception exc) { throw new NestedApplicationException(exc); } }
/** * Loops through the filter chain and calls the current servlets * <code>service</code> method at the end (only if a current servlet * is set). You can use it to test single filters or the interaction * of filters and servlets. * If you set <i>doChain</i> to <code>true</code> (use {@link #setDoChain}), * this method is called before any call of a servlet method. If a filter * does not call it's chains <code>doFilter</code> method, the chain * breaks and the servlet will not be called (just like it in the * real container). */ public void doFilter() { try { mockFactory.getMockFilterChain().doFilter(mockFactory.getWrappedRequest(), mockFactory.getWrappedResponse()); mockFactory.getMockFilterChain().reset(); } catch(Exception exc) { throw new NestedApplicationException(exc); } }
/** * Adds the specified filter it to the filter chain. Initializes it, * if <code>doInit</code> is <code>true</code>. * @param filter the filter * @param doInit should <code>init</code> be called */ public void addFilter(Filter filter, boolean doInit) { if(doInit) { try { filter.init(mockFactory.getMockFilterConfig()); } catch(Exception exc) { throw new NestedApplicationException(exc); } } mockFactory.getMockFilterChain().addFilter(filter); }
/** * Adds the specified filter it to the filter chain. Initializes it, * if <code>doInit</code> is <code>true</code>. * @param filter the filter * @param doInit should <code>init</code> be called */ public void addFilter(Filter filter, boolean doInit) { if(doInit) { try { filter.init(mockFactory.getMockFilterConfig()); } catch(Exception exc) { throw new NestedApplicationException(exc); } } mockFactory.getMockFilterChain().addFilter(filter); }
/** * Adds the specified filter it to the filter chain. Initializes it, * if <code>doInit</code> is <code>true</code>. * @param filter the filter * @param doInit should <code>init</code> be called */ public void addFilter(Filter filter, boolean doInit) { if(doInit) { try { filter.init(mockFactory.getMockFilterConfig()); } catch(Exception exc) { throw new NestedApplicationException(exc); } } mockFactory.getMockFilterChain().addFilter(filter); }