/*
 * JGrapes Event Driven Framework
 * Copyright (C) 2017  Michael N. Lipp
 * 
 * This program is free software; you can redistribute it and/or modify it 
 * under the terms of the GNU General Public License as published by 
 * the Free Software Foundation; either version 3 of the License, or 
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful, but 
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 
 * for more details.
 * 
 * You should have received a copy of the GNU General Public License along 
 * with this program; if not, see <http://www.gnu.org/licenses/>.
 */

package org.jgrapes.portal.events;

import java.net.URI;

import org.jdrupes.httpcodec.protocols.http.HttpRequest;
import org.jgrapes.core.Event;
import org.jgrapes.io.IOSubchannel;

/**
 * An event that signals the request of a resource by the portal (browser).
 * Resource request from the browser for a portlet resource are usually
 * generated during portal boot. See the description of
 * {@link AddPortletType} for details.
 */
public class PortletResourceRequest extends Event<Boolean> {

	private HttpRequest httpRequest;
	private IOSubchannel httpChannel;
	private String portletType;
	private URI resourceUri;

	/**
	 * Creates a new request.
	 * 
	 * @param portletType the portlet type
	 * @param resourceUri the requested resource
	 * @param httpRequest the original HTTP request
	 * @param httpChannel the channel that the HTTP request was received on
	 */
	public PortletResourceRequest(String portletType, URI resourceUri,
			HttpRequest httpRequest, IOSubchannel httpChannel) {
		this.portletType = portletType;
		this.resourceUri = resourceUri;
		this.httpRequest = httpRequest;
		this.httpChannel = httpChannel;
	}

	/**
	 * Returns the "raw" request as provided by the HTTP decoder.
	 * 
	 * @return the request
	 */
	public HttpRequest httpRequest() {
		return httpRequest;
	}

	/**
	 * @return the httpChannel
	 */
	public IOSubchannel httpChannel() {
		return httpChannel;
	}

	/**
	 * @return the portletId
	 */
	public String portletClass() {
		return portletType;
	}

	/**
	 * @return the resourceUri
	 */
	public URI resourceUri() {
		return resourceUri;
	}
}

@@ -911,16 +911,57 @@
 channel;
+%0Aimport org.jgrapes.portal.RenderSupport;
 %0A%0A/**%0A *
@@ -1390,16 +1390,54 @@
 urceUri;
+%0A%09private RenderSupport renderSupport;
 %0A%0A%09/**%0A%09
@@ -1675,16 +1675,60 @@
 ived on%0A
+%09 * @param renderSupport the render support%0A
 %09 */%0A%09pu
@@ -1844,16 +1844,48 @@
 pChannel
+,%0A%09%09%09RenderSupport renderSupport
 ) %7B%0A%09%09th
@@ -2008,32 +2008,70 @@
  = httpChannel;%0A
+%09%09this.renderSupport = renderSupport;%0A
 %09%7D%0A%0A%09/**%0A%09 * Ret
@@ -2479,24 +2479,24 @@
 urceUri() %7B%0A
-
 %09%09return res
@@ -2508,10 +2508,157 @@
 Uri;%0A%09%7D%0A
+%09%0A%09/**%0A%09 * Returns the render support.%0A%09 * %0A%09 * @return the render support%0A%09 */%0A%09public RenderSupport renderSupport() %7B%0A%09%09return renderSupport;%0A%09%7D%0A
 %7D%0A

Make RenderSupport available.