All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.sun.jsftemplating.util.fileStreamer.ContentSource Maven / Gradle / Ivy

/*
 * The contents of this file are subject to the terms 
 * of the Common Development and Distribution License 
 * (the License).  You may not use this file except in
 * compliance with the License.
 * 
 * You can obtain a copy of the license at 
 * https://jsftemplating.dev.java.net/cddl1.html or
 * jsftemplating/cddl1.txt.
 * See the License for the specific language governing 
 * permissions and limitations under the License.
 * 
 * When distributing Covered Code, include this CDDL 
 * Header Notice in each file and include the License file 
 * at jsftemplating/cddl1.txt.  
 * If applicable, add the following below the CDDL Header, 
 * with the fields enclosed by brackets [] replaced by
 * you own identifying information: 
 * "Portions Copyrighted [year] [name of copyright owner]"
 * 
 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
 */
package com.sun.jsftemplating.util.fileStreamer;

import java.io.IOException;
import java.io.InputStream;


/**
 *  

Implement this interface to provide an Object that is capable of * providing data to FileStreamer. * ContentSource implementations must be thread safe. The * FileStreamer will reuse the same instance when 2 requests * are made to the same ContentSource type. Instance variables, * therefore, should not be used; you may use the context to store local * information.

* * @author Ken Paulsen ([email protected]) */ public interface ContentSource { /** *

This method should return a unique string used to identify this * ContentSource. This string must be specified in order * to select the appropriate ContentSource when using the * FileStreamer.

*/ public String getId(); /** *

This method is responsible for generating the content and returning * an InputStream to that content. It is also responsible for setting * any attribute values in the {@link Context}, such as * {@link Context#EXTENSION} or {@link Context#CONTENT_TYPE}.

*/ public InputStream getInputStream(Context ctx) throws IOException; /** *

This method returns the path of the resource that was * requested.

*/ public String getResourcePath(Context ctx); /** *

This method may be used to clean up any temporary resources. It * will be invoked after the InputStream has been * completely read.

*/ public void cleanUp(Context ctx); /** *

This method is responsible for returning the last modified date of * the content, or -1 if not applicable. This information will be * used for caching.

*/ public long getLastModified(Context context); }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy