Author: tv Date: Mon Apr 16 12:06:55 2007 New Revision: 529359 URL: http://svn.apache.org/viewvc?view=rev&rev=529359 Log: Provide a simplified method for default request parsing
Modified: jakarta/turbine/fulcrum/trunk/upload/src/java/org/apache/fulcrum/upload/DefaultUploadService.java jakarta/turbine/fulcrum/trunk/upload/src/java/org/apache/fulcrum/upload/UploadService.java Modified: jakarta/turbine/fulcrum/trunk/upload/src/java/org/apache/fulcrum/upload/DefaultUploadService.java URL: http://svn.apache.org/viewvc/jakarta/turbine/fulcrum/trunk/upload/src/java/org/apache/fulcrum/upload/DefaultUploadService.java?view=diff&rev=529359&r1=529358&r2=529359 ============================================================================== --- jakarta/turbine/fulcrum/trunk/upload/src/java/org/apache/fulcrum/upload/DefaultUploadService.java (original) +++ jakarta/turbine/fulcrum/trunk/upload/src/java/org/apache/fulcrum/upload/DefaultUploadService.java Mon Apr 16 12:06:55 2007 @@ -103,6 +103,29 @@ * compliant <code>multipart/form-data</code> stream.</p> * * @param req The servlet request to be parsed. + * @exception ServiceException Problems reading/parsing the + * request or storing the uploaded file(s). + */ + public List parseRequest(HttpServletRequest req) + throws ServiceException + { + try + { + ServletFileUpload fileUpload = new ServletFileUpload(itemFactory); + fileUpload.setSizeMax(sizeMax); + return fileUpload.parseRequest(req); + } + catch (FileUploadException e) + { + throw new ServiceException(UploadService.ROLE, e.getMessage(), e); + } + } + + /** + * <p>Parses a <a href="http://rf.cx/rfc1867.html">RFC 1867</a> + * compliant <code>multipart/form-data</code> stream.</p> + * + * @param req The servlet request to be parsed. * @param path The location where the files should be stored. * @exception ServiceException Problems reading/parsing the * request or storing the uploaded file(s). @@ -112,7 +135,8 @@ { try { - ServletFileUpload fileUpload = new ServletFileUpload(itemFactory); + DiskFileItemFactory localItemFactory = new DiskFileItemFactory(sizeThreshold, new File(path)); + ServletFileUpload fileUpload = new ServletFileUpload(localItemFactory); fileUpload.setSizeMax(sizeMax); return fileUpload.parseRequest(req); } Modified: jakarta/turbine/fulcrum/trunk/upload/src/java/org/apache/fulcrum/upload/UploadService.java URL: http://svn.apache.org/viewvc/jakarta/turbine/fulcrum/trunk/upload/src/java/org/apache/fulcrum/upload/UploadService.java?view=diff&rev=529359&r1=529358&r2=529359 ============================================================================== --- jakarta/turbine/fulcrum/trunk/upload/src/java/org/apache/fulcrum/upload/UploadService.java (original) +++ jakarta/turbine/fulcrum/trunk/upload/src/java/org/apache/fulcrum/upload/UploadService.java Mon Apr 16 12:06:55 2007 @@ -132,6 +132,17 @@ * compliant <code>multipart/form-data</code> stream.</p> * * @param req The servlet request to be parsed. + * @exception ServiceException Problems reading/parsing the + * request or storing the uploaded file(s). + */ + List parseRequest(HttpServletRequest req) + throws ServiceException; + + /** + * <p>Parses a <a href="http://rf.cx/rfc1867.html">RFC 1867</a> + * compliant <code>multipart/form-data</code> stream.</p> + * + * @param req The servlet request to be parsed. * @param path The location where the files should be stored. * @exception ServiceException Problems reading/parsing the * request or storing the uploaded file(s). --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]