[
https://issues.apache.org/jira/browse/COUCHDB-1005?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12976710#action_12976710
]
Benoit Chesneau commented on COUCHDB-1005:
------------------------------------------
This feature worth a discussion on the mailing-list.. There have been long
discussion about the rewriting feature. First intention of _rewriter was to
offer a simple way to dispatch urls to a resource (_show, _update, _list,
_view, doc, attachment) based on path terms (string, ':var", "*"). Path
specifications are obtained by breaking url into tokens via the "/" separator,
Then we match them against path terms. That's how we find urls. There is also
the possibility to use query arguments as a path term.
The rewriter like this is the easier implementation we found, and as is the
only that obtained a consensus between devs.
Now I understand people want to do more mostly because of CouchApp concept and
the need to reduce the stack between couchdb and the web (removing a proxy, app
middleware, ...) . But before adding more features to couch_httpd_rewriter I
would like to take some time to define final intention of this rewriter. I
always considered the rewriter as a temporary hack before we go for a full app
engine inside couch (and that without having to proxy it to a server). Maybe
it's time to think about it more. I have a working implementation I will
opensource this week when I'm back.
But I guess it will take some time before any app-engine implementation come
into trunk and goals of this one should be discussed. Waiting that does it
worth to work on an improved but more complex rewriter ? I like the replace
concept, since it doesn't break current implementation, didn't see the code
yet, but could be a way to support an improved rewriter without adding more
complexity I guess.
> Rewriting to a URL with 2 replacements fails
> --------------------------------------------
>
> Key: COUCHDB-1005
> URL: https://issues.apache.org/jira/browse/COUCHDB-1005
> Project: CouchDB
> Issue Type: Bug
> Affects Versions: 1.0.1
> Reporter: Sam Bisbee
>
> When I pull two variables out of a URL and drop them into the target, the
> target URL breaks. However, it appears that the variables are being captured
> appropriately.
> This couch was built from source on Ubuntu 10.04 and is running a default
> config.
> Unexpected Results
> ----------------------------
> Assuming that we're querying the _rewrite handler with /foo/bar
> { "from": "/:user/:plugin", "to": "../../:user-:plugin"} will result in
> /db/undefined?user=foo&plugin=bar
> { "from": "/:user/:plugin", "to": "../../:user :plugin"} will result in
> /db/undefined?user=foo&plugin=bar
> { "from": "/:user/:plugin", "to": "../../:user"} will CORRECTLY result in
> /db/foo?user=foo&plugin=bar
> Expected Results
> ------------------------
> { "from": "/:user/:plugin", "to": "../../:user-:plugin"} should result in
> /db/foo-bar?user=foo&plugin=bar
> { "from": "/:user/:plugin", "to": "../../:user :plugin"} will result in
> /db/foo bar?user=foo&plugin=bar
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.