Hi,
Summary
I changed the apache.conf WebObjectsAlias from /cgi-bin/WebObjects
to /WebObjects to shorten the URL but the images broke when the app
was deployed.
Details
I looked through the WO archive to figure out how to remove cgi-bin
from the WO URL while keeping WebObjects, but I didn't find anything
to fix the broken images. I'm looking for a WebObjects solution (vice
an apache mod rewrite solution).
I'm close, though - I changed the following apache.conf line from:
WebObjectsAlias /cgi-bin/WebObjects
to:
WebObjectsAlias /WebObjects
This works great, but this also breaks the images in deployment. The
URL for the images doesn't change (Web server resources usually
aren't preceded with cgi-bin), here's a sample image URL for the
deployed app:
http://www.example.com/WebObjects/WoApp.woa/Contents/
WebServerResources/Go-Button.gif
After carefully clearing the browser's cache, I can see that the WO
app is generating the same image URL for both the cgi-bin/WebObjects
and /WebObjects configurations.
I have a test image (cnn.gif) here: docroot/WebObjects/cnn.gif
When I set the WebObjectsAlias to /cgi-bin/WebObjects, the Web server
has no problem serving up the test image.
When I change the WebObjectsAlias to /WebObjects, the Web server
can't find the test image.
It would seem that the WebObjects adaptor is intercepting the
request, since WebObjects is in the URL, but I don't know where it's
looking for the Web server resources. Permissions, on the WebObjects
folder, don't seem to be an issue.
Did I miss something when changing the WebObjectsAlias? (I also tried
changing the apache.conf's WebObjectsDocumentRoot )
- Joe
____________
shaun wrote:
Miguel Arroz wrote:
Hi!
On 2006/10/10, at 21:50, Chuck Hill wrote:
Interesting I never tried that. Thanks for the tip! You just have
this then?
WebObjectsAlias /WebObjects
Yap! :) Taking the cgi-bin part out makes the URL look much better!
Yours
Cool. Thanks for that info. I think that is definitely Wiki worthy(if
its not there already).
Sweet, it works like a charm !
Thanks for all.
____________
Thanks Chuck you saved the day yet again.
I took a look at http://www.jewelryluv.com/fashion/pageWithName/
ModRewrite/ but didn'tknow how to make it work with dynamic URLs so I
changed applications dispatchRequest as below.
However it doesn't seem to return the correct response.content() the
second System.out.println I do shows that it has been replace but
the generated page still contains the cgi-bin references?
public WOResponse dispatchRequest(WORequest request) {
if ("/favicon.ico".equals(request.uri())) {
return new WOResponse();
}
WOResponse response = super.dispatchRequest(request);
String contentType = response.headerForKey("content-type");
if ((contentType == null) || (contentType.toLowerCase().indexOf
("text/html") > - 1)) {
response.setContent( response.contentString().replaceAll( "/cgi-
bin/WebObjects/", "" ) );
System.out.println("WOResponse = " +
response.contentString() );
return response;
}
return super.dispatchRequest(request);
}
Regards
David Elsner
Ph 61+02 42214251
On 09/03/2006, at 3:01 PM, Chuck Hill wrote:
Hi Dave,
On Mar 8, 2006, at 7:56 PM, Dave Elsner wrote:
I know this issue has been covered many times before but I still
can't seem to find a solution to:
How to remove the "cgi-bin/WebObjects/appName.woa" from the URL
permanently ?
I have set up Apaches modRewrite so I can navigate to the Domain
name, but as soon as I navigate from the front page the site the URL
goes back to using " cgi-bin/WebObjects/appName.woa" How came I
change the application so that all hyperlinks and form submit return
a URL like:
http://mydomain/appname.woa/blahblah that will be translated by
apache to http://mydomain/cgi-bin/WebObjects/appname.woa/blahblah
My rewrite rule would look some thing like: RewriteRule ^/
appname.woa.* /cgi-bin/WebObjects/appname.woa$1 [L,PT]
Can I do this in appendToResponce ? pageWithName? or changing the
Monitors path to the WO Adaptor?
In a nutshell, you have to generate the URLs yourself. There are
many ways of doing this:
1. Create a class that generates the URL and use this with the href
bindings on the components
2. Create a custom WOContext subclass to generate the URLS you need
3. Use regex to find and change the URLs in dispatchRequest in
Application (probably the best place)
4. Do something like this: http://www.jewelryluv.com/fashion/
pageWithName/ModRewrite/
Chuck
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com
This email sent to [EMAIL PROTECTED]