Java Doc for MultipartParser.java in  » Groupware » hipergate » com » oreilly » servlet » multipart » 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 » Groupware » hipergate » com.oreilly.servlet.multipart 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.oreilly.servlet.multipart.MultipartParser

MultipartParser
public class MultipartParser (Code)
A utility class to handle multipart/form-data requests, the kind of requests that support file uploads. This class uses a "pull" model where the reading of incoming files and parameters is controlled by the client code, which allows incoming files to be stored into any OutputStream. If you wish to use an API which resembles HttpServletRequest, use the "push" model MultipartRequest instead. It's an easy-to-use wrapper around this class.

This class can receive arbitrarily large files (up to an artificial limit you can set), and fairly efficiently too. It cannot handle nested data (multipart content within multipart content). It can now with the latest release handle internationalized content (such as non Latin-1 filenames).

It also optionally includes enhanced buffering and Content-Length limitation. Buffering is only required if your servlet container is poorly implemented (many are, including Tomcat 3.2), but it is generally recommended because it will make a slow servlet container a lot faster, and will only make a fast servlet container a little slower. Content-Length limiting is usually only required if you find that your servlet is hanging trying to read the input stram from the POST, and it is similarly recommended because it only has a minimal impact on performance.

See the included upload.war for an example of how to use this class.

The full file upload specification is contained in experimental RFC 1867, available at http://www.ietf.org/rfc/rfc1867.txt.
See Also:   com.oreilly.servlet.MultipartRequest
author:
   Jason Hunter
author:
   Geoff Soutter
version:
   1.11, 2002/11/01, added constructor that takes an encoding, to
version:
   make sure chars are always read correctly
version:
   1.10, 2002/11/01, added support for a preamble before the first
version:
   boundary marker
version:
   1.9, 2002/11/01, added support to parse odd Opera Content-Type
version:
   1.8, 2002/11/01, added support for lynx with unquoted param vals
version:
   1.7, 2002/04/30, fixed bug if a line was '\n' alone
version:
   1.6, 2002/04/30, added better internationalization support, thanks
version:
   to Changshin Lee
version:
   1.5, 2002/04/30, added Opera header fix, thanks to Nic Ferrier
version:
   1.4, 2001/03/23, added IE5 bug workaround supporting \n as line
version:
   ending, thanks to Michael Alyn Miller
version:
   1.3, 2001/01/22, added support for boundaries surrounded by quotes
version:
   and content-disposition after content-type,
version:
   thanks to Scott Stark
version:
   1.2, 2001/01/22, getFilePath() support thanks to Stefan Eissing
version:
   1.1, 2000/10/29, integrating old WebSphere fix
version:
   1.0, 2000/10/27, initial revision




Constructor Summary
public  MultipartParser(HttpServletRequest req, int maxSize)
     Creates a MultipartParser from the specified request, which limits the upload size to the specified length, buffers for performance and prevent attempts to read past the amount specified by the Content-Length.
public  MultipartParser(HttpServletRequest req, int maxSize, boolean buffer, boolean limitLength)
     Creates a MultipartParser from the specified request, which limits the upload size to the specified length, and optionally buffers for performance and prevents attempts to read past the amount specified by the Content-Length.
public  MultipartParser(HttpServletRequest req, int maxSize, boolean buffer, boolean limitLength, String encoding)
     Creates a MultipartParser from the specified request, which limits the upload size to the specified length, and optionally buffers for performance and prevents attempts to read past the amount specified by the Content-Length, and with a specified encoding.

Method Summary
public  PartreadNextPart()
     Read the next part arriving in the stream.
public  voidsetEncoding(String encoding)
     Sets the encoding used to parse from here onward.


Constructor Detail
MultipartParser
public MultipartParser(HttpServletRequest req, int maxSize) throws IOException(Code)
Creates a MultipartParser from the specified request, which limits the upload size to the specified length, buffers for performance and prevent attempts to read past the amount specified by the Content-Length.
Parameters:
  req - the servlet request.
Parameters:
  maxSize - the maximum size of the POST content.



MultipartParser
public MultipartParser(HttpServletRequest req, int maxSize, boolean buffer, boolean limitLength) throws IOException(Code)
Creates a MultipartParser from the specified request, which limits the upload size to the specified length, and optionally buffers for performance and prevents attempts to read past the amount specified by the Content-Length.
Parameters:
  req - the servlet request.
Parameters:
  maxSize - the maximum size of the POST content.
Parameters:
  buffer - whether to do internal buffering or let the server buffer,useful for servers that don't buffer
Parameters:
  limitLength - boolean flag to indicate if we need to filter the request's input stream to prevent trying to read past the end of the stream.



MultipartParser
public MultipartParser(HttpServletRequest req, int maxSize, boolean buffer, boolean limitLength, String encoding) throws IOException(Code)
Creates a MultipartParser from the specified request, which limits the upload size to the specified length, and optionally buffers for performance and prevents attempts to read past the amount specified by the Content-Length, and with a specified encoding.
Parameters:
  req - the servlet request.
Parameters:
  maxSize - the maximum size of the POST content.
Parameters:
  buffer - whether to do internal buffering or let the server buffer,useful for servers that don't buffer
Parameters:
  limitLength - boolean flag to indicate if we need to filter the request's input stream to prevent trying to read past the end of the stream.
Parameters:
  encoding - the encoding to use for parsing, default is ISO-8859-1.




Method Detail
readNextPart
public Part readNextPart() throws IOException(Code)
Read the next part arriving in the stream. Will be either a FilePart or a ParamPart, or null to indicate there are no more parts to read. The order of arrival corresponds to the order of the form elements in the submitted form. either a FilePart, a ParamPart ornull if there are no more parts to read.
exception:
  IOException - if an input or output exception has occurred.
See Also:   FilePart
See Also:   ParamPart



setEncoding
public void setEncoding(String encoding)(Code)
Sets the encoding used to parse from here onward. The default is ISO-8859-1. Encodings are actually best passed into the contructor, so even the initial line reads are correct.
Parameters:
  encoding - The encoding to use for parsing



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.