You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by AQ...@epsilon.com on 2006/11/09 17:31:49 UTC
[OT] Deploy Images externally from application
Hello,
I have an application which contains a bunch of images for products whose
filenames come from the database. Right now the images are stored inside
the WAR file when deploying the application, which is fine but the problem
is that when they become part of the CVS code repository it becomes a huge
tarball and unnecessary duplication/tagging/branching of images on CVS
which do not change between releases. (We don't care about versioning
image files since they are maintained by a third party).
I wish to know what approach would be the best to keep the images outside
of the built WAR and still being able to access them easily from the
application. Some approached I thought of were:
- Maintain images in a separate CVS module. When deploying the application
explode the WAR file and include the images and re-war the war file.
- Store images in a separate folder outside of the context root and refer
to them via a symlink (platform dependent) or a configuration property in
the application (platform independent).
Does anyone know of a better solution? Or has any comments/ideas on how to
do this?
Thanks a lot!
Affan
Re: [OT] Deploy Images externally from application
Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Affan,
AQureshi@epsilon.com wrote:
> I have an application which contains a bunch of images for products whose
> filenames come from the database. Right now the images are stored inside
> the WAR file when deploying the application
Ugh.
> We don't care about versioning image files since they are maintained
> by a third party.
Yeah, get those things out of CVS.
> I wish to know what approach would be the best to keep the images outside
> of the built WAR and still being able to access them easily from the
> application. Some approached I thought of were:
>
> - Maintain images in a separate CVS module. When deploying the application
> explode the WAR file and include the images and re-war the war file.
Why bother with CVS? Why bother with a WAR? Why bother with deployment?
Just keep them in the same place all the time.
> - Store images in a separate folder outside of the context root and refer
> to them via a symlink (platform dependent) or a configuration property in
> the application (platform independent).
The symlink is not necessary.
I think you should just allocate a portion of your URL-space to these
images. Something like "/images", maybe.
You ought to be able to divert a particular URL space to another
directory which is external to your webapp (i.e. not stored in the
"myapp" directory under your servlet container's deployment directory).
For instance, in Apache httpd, you could do this:
Alias /images /full/path/to/your/image/repository
I would imagine that Jakarta Tomcat has the same capability, though I
have no idea how to configure it.
If you do something like this, you can keep your images in a directory
structure that is completely independent of your webapp, and doesn't
have to be handled specially during deployment of new webapp versions
(or even additional webapps).
If you make the "URL prefix" for those images dynamic within your
application, you can do something like this:
<a href="${image-prefix}/{$image-path}">View Image</a>
Your image-prefix could even be fully-qualified (i.e. starting with
http://) and you could use a different server altogether to serve those
images. In fact, if you have a third-party who maintains your images,
you might even be able to serve these images from /their/ servers.
Hope that helps,
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFFU8d39CaO5/Lv0PARAobKAJ9Je01VRGJf4e4ctgVwraZdXF7ouACghuWA
DFJwCQB57GQWG8N9MjX0ILk=
=eceU
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Deploy Images externally from application
Posted by AQ...@epsilon.com.
Maybe a taglib would be a better solution? Anyone else had to do this?
AQureshi@epsilon.com wrote on 11/09/2006 10:31:49 AM:
> Hello,
>
> I have an application which contains a bunch of images for products
whose
> filenames come from the database. Right now the images are stored inside
> the WAR file when deploying the application, which is fine but the
problem
> is that when they become part of the CVS code repository it becomes a
huge
> tarball and unnecessary duplication/tagging/branching of images on CVS
> which do not change between releases. (We don't care about versioning
> image files since they are maintained by a third party).
>
> I wish to know what approach would be the best to keep the images
outside
> of the built WAR and still being able to access them easily from the
> application. Some approached I thought of were:
>
> - Maintain images in a separate CVS module. When deploying the
application
> explode the WAR file and include the images and re-war the war file.
> - Store images in a separate folder outside of the context root and
refer
> to them via a symlink (platform dependent) or a configuration property
in
> the application (platform independent).
>
> Does anyone know of a better solution? Or has any comments/ideas on how
to
> do this?
>
> Thanks a lot!
>
> Affan
>
>
>