public static class HTTPServer.MultipartIterator extends Object implements Iterator<HTTPServer.MultipartIterator.Part>
MultipartIterator iterates over the parts of a multipart/form-data request.
For example, to support file upload from a web browser:
HTTPServer.VirtualHost.addContext(java.lang.String, net.freeutils.httpserver.HTTPServer.ContextHandler, java.lang.String...) method or the HTTPServer.Context annotation.
MultipartIterator from
the client Request.
HTTPServer.MultipartIterator.Parts, processing each named field as appropriate -
for the file input field, read the uploaded file using the body input stream.
| Modifier and Type | Class and Description |
|---|---|
static class |
HTTPServer.MultipartIterator.Part
The
Part class encapsulates a single part of the multipart. |
| Modifier and Type | Field and Description |
|---|---|
protected HTTPServer.MultipartInputStream |
in |
protected boolean |
next |
| Constructor and Description |
|---|
MultipartIterator(HTTPServer.Request req)
Creates a new MultipartIterator from the given request.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
hasNext() |
HTTPServer.MultipartIterator.Part |
next() |
void |
remove() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEachRemainingprotected final HTTPServer.MultipartInputStream in
protected boolean next
public MultipartIterator(HTTPServer.Request req) throws IOException
req - the multipart/form-data requestIOException - if an IO error occursIllegalArgumentException - if the given request's content type
is not multipart/form-data, or is missing the boundarypublic boolean hasNext()
hasNext in interface Iterator<HTTPServer.MultipartIterator.Part>public HTTPServer.MultipartIterator.Part next()
next in interface Iterator<HTTPServer.MultipartIterator.Part>public void remove()
remove in interface Iterator<HTTPServer.MultipartIterator.Part>Copyright © 2021 freeutils.net. All rights reserved.