Top Description Inners Constructors Methods
org.eclipse.jetty.ee10.servlet

public Class ServletMultiPartFormData

extends Object
Class Inheritance
Imports
java.io.File, .IOException, .InputStream, java.nio.file.Files, .Path, java.util.ArrayList, .Collection, .List, java.util.concurrent.CompletableFuture, jakarta.servlet.MultipartConfigElement, .ServletRequest, jakarta.servlet.http.Part, org.eclipse.jetty.http.ComplianceViolation, .HttpField, .HttpHeader, .MimeTypes, .MultiPart, .MultiPartFormData, org.eclipse.jetty.io.AbstractConnection, .ByteBufferPool, .Connection, .Content, org.eclipse.jetty.io.content.InputStreamContentSource, org.eclipse.jetty.server.ConnectionMetaData, .HttpChannel, org.eclipse.jetty.util.StringUtil

Servlet specific class for multipart content support.

Use from(ServletRequest) to parse multipart request content into a Parts object that can be used to access Servlet Part objects.

See Also
Parts

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
ServletMultiPartFormData.Parts

An ordered list of Parts that can be accessed by name.

private static class

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static CompletableFuture<ServletMultiPartFormData.Parts>

Returns:

A future ServletMultiPartFormData.Parts, which may have already been created and/or completed.
from
(ServletRequest
A servlet request
servletRequest
)

Get future ServletMultiPartFormData.Parts from a servlet request.

public static CompletableFuture<ServletMultiPartFormData.Parts>

Returns:

A future ServletMultiPartFormData.Parts, which may have already been created and/or completed.
from
(ServletRequest
A servlet request
servletRequest
,
String
The contentType, passed as an optimization as it has likely already been retrieved.
contentType
)

Get future ServletMultiPartFormData.Parts from a servlet request.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

ServletMultiPartFormDataback to summary
public ServletMultiPartFormData()

Method Detail

fromback to summary
public static CompletableFuture<ServletMultiPartFormData.Parts> from(ServletRequest servletRequest)

Get future ServletMultiPartFormData.Parts from a servlet request.

Parameters
servletRequest:ServletRequest

A servlet request

Returns:CompletableFuture<ServletMultiPartFormData.Parts>

A future ServletMultiPartFormData.Parts, which may have already been created and/or completed.

See Also
from(ServletRequest, String)
fromback to summary
public static CompletableFuture<ServletMultiPartFormData.Parts> from(ServletRequest servletRequest, String contentType)

Get future ServletMultiPartFormData.Parts from a servlet request.

Parameters
servletRequest:ServletRequest

A servlet request

contentType:String

The contentType, passed as an optimization as it has likely already been retrieved.

Returns:CompletableFuture<ServletMultiPartFormData.Parts>

A future ServletMultiPartFormData.Parts, which may have already been created and/or completed.

org.eclipse.jetty.ee10.servlet back to summary

public Class ServletMultiPartFormData.Parts

extends Object
Class Inheritance
  • java.lang.Object
  • org.eclipse.jetty.ee10.servlet.ServletMultiPartFormData.Parts

An ordered list of Parts that can be accessed by name.

Field Summary

Modifier and TypeField and Description
private final List<Part>

Constructor Summary

AccessConstructor and Description
public
Parts(Path directory, MultiPartFormData.Parts parts)

Method Summary

Modifier and TypeMethod and Description
public Part
public Collection<Part>
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

partsback to summary
private final List<Part> parts

Constructor Detail

Partsback to summary
public Parts(Path directory, MultiPartFormData.Parts parts)

Method Detail

getPartback to summary
public Part getPart(String name)
getPartsback to summary
public Collection<Part> getParts()
org.eclipse.jetty.ee10.servlet back to summary

private Class ServletMultiPartFormData.ServletPart

extends Object
implements Part
Class Inheritance
  • java.lang.Object
  • org.eclipse.jetty.ee10.servlet.ServletMultiPartFormData.ServletPart
All Implemented Interfaces
jakarta.servlet.http.Part

Field Summary

Modifier and TypeField and Description
private final Path
private final MultiPart.Part

Constructor Summary

AccessConstructor and Description
private
ServletPart(Path directory, MultiPart.Part part)

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(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(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 String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
public void
write(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:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

_directoryback to summary
private final Path _directory
_partback to summary
private final MultiPart.Part _part

Constructor Detail

ServletPartback to summary
private ServletPart(Path directory, MultiPart.Part part)

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(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(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
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override
writeback to summary
public void write(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.