Re: Basic Question (Webobjects-dev Digest, Vol 3, Issue 187)
Re: Basic Question (Webobjects-dev Digest, Vol 3, Issue 187)
- Subject: Re: Basic Question (Webobjects-dev Digest, Vol 3, Issue 187)
- From: Paul Lynch <email@hidden>
- Date: Wed, 22 Mar 2006 11:51:17 +0000
On 22 Mar 2006, at 08:37, Travis Cripps wrote:
Your approach with the images was laudable and understandable,
given the WebServerResources group in the XCode project. The truth
is that almost noone uses real "web server resources" in this way.
The most common way to reference static resources in a WOComponent
is to place them under the document root of the web server, which
on MacOS X is at /Library/WebServer/Documents. The reason for this
is that it's best to let the web server do the work and vend them
directly, rather than stream them through the WebObjects adaptor
which creates a lot more unnecessary overhead.
So, if you have an images folder, you may keep them grouped in your
app's WebServerResources group, but it's usually best to manually
copy the images to the web server. If your images are at /images
under the web server document root, you then simply add a static
reference to an image thusly "/images/foo.jpg" This approach has
proven fairly flexible and easy to use in development and
translates easily to deployment. Just copy the images directory to
your deployment web server.
Items in the Web Server Resources group (really the Web Server target
contents) are copied into the doc root when the app is deployed. The
contents should not go into the Application Server target, and the
resource manager does not stream images, etc, from the app server to
the web server; instead, it resolves the request handler call into a
URL (pointing to /WebObjects/AppName.woa/Contents/WebServerResources/
image.gif, for instance). The various request handlers may stream
resources in some circumstances, I don't know - but not in these.
The benefit of using the Web Server target is that you get full
localisation of resources, which can be very important, especially
when you consider that resources can be javascript and css files as
well as images. There is an additional overhead for doing this, of
course - but it isn't as large as streaming the contents would be.
Manual copying of resources also has quite a few pitfalls in terms of
keeping in sync with changes in your app.
I use both the Web Server target and separate installation of
resources to the doc root as appropriate; I also probably develop
more multi-lingual apps than most.
Paul
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden