001/*
002 * JGrapes Event Driven Framework
003 * Copyright (C) 2017-2018 Michael N. Lipp
004 * 
005 * This program is free software; you can redistribute it and/or modify it 
006 * under the terms of the GNU Affero General Public License as published by 
007 * the Free Software Foundation; either version 3 of the License, or 
008 * (at your option) any later version.
009 * 
010 * This program is distributed in the hope that it will be useful, but 
011 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
012 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License 
013 * for more details.
014 * 
015 * You should have received a copy of the GNU Affero General Public License along 
016 * with this program; if not, see <http://www.gnu.org/licenses/>.
017 */
018
019package org.jgrapes.portal.base.events;
020
021import java.net.URI;
022import java.time.Instant;
023
024import org.jdrupes.httpcodec.protocols.http.HttpRequest;
025import org.jgrapes.http.Session;
026import org.jgrapes.io.IOSubchannel;
027import org.jgrapes.portal.base.RenderSupport;
028
029/**
030 * An event that signals the request of a resource by the portal (browser).
031 * Resource request from the browser for a portlet resource are usually
032 * generated during portal boot. See the description of
033 * {@link AddPortletType} for details.
034 */
035public class PortletResourceRequest extends ResourceRequest {
036
037    private final String portletType;
038
039    /**
040     * Creates a new request.
041     * 
042     * @param portletType the portlet type
043     * @param resourceUri the requested resource
044     * @param httpRequest the original HTTP request
045     * @param httpChannel the channel that the HTTP request was received on
046     * @param renderSupport the render support
047     */
048    public PortletResourceRequest(String portletType, URI resourceUri,
049            Instant ifModifiedSince,
050            HttpRequest httpRequest, IOSubchannel httpChannel,
051            Session session, RenderSupport renderSupport) {
052        super(resourceUri, ifModifiedSince,
053            httpRequest, httpChannel, session, renderSupport);
054        this.portletType = portletType;
055    }
056
057    /**
058     * @return the portletId
059     */
060    public String portletClass() {
061        return portletType;
062    }
063
064}