Top Fields Constructors Methods
io.undertow.servlet.spec

public Class PartImpl

extends Object
implements Part
Class Inheritance
All Implemented Interfaces
jakarta.servlet.http.Part
Imports
io.undertow.server.handlers.form.FormData, io.undertow.servlet.UndertowServletMessages, io.undertow.util.HeaderValues, .Headers, .HttpString, java.io.ByteArrayInputStream, .IOException, .InputStream, java.nio.file.Path, .Paths, java.util.Collection, .Collections, .HashSet, .Set, jakarta.servlet.MultipartConfigElement, jakarta.servlet.http.Part

Author
Stuart Douglas

Field Summary

Modifier and TypeField and Description
private final MultipartConfigElement
private final FormData.FormValue
private final String
private final ServletContextImpl
private final HttpServletRequestImpl

Constructor Summary

AccessConstructor and Description
public
PartImpl(final String name, final FormData.FormValue formValue, MultipartConfigElement config, ServletContextImpl servletContext, HttpServletRequestImpl servletRequest)

Method Summary

Modifier and TypeMethod and Description
public void
delete()

Implements jakarta.servlet.http.Part.delete.

Deletes the underlying storage for a file item, including deleting any associated temporary disk file.

public String
getContentType()

Implements jakarta.servlet.http.Part.getContentType.

Gets the content type of this part.

public String
getHeader(final String
a String specifying the header name
name
)

Implements jakarta.servlet.http.Part.getHeader.

Returns the value of the specified mime header as a String.

public Collection<String>
getHeaderNames()

Implements jakarta.servlet.http.Part.getHeaderNames.

Gets the header names of this Part.

public Collection<String>
getHeaders(final String
the header name whose values to return
name
)

Implements jakarta.servlet.http.Part.getHeaders.

Gets the values of the Part header with the given name.

public InputStream
getInputStream()

Implements jakarta.servlet.http.Part.getInputStream.

Gets the content of this part as an InputStream

public String
getName()

Implements jakarta.servlet.http.Part.getName.

Gets the name of this part

public long
getSize()

Implements jakarta.servlet.http.Part.getSize.

Returns the size of this file.

public String
getSubmittedFileName()

Implements jakarta.servlet.http.Part.getSubmittedFileName.

Gets the file name specified by the client

public void
write(final String
The location into which the uploaded part should be stored. Relative paths are relative to jakarta.servlet.MultipartConfigElement#getLocation(). Absolute paths are used as provided.

Note

that this is a system dependent string and URI notation may not be acceptable on all systems. For portability, this string should be generated with the File or Path APIs.

fileName
)

Implements jakarta.servlet.http.Part.write.

A convenience method to write this uploaded item to disk.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

configback to summary
private final MultipartConfigElement config
formValueback to summary
private final FormData.FormValue formValue
nameback to summary
private final String name
servletContextback to summary
private final ServletContextImpl servletContext
servletRequestback to summary
private final HttpServletRequestImpl servletRequest

Constructor Detail

PartImplback to summary
public PartImpl(final String name, final FormData.FormValue formValue, MultipartConfigElement config, ServletContextImpl servletContext, HttpServletRequestImpl servletRequest)

Method Detail

deleteback to summary
public void delete() throws IOException

Implements jakarta.servlet.http.Part.delete.

Doc from jakarta.servlet.http.Part.delete.

Deletes the underlying storage for a file item, including deleting any associated temporary disk file.

Annotations
@Override
Exceptions
IOException:
if an error occurs.
getContentTypeback to summary
public String getContentType()

Implements jakarta.servlet.http.Part.getContentType.

Doc from jakarta.servlet.http.Part.getContentType.

Gets the content type of this part.

Returns:String

The content type of this part.

Annotations
@Override
getHeaderback to summary
public String getHeader(final String name)

Implements jakarta.servlet.http.Part.getHeader.

Doc from jakarta.servlet.http.Part.getHeader.

Returns the value of the specified mime header as a 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.

Parameters
name:String

a String specifying the header name

Returns:String

a String containing the value of the requested header, or null if the part does not have a header of that name

Annotations
@Override
getHeaderNamesback to summary
public Collection<String> getHeaderNames()

Implements jakarta.servlet.http.Part.getHeaderNames.

Doc from jakarta.servlet.http.Part.getHeaderNames.

Gets the header names of this 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.

Returns:Collection<String>

a (possibly empty) Collection of the header names of this Part

Annotations
@Override
getHeadersback to summary
public Collection<String> getHeaders(final String name)

Implements jakarta.servlet.http.Part.getHeaders.

Doc from jakarta.servlet.http.Part.getHeaders.

Gets the values of the Part header with the given name.

Any changes to the returned Collection must not affect this Part.

Part header names are case insensitive.

Parameters
name:String

the header name whose values to return

Returns:Collection<String>

a (possibly empty) Collection of the values of the header with the given name

Annotations
@Override
getInputStreamback to summary
public InputStream getInputStream() throws IOException

Implements jakarta.servlet.http.Part.getInputStream.

Doc from jakarta.servlet.http.Part.getInputStream.

Gets the content of this part as an InputStream

Returns:InputStream

The content of this part as an InputStream

Annotations
@Override
Exceptions
IOException:
If an error occurs in retrieving the content as an InputStream
getNameback to summary
public String getName()

Implements jakarta.servlet.http.Part.getName.

Doc from jakarta.servlet.http.Part.getName.

Gets the name of this part

Returns:String

The name of this part as a String

Annotations
@Override
getSizeback to summary
public long getSize()

Implements jakarta.servlet.http.Part.getSize.

Doc from jakarta.servlet.http.Part.getSize.

Returns the size of this file.

Returns:long

a long specifying the size of this part, in bytes.

Annotations
@Override
getSubmittedFileNameback to summary
public String getSubmittedFileName()

Implements jakarta.servlet.http.Part.getSubmittedFileName.

Doc from jakarta.servlet.http.Part.getSubmittedFileName.

Gets the file name specified by the client

Returns:String

the submitted file name

Annotations
@Override
writeback to summary
public void write(final String fileName) throws IOException

Implements jakarta.servlet.http.Part.write.

Doc from jakarta.servlet.http.Part.write.

A convenience method to write this uploaded item to disk.

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.

Parameters
fileName:String

The location into which the uploaded part should be stored. Relative paths are relative to jakarta.servlet.MultipartConfigElement#getLocation(). Absolute paths are used as provided.

Note

that this is a system dependent string and URI notation may not be acceptable on all systems. For portability, this string should be generated with the File or Path APIs.

Annotations
@Override
Exceptions
IOException:
if an error occurs.