Am 29.01.2012 um 19:44 schrieb Jesse Tayler:

> 
> oh thanks fabian! 
> 
> maybe just what I was looking for -- 
> 
> the site is like twitter, so there's standard urls to reach a user profile, 
> or a post and those urls should be short, of course.
> 
>> They work for me, but I'm by no means a "rewrite expert"...
> 
> rewrite expert? ick! who would want to be that!! 
> 
> I mean, the syntax looks like someone was drunk while slapping their hands on 
> the keypad...
> 
> On Jan 29, 2012, at 1:10 PM, Fabian Peters wrote:
> 
>>   # root rewrite
>>   RewriteRule ^/$ /cgi-bin/WebObjects/App.woa [L,PT]
>> 
> 
> ah, so this basically translates anything into a full woa I guess?

Yes

>>   RewriteRule ^/(\d*?/?)ajax/(.*)$ /cgi-bin/WebObjects/App.woa/$1ajax/$2 
>> [L,PT,QSA]
>>   RewriteRule ^/(\d*?/?)upload(.*)$ /cgi-bin/WebObjects/App.woa/$1upload$2 
>> [L,PT,QSA]
> 
> I guess those two above translate standard ajax and file upload calls in the 
> same way?

Yes. The upload bit is for the AjaxFlexibleFileUpload IIRC.

>>   RewriteRule ^/(\d*?/?)wa/(.*)$ /cgi-bin/WebObjects/App.woa/$1wa/$2 
>> [L,PT,QSA]
>>   RewriteRule ^/(\d*?/?)wo/(.*)$ /cgi-bin/WebObjects/App.woa/$1wo/$2 
>> [L,PT,QSA]
>>   RewriteRule ^/(\d*?/?)wr(.*)$ /cgi-bin/WebObjects/App.woa/$1wr$2 [L,PT,QSA]
> 
> and so, these I guess translate calls from errest, direct actions and basic 
> components?

DAs, component actions and the ERXStaticResourceRequestHandler - which you 
won't need in deployment I think. This was copied from my development apache 
config.

> I can test around with these a bit, but I'm not certain I understand what 
> they are doing --

>>   RewriteRule ^/(\d*?/?)wa/(.*)$ /cgi-bin/WebObjects/App.woa/$1wa/$2 
>> [L,PT,QSA]

The first group "(\d*?/?)" checks whether there's an instance ID in the URL and 
appends that as "$1". You might not need that. The second group "(.*)" takes 
the rest and appends it as "$2".

> all cool, but you must also have some code in your app to return short urls 
> during deployment?
> 
> I used to have a menu item that used deployment urls for things like signup, 
> but used component urls locally during development, but I am guessing with 
> WOnder I might have a different approach there?

Yes, you can set er.extensions.ERXApplication.replaceApplicationPath.pattern 
and er.extensions.ERXApplication.replaceApplicationPath.replace in your 
properties and use 

    public String _rewriteURL(String url) {
        url = super._rewriteURL(url);
        ...
        return url;
    }

in your ERXApplication subclass if you need more special things.

Fabian
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to