Re: Static Images
Re: Static Images
- Subject: Re: Static Images
- From: Nat Fast <email@hidden>
- Date: Tue, 24 Jun 2003 08:24:29 -0700
I did something similar (but different in that I did use the WOImage
tag) when I wanted to have an images directory not contained in the <WO
web server app>/Contents/WebServerResources or <WO web server
app>/Contents/WebServerResources directory. You will not see them while
authoring, unless they are in the WebServerResources or Resources
folder in your project and flagged for inclusion under development. But
that kind of redundant and defeats the purpose anyway.
Build your filename.
filename = "/images/"+productPic.picFileName();
On a WOImage object bind filename to src.
The images directory is relative to your webserver root docs directory
http://server/images.
Unless I am mistaken, WO will always create a URL that it can manage
the session through. If you need to maintain your session when jumping
back and forth between static and WO pages it can get a bit more
complex.
In your case, the issue is the URL that you are generating. If you have
a static page built, that is not being served by WO, why use WO? Why
not use static URLs to call that page and use direct actions for the
return to the WO app side?
A direct action is called from a url like
http://server:52060/cgi-bin/WebObjects/MyApp.woa/wa/myDirect which you
could use in a static site to go to a specific WO component page.
Say you had a WOComponent named ItemView.
Your direct action handler in the DirectAction class, in simplest form,
could look something like this:
public WOActionResults myDirectAction() {
// notice that the direct action name has "Action" attached to
it, while the URL does not.
ItemView nextPage = (ItemView)pageWithName("ItemView");
return nextPage;
}
If you needed to manage some other aspect of that page, such as some
initialization you could then
public WOActionResults myDirectAction() {
ItemView nextPage = (ItemView)pageWithName("ItemView");
// some optional initialization for the page if required passed
as form values
String pCode =
(String)this.request().formValueForKey("productCode");
String dCode = (String)this.request().formValueForKey("dept");
nextPage.setProductCode(pCode );
nextPage.setDeptCode( dCode );
nextPage.setProductItem();
// end initialization
return nextPage;
}
This would handle a URL like
http://server:52060/cgi-bin/WebObjects/MyApp.woa/wa/
myDirect?productCode=0741&dept=700
Hope this helps,
Nat
On Tuesday, June 24, 2003, at 03:20 AM, Goodbye Bill wrote:
> Okay, this is all well and good, but what about relative paths?
>
> I've created a directory for my images on the root of the web server,
> however, the relative path to that directory is not the same for both
> the
> initial page and subsequent pages.
>
> Example:
>
> Initial Page...
> http://server:52060/cgi-bin/WebObjects/MyApp.woa
>
> Subsequent Pages:
>
> http://server:52060/cgi-bin/WebObjects/MyApp.woa/wo/
> TV3bWMuYMKxWpZWv1qHxyw/0
> .1.23.0
>
> The relative path while on the initial page would be something like
> "../../../Images" while the subsequent pages would not be.
>
> VERY frustrating! =(
> On 6/24/03 12:29 AM, "Art Isbell" <email@hidden> wrote:
>
>> On Monday, June 23, 2003, at 05:56 PM, Goodbye Bill wrote:
>>
>>> Thanks for the reply but this is not what I want. I do not want to
>>> use the
>>> "WOImage" object. I have a pre-existing site that I want to move to
>>> WebObjects, but don't want anything server-side to take place for the
>>> serving of images.
>>
>> By setting the WOImage to static in the inspector, you'll get a
>> standard IMG, not a WEBOBJECT tag, and the image will be served by the
>> Web server, not WO.
>>
>> Aloha,
>> Art
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.