Re: Keep WebObjects, Remove cgi-bin
Re: Keep WebObjects, Remove cgi-bin
- Subject: Re: Keep WebObjects, Remove cgi-bin
- From: Chuck Hill <email@hidden>
- Date: Mon, 25 Jun 2007 13:39:10 -0700
On Jun 25, 2007, at 1:08 PM, Joe Moreno wrote:
Check,
Did you change the WOCGIAdaptorURL command line argument?
WOApplicationBaseURL?
See http://developer.apple.com/documentation/WebObjects/
WOAppProperties/AppProperties/chapter_1_section_1.html
Chuck
Good point.
Did you change the WOCGIAdaptorURL command line argument?
Yes. But it didn't make a difference. I tried it several different
ways, then, after checking the docs, I saw that WOCGIAdaptorURL
doesn't make a difference: "This URL is used by the direct connect
feature only."
Did you change the ... WOApplicationBaseURL?
No. It is set to /WebObjects, which is the default. But, I did
change it, after reading your comment, to workaround the problem...
Workaround
Here's what I did as a partial solution. I added a folder under
Apache's doc root named WebResources. The WebResources folder is at
the same level and has the same contents as the WebObjects folder
with its app's Web server resources (same permissions too). I then
changed WOApplicationBaseURL from /WebObjects to /WebResources and
everything works fine. Of course, the engineer inside of me wants
to know why it won't work with /WebObjects???
Because it conflicts with the /WebObjects that identifies a request
to the application? How does the adaptor know which is to go to the
app and which is to be processed by Apache?
Chuck
So, my workaround seems to work after an "extensive" 10 minutes
worth of testing. I'm wondering if it'll have any future side
effects when I need complete URLs for SSL/TLS, etc???
If you can recommend anything else I should look at then please let
me know.
Thanks,
Joe
On Jun 25, 2007, at 12:00:19, Chuck Hill wrote:
On Jun 24, 2007, at 6:50 PM, Joe Moreno wrote:
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, when 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 browsers 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 image.
When I change the WebObjectsAlias to /WebObjects, the Web server
can't find the 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
changed the apache.conf's WebObjectsDocumentRoot )
Did you change the WOCGIAdaptorURL command line argument?
WOApplicationBaseURL?
See http://developer.apple.com/documentation/WebObjects/
WOAppProperties/AppProperties/chapter_1_section_1.html
Chuck
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
--
Coming in 2006 - an introduction to web applications using
WebObjects and Xcode http://www.global-village.net/wointro
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve
specific problems. http://www.global-village.net/products/
practical_webobjects
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40global-village.net
This email sent to email@hidden
--
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve
specific problems.
http://www.global-village.net/products/practical_webobjects
--
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
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