Wednesday 15 September 2010

Grails 2.4 limit/max upload size -


Regarding

I can not work on grails 2.4.

I for my Grails application it added:

resources.groovy

  bean = {multipartResolver (CustomMultipartResolver) {maxUploadSize = 2000000}}  

added to BootStrap.groovy

  public class custom multipart Risolr Commons multipart revolver extended {static final string FILE_SIZE_EXCEEDED_ERROR = "file Size overtake" public multilateral HTTPPS service options configuration (HttpServletRequest request) {Return Super.Rolloval Multipart (request)} Catch (I Xploaded cumulative accessed option e) {Request.setAttribute (new FILE_SIZE_EXCEEDED_ERROR, new) return to ervletRequest (request new LinkedMultiValueMap (), [:])}}}  

in the controller:

  if (request.getAttribute (CustomMultipartResolver. FILE_SIZE_EXCEEDED_ERROR)) {ModActionFile.errors.reject ( "MyDomain.fileSizeTooLarge") redirect (controller: "MyDomain", action ' Create ', parameter: parameter)} else {...  

I get this error

  error | 2015/03/17 16: 08: 57,794 [http-Bio8080-Executive -8] error [/tool ​​].[default] - Servlet.service () path [/ tool] with servlet for [default] for reference threw exception message: could not find a matching manufacturer: org.springframework.web.multipart.support.DefaultMultipartHttpServletRequest (org.apache.catalina.connector.RequestFacade, org.springframework.util.LinkedMultiValueMap, java.util.LinkedHashMap) line | Method - & gt; & Gt; 43 | Resolution Multipart Custom MultiPart $$ EP7CaraR - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 1145 | Run worker in Java.util.concurrent.ThreadPoolExecutor | 615 | Run . . . . . Java.util.concurrent.ThreadPoolExecutor $ Worker ^ 745 | Walk in Java.lang.  

2008 was a long time ago.

The error message is very clear - you are either mistakenly going to the constructor or the wrong number of debates.

Grails uses 2.4.4 spring 4.0.7 and two constructors in that class:

  public default multipart HTTPViewerTableVest (HTTPArlet Request Request, Multivimate and Lieutenant; string , Maltipartfail & gt; Mpifailen, Map & lt; string, string [] & gt; Mpeepiaram, Map & lt; string, string & gt; Mpeepiaramsiontent type)  

and

  public def Ustmultiarttttttttapartel request (htmlpsarlet request)  

which you can see.

This class should work:

  Class CustomMultipartResolver extends CommonsMultipartResolver {Fixed final string FILE_SIZE_EXCEEDED_ERROR = 'fileSizeExceeded' MultipartHttpServletRequest resolveMultipart (HttpServletRequest request) {try {Super.resolveMultipart request} (MaxUploadSizeExceededException e) {request.FILE_SIZE_EXCEEDED_ERROR = Correct New DefaultMultipartHttpServletRequest (Request, New Linkedity Validemap (), [:], [:])} Catch (Size Limited Accepted E) {request.FILE_SIZE_EXCEEDED_ERROR = True New Default MultipartHttpServletRequest (Request, New Linkedity ValuesMap (), [:], [:])}}}  

No comments:

Post a Comment