Ask your programmer to write a servlet that reads the image and writes it to
the output stream (ServletResponse.getOutputStream()). They should call
ServletResponse.setContentType("image/jpeg") before they write (or whatever
the MIME type is--image/png, image/gif, etc.).

I recommend they also check the value returned by
ServletResponse.getBufferSize() and read/write the image in chunks that
size. If getBufferSize() returns zero, I use 8K chunks.

On Tue, Sep 13, 2011 at 1:21 PM, Jeffrey Janner <jeffrey.jan...@polydyne.com
> wrote:

> Assume Tomcat 6/Java 6 and must be OS agnostic.
>
> Our app currently is not distributable as a war file due to some decisions
> made long ago (properties files that need to be modified stored in WEB-INF,
> etc.).  I have found ways to work around most of the issues, mostly
> involving moving things from properties files or web.xml to the context.xml
> file.  However, there is one sticking point that is a problem.
> We allow the end user to replace a JPG file with one of their own, so that
> it gets displayed on certain pages instead of the default one we provide (a
> logo file).  It currently resides in a sub-directory of the exploded war
> file.  Rather than have the customer replace the file after every upgrade, I
> thought it would be nice to somehow define a location where the file exists,
> and the app could go get it when requested (sort of like a sym-link).  I
> don't have a problem making the location a path to a directory that contains
> the file and then have it send from there if the file exists, like a
> sym-link to the directory.  And I am sure I can get the developers to change
> the code to reference the new location (It currently resides in a directory
> with a lot of other graphics).  Also, the app is backended by a DB that
> supports BLOBS, so that could possibly be another possiblility.
>
> I am open to lots of suggestions and wonder if anyone has done this before.
>  Also interested in potential security issues.
>
> As a windows example: http://somedomain.com/app/cust_graphics/logo.jpgwill be 
> delivered from C:/Program Files/mycompany/Customized
> information/logo.jpg.
>
>
> __________________________________________________________________________
>
> Confidentiality Notice:  This Transmission (including any attachments) may
> contain information that is privileged, confidential, and exempt from
> disclosure under applicable law.  If the reader of this message is not the
> intended recipient you are hereby notified that any dissemination,
> distribution, or copying of this communication is strictly prohibited.
>
> If you have received this transmission in error, please immediately reply
> to the sender or telephone (512) 343-9100 and delete this transmission
> from your system.
>



-- 
"Hell hath no limits, nor is circumscrib'd In one self-place; but where we
are is hell, And where hell is, there must we ever be" --Christopher
Marlowe, *Doctor Faustus* (v, 121-24)

Reply via email to