< prev index next >

src/jdk.httpserver/share/classes/com/sun/net/httpserver/Filter.java

Print this page

        

*** 70,80 **** * In this case, the filter <b>must</b> send the * response to the request, because the application's * exchange handler will not be invoked. * @param exchange the HttpExchange * @throws IOException let exceptions pass up the stack ! * @throws NullPointerException if exchange is <code>null</code> */ public void doFilter (HttpExchange exchange) throws IOException { if (!iter.hasNext()) { handler.handle (exchange); } else { --- 70,80 ---- * In this case, the filter <b>must</b> send the * response to the request, because the application's * exchange handler will not be invoked. * @param exchange the HttpExchange * @throws IOException let exceptions pass up the stack ! * @throws NullPointerException if exchange is {@code null} */ public void doFilter (HttpExchange exchange) throws IOException { if (!iter.hasNext()) { handler.handle (exchange); } else {
*** 84,115 **** } } /** * Asks this filter to pre/post-process the given exchange. The filter ! * can :- * <ul><li>examine or modify the request headers</li> * <li>filter the request body or the response body, by creating suitable * filter streams and calling * {@link HttpExchange#setStreams(InputStream,OutputStream)}</li> * <li>set attribute Objects in the exchange, which other filters or the * exchange handler can access.</li> ! * <li>decide to either :-<ol> * <li>invoke the next filter in the chain, by calling * {@link Filter.Chain#doFilter(HttpExchange)}</li> * <li>terminate the chain of invocation, by <b>not</b> calling * {@link Filter.Chain#doFilter(HttpExchange)}</li></ol> * <li>if option 1. above taken, then when doFilter() returns all subsequent * filters in the Chain have been called, and the response headers can be * examined or modified.</li> * <li>if option 2. above taken, then this Filter must use the HttpExchange ! * to send back an appropriate response</li></ul><p> ! * @param exchange the <code>HttpExchange</code> to be filtered. * @param chain the Chain which allows the next filter to be invoked. * @throws IOException may be thrown by any filter module, and if * caught, must be rethrown again. ! * @throws NullPointerException if either exchange or chain are <code>null</code> */ public abstract void doFilter (HttpExchange exchange, Chain chain) throws IOException; /** --- 84,116 ---- } } /** * Asks this filter to pre/post-process the given exchange. The filter ! * can: * <ul><li>examine or modify the request headers</li> * <li>filter the request body or the response body, by creating suitable * filter streams and calling * {@link HttpExchange#setStreams(InputStream,OutputStream)}</li> * <li>set attribute Objects in the exchange, which other filters or the * exchange handler can access.</li> ! * <li>decide to either<ol> * <li>invoke the next filter in the chain, by calling * {@link Filter.Chain#doFilter(HttpExchange)}</li> * <li>terminate the chain of invocation, by <b>not</b> calling * {@link Filter.Chain#doFilter(HttpExchange)}</li></ol> * <li>if option 1. above taken, then when doFilter() returns all subsequent * filters in the Chain have been called, and the response headers can be * examined or modified.</li> * <li>if option 2. above taken, then this Filter must use the HttpExchange ! * to send back an appropriate response</li></ul> ! * ! * @param exchange the {@code HttpExchange} to be filtered. * @param chain the Chain which allows the next filter to be invoked. * @throws IOException may be thrown by any filter module, and if * caught, must be rethrown again. ! * @throws NullPointerException if either exchange or chain are {@code null} */ public abstract void doFilter (HttpExchange exchange, Chain chain) throws IOException; /**
< prev index next >