Fish & Chips Club 4.7.1.0

Package hirondelle.fish.exercise.fileupload

Overwrite the image file used on the home page.

See:
          Description

Class Summary
FileUploadFilter Wrap the underlying request using FileUploadWrapper, such that a file upload can be handled in the same way as a regular form.
FileUploadWrapper Wrapper for a file upload request.
Image Model Object for an Image.
ImageUploadAction Overwrite the image used on the home page.
 

Package hirondelle.fish.exercise.fileupload Description

Overwrite the image file used on the home page.

This feature exercises WEB4J support for file upload forms. WEB4J itself has no API related specifically to file uploads. Third party tools are necessary for implementing file upload in a WEB4J application.

This package demonstrates the use of the Apache Commons File Upload tool to implement a file upload. The generous Apache License will likely allow you to use it in your applications as well.

File upload forms are a special case, since the Servlet API has very poor support for them.

It is interesting to note that even if a single file upload control is present in a form, then all of the form's data, including that passed by controls that are not file upload controls, are not available in the usual way throught the Servlet API.

For file upload forms, the usual HttpServletRequest.getParameter(String) method does not work - for all parameters in the request, not just those related to file upload controls. It will return only null values.

As a consequence, the following will not work as well (but see below):

However, it's easy to render these items functional for file upload forms by using a wrapped request and a simple filter. That technique is used here.

See this Java World article for further information.


Fish & Chips Club 4.7.1.0

Copyright Hirondelle Systems - Generated 2011Sep24.13.57