• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Shorter URL
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Shorter URL


  • Subject: Re: Shorter URL
  • From: Dave Elsner <email@hidden>
  • Date: Thu, 9 Mar 2006 16:04:11 +1100

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:

This email sent to email@hidden

  • Follow-Ups:
    • SOLVED Re: Shorter URL
      • From: Dave Elsner <email@hidden>
References: 
 >Shorter URL (From: Dave Elsner <email@hidden>)
 >Re: Shorter URL (From: Chuck Hill <email@hidden>)

  • Prev by Date: Re: Shorter URL
  • Next by Date: SOLVED Re: Shorter URL
  • Previous by thread: Re: Shorter URL
  • Next by thread: SOLVED Re: Shorter URL
  • Index(es):
    • Date
    • Thread