class ApacheMultiPartManager implements MultiPartManager {

    @Override
    public Part getPart(WebApplication webApplication,
            WebApplicationRequest request, String name) throws ServletException {

        ApacheMultiPart result = null;
        LOGGER.log(FINE, "Getting part: {0} for request: {1}",
                new Object[]{name, request});
        if (ServletFileUpload.isMultipartContent(request)) {
            try {
                ServletFileUpload upload = setupFileUpload(webApplication);
                List<FileItem> items = upload.parseRequest(request);
                for (FileItem item : items) {
                    if (item.getName().equals(name)) {
                        result = new ApacheMultiPart(item);
                        break;
                    }
                }
            } catch (FileUploadException fue) {
                LOGGER.log(WARNING, "Error getting part", fue);
            }
        } else {
            throw new ServletException("Not a multipart/form-data request");
        }
        return result;
    }

}