/**
- *
+ * Return a collection of all uploaded Parts.
* @return
+ * @throws IOException if an I/O error occurs
+ * @throws IllegalStateException if size limits are exceeded
+ * @throws ServletException if the request is not multipart/form-data
* @since Servlet 3.0
- * TODO SERVLET3 - Add comments
*/
- public Collection<Part> getParts() throws IOException, ServletException;
+ public Collection<Part> getParts() throws IOException,
+ IllegalStateException, ServletException;
/**
- *
+ * Gets the named Part or null if the Part does not exist. Triggers upload
+ * of all Parts.
* @param name
* @return
- * @throws IllegalArgumentException
+ * @throws IOException if an I/O error occurs
+ * @throws IllegalStateException if size limits are exceeded
+ * @throws ServletException if the request is not multipart/form-data
* @since Servlet 3.0
- * TODO SERVLET3 - Add comments
*/
- public Part getPart(String name);
+ public Part getPart(String name) throws IOException, IllegalStateException,
+ ServletException;
}
* @since Servlet 3.0
* TODO SERVLET3 - Add comments
*/
- public Collection<Part> getParts() throws IOException, ServletException {
+ public Collection<Part> getParts() throws IllegalStateException,
+ IOException, ServletException {
return this._getHttpServletRequest().getParts();
}
/**
+ * @throws ServletException
+ * @throws IOException
+ * @throws IllegalStateException
* @since Servlet 3.0
* TODO SERVLET3 - Add comments
*/
- public Part getPart(String name) {
+ public Part getPart(String name) throws IllegalStateException, IOException,
+ ServletException {
return this._getHttpServletRequest().getPart(name);
}
null, null, null);
}
- public Collection<Part> getParts() {
+ public Collection<Part> getParts() throws IOException, IllegalStateException,
+ ServletException {
// TODO SERVLET3 - file upload
return null;
}
- public Part getPart(String name) throws IllegalArgumentException {
- // TODO SERVLET3 - file upload
+ public Part getPart(String name) throws IOException, IllegalStateException,
+ ServletException {
+ Collection<Part> parts = getParts();
+ Iterator<Part> iterator = parts.iterator();
+ while (iterator.hasNext()) {
+ Part part = iterator.next();
+ if (name.equals(part.getName())) {
+ return part;
+ }
+ }
return null;
}
request.logout();
}
- public Collection<Part> getParts() {
+ public Collection<Part> getParts() throws IllegalStateException,
+ IOException, ServletException {
return request.getParts();
}
- public Part getPart(String name) {
+ public Part getPart(String name) throws IllegalStateException, IOException,
+ ServletException {
return request.getPart(name);
}