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, 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.loader; 029 030import org.opencms.file.CmsObject; 031import org.opencms.file.CmsResource; 032import org.opencms.main.CmsException; 033 034import java.io.IOException; 035import java.util.Locale; 036 037import javax.servlet.ServletException; 038import javax.servlet.ServletRequest; 039import javax.servlet.ServletResponse; 040 041/** 042 * Resource loaders that implement this method can easily provide the contents of a selected targe element as 043 * a String.<p> 044 * 045 * @since 6.2.0 046 */ 047public interface I_CmsResourceStringDumpLoader { 048 049 /** 050 * Dumps the processed content of the the requested file (and it's sub-elements) to a String.<p> 051 * 052 * This is a special form of <code>{@link I_CmsResourceLoader#dump(CmsObject, CmsResource, String, Locale, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)}</code> 053 * where the result is required in a String, for example for printing it to a writer.<p> 054 * 055 * @param cms used to access the OpenCms VFS 056 * @param resource the requested resource in the VFS 057 * @param element the element in the file to display 058 * @param locale the locale to display 059 * @param req the servlet request 060 * @param res the servlet response 061 * 062 * @return the content of the processed file as a String 063 * 064 * @throws ServletException might be thrown by the servlet environment 065 * @throws IOException might be thrown by the servlet environment 066 * @throws CmsException in case of errors acessing OpenCms functions 067 * 068 * @see I_CmsResourceLoader#dump(CmsObject, CmsResource, String, Locale, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) 069 */ 070 String dumpAsString( 071 CmsObject cms, 072 CmsResource resource, 073 String element, 074 Locale locale, 075 ServletRequest req, 076 ServletResponse res) throws ServletException, IOException, CmsException; 077}