⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 downloadcontent.java

📁 这是linux下ssl vpn的实现程序
💻 JAVA
字号:
package com.sslexplorer.core;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForward;

/**
 * Core to the feature that allows files to be download for
 * various functions such as a private key downloads or VFS downloads, implementations
 * of this interface are responsible for provided the content to be downloaded.
 * <p>
 * For example, one implementation may get the downloadable content from a
 * local file, whilst another zips lots of resources to a single archive
 * and provides that for download.
 * <p>
 * Implementations must also provide some message resources that will
 * be displayed when at the time of file download.
 * 
 * @author Brett Smith <a href="mailto: brett@3sp.com">&lt;brett@3sp.com&gt;</a>
 * @version $Revision: 1.6 $
 */
public interface DownloadContent {

	/**
     * Do the actual download. At this point the filename and content type
     * will already have been set on the response so all this method does
     * is get the downloadable input stream from somewhere and write it
     * to the {@link HttpServletResponse} objects output stream.
     * 
	 * @param response response that contains output stream to write to
	 * @param request request 
	 * @throws Exception on any error
	 */
	public void sendDownload(HttpServletResponse response, HttpServletRequest request)
			throws Exception;

    /**
     * Each download must have a unique id, this method returns it.
     * 
     * @return download id
     */
	public int getId();

    /**
     * Each download must have a unique id, this method sets it.
     * 
     * @param id download id
     */
	public void setId(int id);

    /**
     * Invoked when the download is complete, any clean up should be done
     * here.
     */
	public void completeDownload();
	
    /**
     * Get the forward to direct to when the download is complete.
     * 
     * @return forward
     */
	public ActionForward getForward();
	
    /**
     * Get the message key for the resources to display to user on the
     * file download page.
     * 
     * @return message key
     */
    public String getMessageKey();

    /**
     * Get the resource bundle id from which to get the resources to display
     * to user on the file download page
     * 
     * @return message resources bundle id
     */
    public String getMessageResourcesKey();
    
    /**
     * Get the first argument to pass to the message to display to user on 
     * the file dfownload page.
     * 
     * @return first argument
     */
    public String getMessageArg0();

    /**
     * Get the second argument to pass to the message to display to user on 
     * the file download page.
     * 
     * @return second argument
     */
    public String getMessageArg1();

    /**
     * Get the third argument to pass to the message to display to user on 
     * the file download page.
     * 
     * @return third argument
     */
    public String getMessageArg2();

    /**
     * Get the fourth argument to pass to the message to display to user on 
     * the file download page.
     * 
     * @return fourth argument
     */
    public String getMessageArg3();

    /**
     * Get the fifth argument to pass to the message to display to user on 
     * the file download page.
     * 
     * @return fifth argument
     */
    public String getMessageArg4();
    
    /**
     * Get if this the {@link #completeDownload()} method should be called
     * as soon as download has been attempted once. Implemtation may clean
     * up here (e.g. delete a temporary file) 
     * 
     * @return complete after single download
     */
    public boolean isSingleDownloadOnly();
    
    /**
     * Get the mime type to return to the browser when downloaded. This will
     * affect the actions that are presented to the user (e.g. open with
     * application or save to disk etc).
     * 
     * @return mime type
     */
    public String getMimeType();
    
    /**
     * Get the filename to return to the browser when downloaded.
     * 
     * @return filename
     */
    public String getFilename();
    
    /**
     * Get the forward to use to show the download message
     * 
     * @return forward
     */
    public ActionForward getMessageForward();

    /**
     * Get the number of times this piece of content has been downloaded.
     * 
     * @return download count
     */
    public int getDownloadCount();

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -