001/* 002 * This library is part of OpenCms - 003 * the Open Source Content Management System 004 * 005 * Copyright (c) Alkacon Software GmbH & Co. KG (http://www.alkacon.com) 006 * 007 * This library is free software; you can redistribute it and/or 008 * modify it under the terms of the GNU Lesser General Public 009 * License as published by the Free Software Foundation; either 010 * version 2.1 of the License, or (at your option) any later version. 011 * 012 * This library is distributed in the hope that it will be useful, 013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 015 * Lesser General Public License for more details. 016 * 017 * For further information about Alkacon Software GmbH & Co. KG, please see the 018 * company website: http://www.alkacon.com 019 * 020 * For further information about OpenCms, please see the 021 * project website: http://www.opencms.org 022 * 023 * You should have received a copy of the GNU Lesser General Public 024 * License along with this library; if not, write to the Free Software 025 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 026 */ 027 028package org.opencms.main; 029 030import java.io.IOException; 031 032import javax.servlet.ServletException; 033import javax.servlet.http.HttpServletRequest; 034import javax.servlet.http.HttpServletResponse; 035 036/** 037 * Describes an OpenCms request handler.<p> 038 * 039 * Request handlers are used for special requests to OpenCms 040 * that should NOT be mapped to a VFS resource. 041 * A request handler URI always start with <code>/handle</code> and then 042 * one or more possible handler names as defined with the {@link #getHandlerNames()} 043 * method.<p> 044 * 045 * For example, if a registerd request handler has the name <code>"MyName"</code>, 046 * any request (in a simple setup) to <code>/opencms/opencms/handlerMyName...</code> will directly be transfered 047 * to the {@link #handle(HttpServletRequest, HttpServletResponse, String)} method of this 048 * handler.<p> 049 * 050 * In essence, the request handlers are like simplified mini-servlets that run inside OpenCms. 051 * Of course they are not intended as replacements for real servlets. 052 * In case you require sophisticated lifecycle support use a genuine servlet instead.<p> 053 * 054 * @since 6.0.0 055 */ 056public interface I_CmsRequestHandler { 057 058 /** 059 * Returns the handler name.<p> 060 * 061 * @return the handler name 062 */ 063 String[] getHandlerNames(); 064 065 /** 066 * Handles an OpenCms request.<p> 067 * 068 * @param req the current request 069 * @param res the current response 070 * @param name the handler name to invoke 071 * @throws ServletException in case an error occurs 072 * @throws IOException in case an error occurs 073 */ 074 void handle(HttpServletRequest req, HttpServletResponse res, String name) throws IOException, ServletException; 075}