SK.gnome.dwarf.http.servlet
Class UploadServlet

java.lang.Object
  extended byjavax.servlet.GenericServlet
      extended byjavax.servlet.http.HttpServlet
          extended bySK.gnome.dwarf.http.servlet.UploadServlet
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class UploadServlet
extends javax.servlet.http.HttpServlet

This servlet handles the form-based file uploads. To upload a file to the server via the HTTP protocol you can use this servlet. The servlet should be invoked from a special HTML form. The <form ...> HTML element must have the action attribute equal to "POST" and the enctype attribute equal to "multipart/form-data". One of the form input fields must be of type file with its name attribute equal to "localFile" string.

The following parameters can be provided to UploadServlet, either via the query string or via the form input elements:

A typicall file-uploading form might look like this:
 <form method="POST" action="/upload" enctype="multipart/form-data">
   <input type="hidden" name="remoteDir" value="/tmp">
   <input type="hidden" name="successPage" value="/upload_ok.html">
   <input type="hidden" name="errorPage" value="/upload_error.html">
   <input type="file" name="localFile">
   <input type="submit" name="submit" value="OK">
 </form>
 

After the server processes the multipart/form-data request body the following information can be obtained from the request, assuming that the file form input element is named "localFile":

See Also:
Serialized Form

Constructor Summary
UploadServlet()
           
 
Method Summary
protected  void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
 java.lang.String getServletInfo()
           
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doOptions, doPut, doTrace, getLastModified, service, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, 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

UploadServlet

public UploadServlet()
Method Detail

getServletInfo

public java.lang.String getServletInfo()

doPost

protected void doPost(javax.servlet.http.HttpServletRequest request,
                      javax.servlet.http.HttpServletResponse response)
               throws java.io.IOException,
                      javax.servlet.ServletException
Throws:
java.io.IOException
javax.servlet.ServletException


Copyright (c) 1999-2005, Gnome Ltd. All rights reserved.