axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick Rineholt <>
Subject Re: Axis attachment naming enhancement (code attached)
Date Thu, 30 Jan 2003 20:51:01 GMT
I have not looked at this issue in depth; however, my first reaction is 
that Axis should limit itself to implementing specs. AFAIK this is not a 
requirement of JAX-RPC, MIME, SOAPw/attachmetns etc.  If the particular 
names of your attachments are important that information should flow as 
part of your SOAP message in the body or a header and you can rename the 
file resource.  Also Axis does allow you to add to attachments additional 
header information so if you insist on this as the means to  communicate 
the name, I believe  that is still possible.  I also don't like the idea 
of within Axis to relinquishing the control of the naming  of attachments 
placed on the server to any client. 

Rick Rineholt
"The truth is out there...  All you need is a better search engine!"

Please respond to 
Subject:        Axis attachment naming enhancement (code attached)

I am submitting for your approval (and integration) changes to
Axis-1_1beta that allows Axis to create unique names for file
attachments that bear a passing resemblance to the original filename.
This is critical for applications that use the filename [extension] for
disambiguation, and also in the case of multiple attachments on a single
message.  It's my understanding that there are a number of Axis users
out there who have suffered for lack of a solution to this problem.

The premise is simple: add a MIME header to each attachment with the
original filename.  When the file is sent to Axis, Axis'
ManagedMemoryDataSource will use this name to create a uniquely named
temporary file (eg. Axis98765_myfile.xls) rather than the usual
(Axis98765axis).  Likewise, when Axis receives a file to be sent back to
the caller, a MIME header on the attachment indicates the original name
(Axis98765_myfile.xls).  This is not quite optimal, but it is easy
enough for the client to parse and use, given that the underscore is
guaranteed to be the first one in the filename.  Existing applications
that don't set the MIME header will continue to see the previous file
naming behavior.

The changes that I've made (in the attached files) are as follows:


setMimeHeader(DataSource's getName()) when creating an attachment part
from a DataHandler and
when setting a DataHandler for an existing AttachmentPart.

inform ManagedMemoryDataSource of the X_ORIGINAL_FILENAME MIME heading.

added new constructor with extra parameter for original name (other
constructors use this(..., null))
added storage for the original filename
use the original name when constructing the temporary file into which
the in-memory file is flushed.

Please let me know if you need any further clarification, any of this
needs to be reworked, etc.  I'm hoping that you'll find this to be
useful, correct, and worth integrating into the CVS repository.

- Jim


View raw message