groovy

Groovlets: File upload support

Details

  • Type: New Feature New Feature
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Won't Fix
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: Groovlet / GSP
  • Labels:
    None
  • Number of attachments :
    3

Description

I belive that file upload support would be a nice feature of Groovlets.

General idea:
Groovlets Servlet checks if type of HTTP request is multipart (i.e. confirms RFC 1867 (http://www.ietf.org/rfc/rfc1867.txt) . If so, it parses its content, stores files on disk and sets them as implicit objects in ServlerBinding. What is more, it decodes parameter values form multipart content and stores them in 'params' implicit object. User who develop Groovlet scripts can handle uploaded files very easy (I belive this is a general idea behind Groovy, in general).

Implementation:
It is quite easy to implement this mechanism using Commons FileUpload (http://jakarta.apache.org/commons/fileupload/) which is mature and reliable library for processing RFC 1867 multipart HTTP requests.

What do you think about this?

  1. GROOVY-895.patch
    21/Jun/05 10:06 AM
    9 kB
    Tomasz Blachowicz
  2. menu.groovy
    21/Jun/05 10:19 AM
    0.4 kB
    Tomasz Blachowicz
  3. upload.groovy
    21/Jun/05 10:19 AM
    0.8 kB
    Tomasz Blachowicz

Activity

Hide
Christian Stein added a comment -

In general, a very good idea. Not good, groovy!

Show
Christian Stein added a comment - In general, a very good idea. Not good, groovy!
Hide
Tomasz Blachowicz added a comment -

I've just implemented this feature. Have a look and lets discuss things

You should consider it as preliminary version. This implementation doesn't include any configuration, but if you accept general idea I could add some things to it.

Show
Tomasz Blachowicz added a comment - I've just implemented this feature. Have a look and lets discuss things You should consider it as preliminary version. This implementation doesn't include any configuration, but if you accept general idea I could add some things to it.
Hide
Tomasz Blachowicz added a comment -

Here are test groovlets scripts you can use to test my code.

Show
Tomasz Blachowicz added a comment - Here are test groovlets scripts you can use to test my code.
Hide
Christian Stein added a comment -

Hi Tomasz,
thanks for the implementation! On the first look, it's really well done and the two scripts look straight forward. Cool. I'll patch my working copy later this week, when I'm back home.

My only concern is the increase in external jars, we introduce into groovy-core. True, there are already many, but there are plenty more we could add in the servlet realm. Maybe, new subprojects or fragments is a good way to separate some dependencies off the core. That's another story, though. I'll carry it to the dev-list.

Cheers,
Christian

Show
Christian Stein added a comment - Hi Tomasz, thanks for the implementation! On the first look, it's really well done and the two scripts look straight forward. Cool. I'll patch my working copy later this week, when I'm back home. My only concern is the increase in external jars, we introduce into groovy-core. True, there are already many, but there are plenty more we could add in the servlet realm. Maybe, new subprojects or fragments is a good way to separate some dependencies off the core. That's another story, though. I'll carry it to the dev-list. Cheers, Christian
Hide
Guillaume Laforge added a comment -

For more advanced Groovlet usage, perhaps it'd be best to turn to a light framework like Grails?

Show
Guillaume Laforge added a comment - For more advanced Groovlet usage, perhaps it'd be best to turn to a light framework like Grails?

People

Vote (1)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: