jmri.web.miniserver.servlet.fileservlet
Class FileServlet

java.lang.Object
  extended by jmri.web.miniserver.AbstractServlet
      extended by jmri.web.miniserver.servlet.fileservlet.FileServlet
All Implemented Interfaces:
javax.servlet.Servlet, javax.servlet.ServletConfig

public class FileServlet
extends AbstractServlet

A simple HTTP servlet that returns the contents of a file. The MIME type is taken from a property file, as is the path map.

Parts taken from Core Web Programming from Prentice Hall and Sun Microsystems Press, http://www.corewebprogramming.com/. © 2001 Marty Hall and Larry Brown; may be freely used or adapted.

Author:
Modifications by Bob Jacobsen Copyright 2008

Field Summary
 
Fields inherited from class jmri.web.miniserver.AbstractServlet
maxRequestLines
 
Constructor Summary
FileServlet()
           
 
Method Summary
protected  void copyFileContent(String from, OutputStream out)
           
protected  void createDirectoryContent(String filename, OutputStream out)
           
 void destroy()
           
 javax.servlet.ServletConfig getServletConfig()
           
 String getServletInfo()
           
 void init(javax.servlet.ServletConfig config)
           
protected  void printHeader(PrintWriter out, String mimeType, String responseStatus)
           
protected  void printHeader(PrintWriter out, String mimeType, String responseStatus, Date fileDate)
           
protected  void printHeader(PrintWriter out, String mimeType, String responseStatus, Date fileDate, long fileSize)
           
 void service(javax.servlet.ServletRequest req, javax.servlet.ServletResponse res)
           
 
Methods inherited from class jmri.web.miniserver.AbstractServlet
getInitParameter, getInitParameterNames, getInputLines, getRequest, getServletContext, getServletName
 
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

service

public void service(javax.servlet.ServletRequest req,
                    javax.servlet.ServletResponse res)
             throws IOException
Specified by:
service in interface javax.servlet.Servlet
Specified by:
service in class AbstractServlet
Throws:
IOException

destroy

public void destroy()
Specified by:
destroy in interface javax.servlet.Servlet
Overrides:
destroy in class AbstractServlet

init

public void init(javax.servlet.ServletConfig config)
Specified by:
init in interface javax.servlet.Servlet
Overrides:
init in class AbstractServlet

getServletInfo

public String getServletInfo()
Specified by:
getServletInfo in interface javax.servlet.Servlet
Overrides:
getServletInfo in class AbstractServlet

getServletConfig

public javax.servlet.ServletConfig getServletConfig()
Specified by:
getServletConfig in interface javax.servlet.Servlet
Overrides:
getServletConfig in class AbstractServlet

copyFileContent

protected void copyFileContent(String from,
                               OutputStream out)
                        throws IOException
Throws:
IOException

createDirectoryContent

protected void createDirectoryContent(String filename,
                                      OutputStream out)
                               throws IOException
Throws:
IOException

printHeader

protected void printHeader(PrintWriter out,
                           String mimeType,
                           String responseStatus)

printHeader

protected void printHeader(PrintWriter out,
                           String mimeType,
                           String responseStatus,
                           Date fileDate)

printHeader

protected void printHeader(PrintWriter out,
                           String mimeType,
                           String responseStatus,
                           Date fileDate,
                           long fileSize)


Copyright © 1997 - 2011 JMRI Community.
JMRI, DecoderPro, PanelPro, SoundPro, DispatcherPro and associated logos are our trademarks.

Additional information on copyright, trademarks and licenses is linked here.
Site hosted by: Get JMRI Model Railroad Interface at SourceForge.net. Fast, secure and Free Open Source software downloads