001/*
002 * This library is part of OpenCms -
003 * the Open Source Content Management System
004 *
005 * Copyright (c) Alkacon Software GmbH & Co. KG (https://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: https://www.alkacon.com
019 *
020 * For further information about OpenCms, please see the
021 * project website: https://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.io.OutputStream;
036
037import jakarta.servlet.ServletException;
038import jakarta.servlet.http.HttpServletRequest;
039import jakarta.servlet.http.HttpServletResponse;
040
041/**
042 * Capability interface for resource loaders which can static export directly to an output stream.<p>
043 */
044public interface I_CmsStaticExportStreamLoader {
045
046    /**
047     * Static exports the contents of the requested resource to an output stream, optionally also to the response.<p>
048     *
049     * @param cms the initialized CmsObject which provides user permissions
050     * @param resource the requested OpenCms VFS resource
051     * @param req the servlet request
052     * @param res the servlet response
053     * @param exportOut the export output stream
054     *
055     * @throws ServletException might be thrown in the process of writing the response
056     * @throws IOException might be thrown in the process of writing the streams
057     * @throws CmsException in case something goes wrong
058     */
059    void exportTo(
060        CmsObject cms,
061        CmsResource resource,
062        HttpServletRequest req,
063        HttpServletResponse res,
064        OutputStream exportOut)
065    throws ServletException, IOException, CmsException;
066}