Skip to main content

So Far Away

Posted by editor on February 9, 2006 at 10:05 AM EST

Overcoming the browser upload problem

A long time ago, I actually wrote a servlet to parse a multipart http form request and handle a multi-megabyte file upload. It was miserable, because the multipart format isn't particularly well optimized to this -- if only each part had a content size, I wouldn't have had to scan the buffer every time for the end-of-part string.

It worked, but given that the browser would just sit there, not doing anything until the upload was finished, we threw it away and I wrote an FTP uplaod applet instead. That led to a whole host of new problems (applet security, versioning, plug-ins, etc.). This was a job that was just never going to make anyone happy.

In the intervening years, others have approached the problem and worked out some nice solutions that make life easier for developers with this need. The Apache Commons' File Upload project takes care of the parsing, so now all you need is a way to fix the user experience problem...

In today's Feature Article, Jacobus Steenkamp solves this side of the equation. In Better File Uploads with AJAX and JavaServer Faces, he shows how to "take a fresh approach and implement an AJAX-powered component that will not only upload the file to the server, but also monitor the actual progress of a file upload request in 'real time.'" There's some nice server-side stuff in this approach to catch calls from the AJAX side and return just a small amount of XML, which the JavaScript can use to repaint the progress bar.

If you're planning on letting users upload large files, take a look at this approach and see what you think.


In Projects and Communities, the Equinox project on jini.org is an effort to "develop a Jini-based container for the Spring framework. The container implementation will transparently leverage Jini's service discovery, transaction management and fault tolerance, and will facilitate the application's use of characteristic features like JavaSpaces."

The Java Communications Community is featuring the paper A SEA Change towards IP Convergence (PDF) by Rakesh Radhakrishnan, which attempts to align major industry standards Initiatives within the "Communications Media and Entertainment" (CME) industry: wireless, telco, cable, etc.


Michael Nascimento Santos says Tiger and dates don't get along in today's Weblogs: "I've been testing a large application we have written for one of customers in Tiger and I couldn't be more disappointed by how Java 5 broke support for dates in general. If you intend to upgrade your application to Tiger or if you are using it to manipulate dates, you should be aware of these issues."

Is JSF More Performant than Action Frameworks? Jacob Hookom writes: "Everyone assumes JSF adds overhead to application processing on the web versus something like Struts or WebWork. Reflecting on experience, I think JSF can actually be a lot faster than those solutions."

Kirill Grouchnikov relates "a story of how a commercial vendor has contributed one of its Swing components to the open-source community" in Breadcrumb bar - from closed source to open source.


In Also in Java Today, Ken Pugh's Prefactoring and Refactoring "hopes to clarify the issues" around "prefactoring", a concept that evolved from a BoF session with Pugh, Ron Jeffries, and Martin Fowler. The big difference is that "prefactoring guidelines emphasize things to think about before you start coding. Refactorings are code transformations performed after you have created code." Pugh argues this is not a matter of a "big design up front", but rather a set of guidelines to be applied before coding, in order to create better code.

As Mustang attempts to further narrow the gap between Java SE applications and native desktop applications, the SDN article Using the Desktop API in Java SE 6 (Mustang) "describes the new Desktop API, which allows Java applications to interact with the default applications associated with specific file types on the host platform. In order to describe the API more effectively, the article also features a simple application called DesktopDemo."


In today's Forums, jada responds to a question about JUnit and Java 3D in Re: No unit tests?: "We did, at one point, talk about developing JUnit tests for Java 3D but decided it might be a good community project. At present, we rely on combination of test suites and programs for regression testing, such as Java 3D TCK, an inhouse Java 3D functional test suite ( that does pixel level testing ), Java 3D example programs and community testing. A JUnit test suite for Java 3D will be a great addition to have."

prunge worries about unintended consequences in Re: Null check analysis: "If null check analysis is to be effective, all JDK classes will need to be annotated with them. Otherwise how does the compiler know that Map#get(K) can return null but Map#keySet() cannot. This is going to be a very large amount of work for the Sun people, even more than the addition of generics caused, since more classes use nulls than, say, collections. There have already been complaints that generics cause more code to be written..."


In today's java.net News Headlines :

Registered users can submit news items for the java.net News Page using our news submission form. All submissions go through an editorial review before being posted to the site. You can also subscribe to the java.net News RSS feed.


Current and upcoming Java Events :

Registered users can submit event listings for the java.net Events Page using our events submission form. All submissions go through an editorial review before being posted to the site.


Archives and Subscriptions: This blog is delivered weekdays as the Java Today RSS feed. Also, once this page is no longer featured as the front page of java.net it will be archived along with other past issues in the java.net Archive.



Overcoming the browser upload problem