Module org.eclipse.jetty.server
Package org.eclipse.jetty.server
Class MultiPartFormInputStream.MultiPart
- java.lang.Object
-
- org.eclipse.jetty.server.MultiPartFormInputStream.MultiPart
-
- All Implemented Interfaces:
jakarta.servlet.http.Part
- Enclosing class:
- MultiPartFormInputStream
public class MultiPartFormInputStream.MultiPart extends java.lang.Object implements jakarta.servlet.http.Part
-
-
Field Summary
Fields Modifier and Type Field Description protected org.eclipse.jetty.util.ByteArrayOutputStream2_boutprotected java.lang.String_contentTypeprotected java.io.File_fileprotected java.lang.String_filenameprotected org.eclipse.jetty.util.MultiMap<java.lang.String>_headersprotected java.lang.String_nameprotected java.io.OutputStream_outprotected long_sizeprotected boolean_temporary
-
Constructor Summary
Constructors Constructor Description MultiPart(java.lang.String name, java.lang.String filename)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcleanUp()Only remove tmp files.protected voidclose()protected voidcreateFile()voiddelete()Remove the file, whether or not Part.write() was called on it (ie no longer temporary)byte[]getBytes()java.lang.StringgetContentDispositionFilename()Get the filename from the content-disposition.java.lang.StringgetContentType()java.io.FilegetFile()Get the filejava.lang.StringgetHeader(java.lang.String name)java.util.Collection<java.lang.String>getHeaderNames()java.util.Collection<java.lang.String>getHeaders(java.lang.String name)java.io.InputStreamgetInputStream()java.lang.StringgetName()longgetSize()java.lang.StringgetSubmittedFileName()protected voidopen()protected voidsetContentType(java.lang.String contentType)protected voidsetHeaders(org.eclipse.jetty.util.MultiMap<java.lang.String> headers)java.lang.StringtoString()protected voidwrite(byte[] bytes, int offset, int length)protected voidwrite(int b)voidwrite(java.lang.String fileName)
-
-
-
Field Detail
-
_name
protected java.lang.String _name
-
_filename
protected java.lang.String _filename
-
_file
protected java.io.File _file
-
_out
protected java.io.OutputStream _out
-
_bout
protected org.eclipse.jetty.util.ByteArrayOutputStream2 _bout
-
_contentType
protected java.lang.String _contentType
-
_headers
protected org.eclipse.jetty.util.MultiMap<java.lang.String> _headers
-
_size
protected long _size
-
_temporary
protected boolean _temporary
-
-
Method Detail
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
setContentType
protected void setContentType(java.lang.String contentType)
-
open
protected void open() throws java.io.IOException- Throws:
java.io.IOException
-
close
protected void close() throws java.io.IOException- Throws:
java.io.IOException
-
write
protected void write(int b) throws java.io.IOException- Throws:
java.io.IOException
-
write
protected void write(byte[] bytes, int offset, int length) throws java.io.IOException- Throws:
java.io.IOException
-
write
public void write(java.lang.String fileName) throws java.io.IOException- Specified by:
writein interfacejakarta.servlet.http.Part- Throws:
java.io.IOException
-
createFile
protected void createFile() throws java.io.IOException- Throws:
java.io.IOException
-
setHeaders
protected void setHeaders(org.eclipse.jetty.util.MultiMap<java.lang.String> headers)
-
getContentType
public java.lang.String getContentType()
- Specified by:
getContentTypein interfacejakarta.servlet.http.Part
-
getHeader
public java.lang.String getHeader(java.lang.String name)
- Specified by:
getHeaderin interfacejakarta.servlet.http.Part
-
getHeaderNames
public java.util.Collection<java.lang.String> getHeaderNames()
- Specified by:
getHeaderNamesin interfacejakarta.servlet.http.Part
-
getHeaders
public java.util.Collection<java.lang.String> getHeaders(java.lang.String name)
- Specified by:
getHeadersin interfacejakarta.servlet.http.Part
-
getInputStream
public java.io.InputStream getInputStream() throws java.io.IOException- Specified by:
getInputStreamin interfacejakarta.servlet.http.Part- Throws:
java.io.IOException
-
getSubmittedFileName
public java.lang.String getSubmittedFileName()
- Specified by:
getSubmittedFileNamein interfacejakarta.servlet.http.Part
-
getBytes
public byte[] getBytes()
-
getName
public java.lang.String getName()
- Specified by:
getNamein interfacejakarta.servlet.http.Part
-
getSize
public long getSize()
- Specified by:
getSizein interfacejakarta.servlet.http.Part
-
delete
public void delete() throws java.io.IOExceptionRemove the file, whether or not Part.write() was called on it (ie no longer temporary)- Specified by:
deletein interfacejakarta.servlet.http.Part- Throws:
java.io.IOException
-
cleanUp
public void cleanUp() throws java.io.IOExceptionOnly remove tmp files.- Throws:
java.io.IOException- if unable to delete the file
-
getFile
public java.io.File getFile()
Get the file- Returns:
- the file, if any, the data has been written to.
-
getContentDispositionFilename
public java.lang.String getContentDispositionFilename()
Get the filename from the content-disposition.- Returns:
- null or the filename
-
-