Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.RuntimeCollective.content.servlet
Class FileServlet  view FileServlet download FileServlet.java

java.lang.Object
  extended byjavax.servlet.GenericServlet
      extended byjavax.servlet.http.HttpServlet
          extended bycom.RuntimeCollective.content.servlet.FileServlet
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class FileServlet
extends javax.servlet.http.HttpServlet

Serves Files, based on the request URL.

The URL should be of the form:

http://www.myServer.com/url-pattern/1234.pdf
where url-pattern is mapped in web.xml, 1234 is the File id, and .pdf is the file type of the File.

The (possibly) returned file will be:

contentFilesDataDir/1234.pdf
where contentFileDir is defined in web.xml.

Note: the "image/vnd.rn-realflash" mime type is replaced with "application/x-shockwave-flash".

Version:
$Id: FileServlet.java,v 1.8 2003/10/13 15:42:42 fabrice Exp $

Field Summary
 
Fields inherited from class javax.servlet.http.HttpServlet
 
Fields inherited from class javax.servlet.GenericServlet
 
Constructor Summary
FileServlet()
           
 
Method Summary
 boolean allowDownload(javax.servlet.http.HttpServletRequest request, com.RuntimeCollective.content.bean.File file)
          Check the permissions of a given request on a given File.
 void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Write the requested File to the connection, after permission checks
private  void writeBlankResponse(javax.servlet.ServletOutputStream outStream)
          Write an empty String to the response
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileServlet

public FileServlet()
Method Detail

doGet

public void doGet(javax.servlet.http.HttpServletRequest request,
                  javax.servlet.http.HttpServletResponse response)
           throws java.io.IOException,
                  javax.servlet.ServletException
Write the requested File to the connection, after permission checks


writeBlankResponse

private void writeBlankResponse(javax.servlet.ServletOutputStream outStream)
                         throws java.io.IOException
Write an empty String to the response


allowDownload

public boolean allowDownload(javax.servlet.http.HttpServletRequest request,
                             com.RuntimeCollective.content.bean.File file)
Check the permissions of a given request on a given File. This returns true in all cases. FIXME: implement some security for the CMS here; sharedfs has security in a subclass.