Constructor and Description |
---|
PartImpl(String name,
FormData.FormValue formValue,
MultipartConfigElement config,
ServletContextImpl servletContext,
HttpServletRequestImpl servletRequest) |
Modifier and Type | Method and Description |
---|---|
void |
delete()
Deletes the underlying storage for a file item, including deleting any
associated temporary disk file.
|
String |
getContentType()
Gets the content type of this part.
|
String |
getHeader(String name)
Returns the value of the specified mime header
as a
String . |
Collection<String> |
getHeaderNames()
Gets the header names of this Part.
|
Collection<String> |
getHeaders(String name)
Gets the values of the Part header with the given name.
|
InputStream |
getInputStream()
Gets the content of this part as an InputStream
|
String |
getName()
Gets the name of this part
|
long |
getSize()
Returns the size of this fille.
|
String |
getSubmittedFileName()
Gets the file name specified by the client
|
void |
write(String fileName)
A convenience method to write this uploaded item to disk.
|
public PartImpl(String name, FormData.FormValue formValue, MultipartConfigElement config, ServletContextImpl servletContext, HttpServletRequestImpl servletRequest)
public InputStream getInputStream() throws IOException
Part
getInputStream
in interface Part
IOException
- If an error occurs in retrieving the contet
as an InputStreampublic String getContentType()
Part
getContentType
in interface Part
public String getSubmittedFileName()
Part
getSubmittedFileName
in interface Part
public long getSize()
Part
public void write(String fileName) throws IOException
Part
This method is not guaranteed to succeed if called more than once for the same part. This allows a particular implementation to use, for example, file renaming, where possible, rather than copying all of the underlying data, thus gaining a significant performance benefit.
write
in interface Part
fileName
- the name of the file to which the stream will be
written. The file is created relative to the location as
specified in the MultipartConfigIOException
- if an error occurs.public void delete() throws IOException
Part
delete
in interface Part
IOException
- if an error occurs.public String getHeader(String name)
Part
String
. If the Part did not include a header
of the specified name, this method returns null
.
If there are multiple headers with the same name, this method
returns the first header in the part.
The header name is case insensitive. You can use
this method with any request header.public Collection<String> getHeaders(String name)
Part
Any changes to the returned Collection
must not
affect this Part
.
Part header names are case insensitive.
getHeaders
in interface Part
name
- the header name whose values to returnCollection
of the values of
the header with the given namepublic Collection<String> getHeaderNames()
Part
Some servlet containers do not allow
servlets to access headers using this method, in
which case this method returns null
Any changes to the returned Collection
must not
affect this Part
.
getHeaderNames
in interface Part
Collection
of the header
names of this PartCopyright © 2017 JBoss by Red Hat. All rights reserved.