1 /* 2 * SSL-Explorer 3 * 4 * Copyright (C) 2003-2006 3SP LTD. All Rights Reserved 5 * 6 * This program is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public License 8 * as published by the Free Software Foundation; either version 2 of 9 * the License, or (at your option) any later version. 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public 16 * License along with this program; if not, write to the Free Software 17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 18 */ 19 20 package com.sslexplorer.boot; 21 22 import java.io.IOException; 23 24 /** 25 * Handles an HTTP request from the containing web server. 26 * <p> 27 * Whenever the containing web server receives a request, before passing it on 28 * to the main web application it should called the {@link #handle(String, String, RequestHandlerRequest, RequestHandlerResponse)} 29 * method on all registered request handlers. 30 * <p> 31 * Implementations should examine the request based on the arguments provided 32 * and if they wish to process the request, do so and return <code>true</code>. 33 * <p> 34 * Returning <code>false</false> signifies that the handler didnt handle the 35 * request and it should be passed on to the next handler (if any). 36 * 37 * @author Brett Smith <brett@3sp.com> 38 */ 39 public interface RequestHandler { 40 41 /** 42 * Handle a request 43 * 44 * @param pathInContext path extracted from the HTTP method line 45 * @param pathParams paramters passed 46 * @param request request object 47 * @param response response object 48 * @return handled <code>true</code> if this handler handled te request 49 * @throws RequestHandlerException on any exception associated with the handling of the request 50 * @throws IOException on any input / output error 51 */ 52 public boolean handle(String pathInContext, String pathParams, RequestHandlerRequest request, RequestHandlerResponse response) throws 53 IOException, RequestHandlerException; 54 55 } 56