com.atlassian.bamboo.fileserver
Class FileServingServlet

java.lang.Object
  extended by HttpServlet
      extended by com.atlassian.bamboo.fileserver.FileServingServlet

public class FileServingServlet
extends HttpServlet

This servlet serves up download data files as if they are in the webapp download directory.


Field Summary
static String MIME_TYPE_CONFIGURATION_FILE
           
static String URI_PREFIX
           
static int URI_PREFIX_LENGTH
           
 
Constructor Summary
FileServingServlet()
           
 
Method Summary
protected  void doDelete(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse)
          Does not support HTTP Deletes - returns a 400 error.
protected  void doGet(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse)
           
protected  void doPost(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse)
          Does not support HTTP Posts - returns a 400 error.
 String getMimeType(String fileName)
          Uses the filename extension type to work out the mime type.
 void init()
          Load the mime types from WEB-INF/mimetypes.xml
 void setPersister(Persister persister)
          Can override the persister for testing
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MIME_TYPE_CONFIGURATION_FILE

public static final String MIME_TYPE_CONFIGURATION_FILE
See Also:
Constant Field Values

URI_PREFIX

public static final String URI_PREFIX
See Also:
Constant Field Values

URI_PREFIX_LENGTH

public static final int URI_PREFIX_LENGTH
Constructor Detail

FileServingServlet

public FileServingServlet()
Method Detail

init

public void init()
Load the mime types from WEB-INF/mimetypes.xml


doGet

protected void doGet(HttpServletRequest httpServletRequest,
                     HttpServletResponse httpServletResponse)
              throws ServletException,
                     IOException
Throws:
ServletException
IOException

getMimeType

public String getMimeType(String fileName)
Uses the filename extension type to work out the mime type. An unknown extension is classed as "text/html"

Parameters:
fileName -
Returns:
The mime type

doPost

protected void doPost(HttpServletRequest httpServletRequest,
                      HttpServletResponse httpServletResponse)
               throws ServletException,
                      IOException
Does not support HTTP Posts - returns a 400 error. Need them so we can test they do the right thing!

Throws:
ServletException
IOException

doDelete

protected void doDelete(HttpServletRequest httpServletRequest,
                        HttpServletResponse httpServletResponse)
                 throws ServletException,
                        IOException
Does not support HTTP Deletes - returns a 400 error. Need them so we can test they do the right thing!

Throws:
ServletException
IOException

setPersister

public void setPersister(Persister persister)
Can override the persister for testing



Copyright © 2006 Atlassian Software Systems. All Rights Reserved.