Java Doc for FileUploadBase.java in  » Forum » JForum-2.1.8 » net » jforum » util » legacy » commons » fileupload » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Forum » JForum 2.1.8 » net.jforum.util.legacy.commons.fileupload 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   net.jforum.util.legacy.commons.fileupload.FileUploadBase

All known Subclasses:   net.jforum.util.legacy.commons.fileupload.DiskFileUpload,  net.jforum.util.legacy.commons.fileupload.FileUpload,
FileUploadBase
abstract public class FileUploadBase (Code)

High level API for processing file uploads.

This class handles multiple files per single HTML widget, sent using multipart/mixed encoding type, as specified by RFC 1867. Use FileUploadBase.parseRequest(HttpServletRequest) to acquire a list of org.apache.commons.fileupload.FileItem s associated with a given HTML widget.

How the data for individual parts is stored is determined by the factory used to create them; a given part may be in memory, on disk, or somewhere else.


author:
   Rafal Krzewski
author:
   Daniel Rall
author:
   Jason van Zyl
author:
   John McNally
author:
   Martin Cooper
author:
   Sean C. Sullivan
version:
   $Id: FileUploadBase.java,v 1.3 2005/07/26 03:05:02 rafaelsteil Exp $

Inner Class :public static class InvalidContentTypeException extends FileUploadException
Inner Class :public static class UnknownSizeException extends FileUploadException
Inner Class :public static class SizeLimitExceededException extends FileUploadException

Field Summary
final public static  StringATTACHMENT
     Content-disposition value for file attachment.
final public static  StringCONTENT_DISPOSITION
     HTTP content disposition header name.
final public static  StringCONTENT_TYPE
     HTTP content type header name.
final public static  StringFORM_DATA
     Content-disposition value for form data.
final public static  intMAX_HEADER_SIZE
     The maximum length of a single header line that will be parsed (1024 bytes).
final public static  StringMULTIPART
     Part of HTTP content type header.
final public static  StringMULTIPART_FORM_DATA
     HTTP content type header for multipart forms.
final public static  StringMULTIPART_MIXED
     HTTP content type header for multiple uploads.


Method Summary
protected  FileItemcreateItem(Map headers, boolean isFormField)
     Creates a new FileItem instance.
Parameters:
  headers - A Map containing the HTTP requestheaders.
Parameters:
  isFormField - Whether or not this item is a form field, asopposed to a file.
protected  byte[]getBoundary(String contentType)
     Retrieves the boundary from the Content-type header.
Parameters:
  contentType - The value of the content type header from which toextract the boundary value.
protected  StringgetFieldName(Map headers)
     Retrieves the field name from the Content-disposition header.
Parameters:
  headers - A Map containing the HTTP request headers.
abstract public  FileItemFactorygetFileItemFactory()
     Returns the factory class used when creating file items.
protected  StringgetFileName(Map headers)
     Retrieves the file name from the Content-disposition header.
Parameters:
  headers - A Map containing the HTTP request headers.
final protected  StringgetHeader(Map headers, String name)
     Returns the header with the specified name from the supplied map.
public  StringgetHeaderEncoding()
     Retrieves the character encoding used when reading the headers of an individual part.
public  longgetSizeMax()
     Returns the maximum allowed upload size.
final public static  booleanisMultipartContent(RequestContext ctx)
    

Utility method that determines whether the request contains multipart content.

NOTE:This method will be moved to the ServletFileUpload class after the FileUpload 1.1 release. Unfortunately, since this method is static, it is not possible to provide its replacement until this method is removed.


Parameters:
  ctx - The request context to be evaluated.
final public static  booleanisMultipartContent(HttpServletRequest req)
     Utility method that determines whether the request contains multipart content.
Parameters:
  req - The servlet request to be evaluated.
protected  MapparseHeaders(String headerPart)
    

Parses the header-part and returns as key/value pairs.

If there are multiple headers of the same names, the name will map to a comma-separated list containing the values.
Parameters:
  headerPart - The header-part of the currentencapsulation.

public  ListparseRequest(HttpServletRequest req)
     Processes an RFC 1867 compliant multipart/form-data stream.
Parameters:
  req - The servlet request to be parsed.
public  ListparseRequest(RequestContext ctx)
     Processes an RFC 1867 compliant multipart/form-data stream.
Parameters:
  ctx - The context for the request to be parsed.
abstract public  voidsetFileItemFactory(FileItemFactory factory)
     Sets the factory class to use when creating file items.
public  voidsetHeaderEncoding(String encoding)
     Specifies the character encoding to be used when reading the headers of individual parts.
public  voidsetSizeMax(long sizeMax)
     Sets the maximum allowed upload size.

Field Detail
ATTACHMENT
final public static String ATTACHMENT(Code)
Content-disposition value for file attachment.



CONTENT_DISPOSITION
final public static String CONTENT_DISPOSITION(Code)
HTTP content disposition header name.



CONTENT_TYPE
final public static String CONTENT_TYPE(Code)
HTTP content type header name.



FORM_DATA
final public static String FORM_DATA(Code)
Content-disposition value for form data.



MAX_HEADER_SIZE
final public static int MAX_HEADER_SIZE(Code)
The maximum length of a single header line that will be parsed (1024 bytes).



MULTIPART
final public static String MULTIPART(Code)
Part of HTTP content type header.



MULTIPART_FORM_DATA
final public static String MULTIPART_FORM_DATA(Code)
HTTP content type header for multipart forms.



MULTIPART_MIXED
final public static String MULTIPART_MIXED(Code)
HTTP content type header for multiple uploads.





Method Detail
createItem
protected FileItem createItem(Map headers, boolean isFormField)(Code)
Creates a new FileItem instance.
Parameters:
  headers - A Map containing the HTTP requestheaders.
Parameters:
  isFormField - Whether or not this item is a form field, asopposed to a file. A newly created FileItem instance.
exception:
  FileUploadException - if an error occurs.



getBoundary
protected byte[] getBoundary(String contentType)(Code)
Retrieves the boundary from the Content-type header.
Parameters:
  contentType - The value of the content type header from which toextract the boundary value. The boundary, as a byte array.



getFieldName
protected String getFieldName(Map headers)(Code)
Retrieves the field name from the Content-disposition header.
Parameters:
  headers - A Map containing the HTTP request headers. The field name for the current encapsulation.



getFileItemFactory
abstract public FileItemFactory getFileItemFactory()(Code)
Returns the factory class used when creating file items. The factory class for new file items.



getFileName
protected String getFileName(Map headers)(Code)
Retrieves the file name from the Content-disposition header.
Parameters:
  headers - A Map containing the HTTP request headers. The file name for the current encapsulation.



getHeader
final protected String getHeader(Map headers, String name)(Code)
Returns the header with the specified name from the supplied map. The header lookup is case-insensitive.
Parameters:
  headers - A Map containing the HTTP request headers.
Parameters:
  name - The name of the header to return. The value of specified header, or a comma-separated list ifthere were multiple headers of that name.



getHeaderEncoding
public String getHeaderEncoding()(Code)
Retrieves the character encoding used when reading the headers of an individual part. When not specified, or null, the platform default encoding is used. The encoding used to read part headers.



getSizeMax
public long getSizeMax()(Code)
Returns the maximum allowed upload size. The maximum allowed size, in bytes.
See Also:   FileUploadBase.setSizeMax(long)



isMultipartContent
final public static boolean isMultipartContent(RequestContext ctx)(Code)

Utility method that determines whether the request contains multipart content.

NOTE:This method will be moved to the ServletFileUpload class after the FileUpload 1.1 release. Unfortunately, since this method is static, it is not possible to provide its replacement until this method is removed.


Parameters:
  ctx - The request context to be evaluated. Must be non-null. true if the request is multipart;false otherwise.



isMultipartContent
final public static boolean isMultipartContent(HttpServletRequest req)(Code)
Utility method that determines whether the request contains multipart content.
Parameters:
  req - The servlet request to be evaluated. Must be non-null. true if the request is multipart;false otherwise.



parseHeaders
protected Map parseHeaders(String headerPart)(Code)

Parses the header-part and returns as key/value pairs.

If there are multiple headers of the same names, the name will map to a comma-separated list containing the values.
Parameters:
  headerPart - The header-part of the currentencapsulation. A Map containing the parsed HTTP request headers.




parseRequest
public List parseRequest(HttpServletRequest req) throws FileUploadException(Code)
Processes an RFC 1867 compliant multipart/form-data stream.
Parameters:
  req - The servlet request to be parsed. A list of FileItem instances parsed from therequest, in the order that they were transmitted.
exception:
  FileUploadException - if there are problems reading/parsingthe request or storing files.



parseRequest
public List parseRequest(RequestContext ctx) throws FileUploadException(Code)
Processes an RFC 1867 compliant multipart/form-data stream.
Parameters:
  ctx - The context for the request to be parsed. A list of FileItem instances parsed from therequest, in the order that they were transmitted.
exception:
  FileUploadException - if there are problems reading/parsingthe request or storing files.



setFileItemFactory
abstract public void setFileItemFactory(FileItemFactory factory)(Code)
Sets the factory class to use when creating file items.
Parameters:
  factory - The factory class for new file items.



setHeaderEncoding
public void setHeaderEncoding(String encoding)(Code)
Specifies the character encoding to be used when reading the headers of individual parts. When not specified, or null, the platform default encoding is used.
Parameters:
  encoding - The encoding used to read part headers.



setSizeMax
public void setSizeMax(long sizeMax)(Code)
Sets the maximum allowed upload size. If negative, there is no maximum.
Parameters:
  sizeMax - The maximum allowed size, in bytes, or -1 for no maximum.
See Also:   FileUploadBase.getSizeMax()



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.