[jira] [Commented] (COUCHDB-1017) HTTP Rewrite Handler: Rewriting strings in queries

2011-06-21 Thread Markus Barchfeld (JIRA)

[ 
https://issues.apache.org/jira/browse/COUCHDB-1017?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13052798#comment-13052798
 ] 

Markus Barchfeld commented on COUCHDB-1017:
---

Thanks for your comment, Gabriel. It made me look into #1074, where everything 
is explained.

My use case was to rewrite an URL with year and month into startkey and endkey 
parameters.
E.g the incoming URL

"availabledays/2010/1" 

with the rewrite rule 

{
  "from": "/availabledays/:year/:month",
  "to": "_list/available/measurements",
  "query": {
"group_level": "3",
"startkey": [ ":year", ":month" ],
"endkey": [ ":year",":month", {}] 
   },
   "formats": {
"year": "int",
"month": "int"
   }
},

is transformed into

_list/available/measurements?startkey=%5B2010%2C1%5D&endkey=%5B2010%2C1%2C%7B%7D%5D&group_level=3&year=2010&month=1

Which is perfect. Or at least nearly ;-) Any way to get rid of the year and 
month query parameters in the rewritten rule?


> HTTP Rewrite Handler: Rewriting strings in queries
> --
>
> Key: COUCHDB-1017
> URL: https://issues.apache.org/jira/browse/COUCHDB-1017
> Project: CouchDB
>  Issue Type: Improvement
>  Components: HTTP Interface
>Affects Versions: 1.0.1
>Reporter: Michel Legnered
>Assignee: Benoit Chesneau
>Priority: Minor
>
> I have this rewrite:
> {
>   "from": "/u/:key",
>   "to": "_list/pouch/user-items",
>   "method": "GET",
>   "query": {"key": ":key"}
> }
> ..where the view returns: {"error":"bad_request","reason":"invalid UTF-8 
> JSON"}. The view query looks like this ?key=somekey, but for the view to 
> succeed "somekey" need to be in double quotes.
> Maybe one could improve the rewriter's behavior for rewriting strings in 
> queries? 
> Here is one workaround:
> {
>   "from": "/u/:startkey",
>   "to": "_list/pouch/user-items",
>   "method": "GET",
>   "query": {
>   "startkey": [":startkey"],
>   "endkey": [":startkey", {}]
>   }
> },

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Commented] (COUCHDB-1017) HTTP Rewrite Handler: Rewriting strings in queries

2011-06-21 Thread Gabriel Farrell (JIRA)

[ 
https://issues.apache.org/jira/browse/COUCHDB-1017?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13052560#comment-13052560
 ] 

Gabriel Farrell commented on COUCHDB-1017:
--

Benoit, works for me. Which commit fixed this? It would be nice to have a 
pointer.

Markus, have you tried this in your rewrites: "startkey": [":year", ":month"].

> HTTP Rewrite Handler: Rewriting strings in queries
> --
>
> Key: COUCHDB-1017
> URL: https://issues.apache.org/jira/browse/COUCHDB-1017
> Project: CouchDB
>  Issue Type: Improvement
>  Components: HTTP Interface
>Affects Versions: 1.0.1
>Reporter: Michel Legnered
>Assignee: Benoit Chesneau
>Priority: Minor
>
> I have this rewrite:
> {
>   "from": "/u/:key",
>   "to": "_list/pouch/user-items",
>   "method": "GET",
>   "query": {"key": ":key"}
> }
> ..where the view returns: {"error":"bad_request","reason":"invalid UTF-8 
> JSON"}. The view query looks like this ?key=somekey, but for the view to 
> succeed "somekey" need to be in double quotes.
> Maybe one could improve the rewriter's behavior for rewriting strings in 
> queries? 
> Here is one workaround:
> {
>   "from": "/u/:startkey",
>   "to": "_list/pouch/user-items",
>   "method": "GET",
>   "query": {
>   "startkey": [":startkey"],
>   "endkey": [":startkey", {}]
>   }
> },

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Commented] (COUCHDB-1017) HTTP Rewrite Handler: Rewriting strings in queries

2011-05-30 Thread Markus Barchfeld (JIRA)

[ 
https://issues.apache.org/jira/browse/COUCHDB-1017?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13041309#comment-13041309
 ] 

Markus Barchfeld commented on COUCHDB-1017:
---

Thanks for looking into it. However, I have quite the reverse case: calling a 
view with a hierarchical key does not work with quotes.

For example startkey=[2008,08] works fine but startkey="[2008,08]" does not 
work at all. 

Is there a way how I could avoid setting the quotes? Or just any workaround how 
I could rewrite the above example from "myview/2008/08"?

Thanks

> HTTP Rewrite Handler: Rewriting strings in queries
> --
>
> Key: COUCHDB-1017
> URL: https://issues.apache.org/jira/browse/COUCHDB-1017
> Project: CouchDB
>  Issue Type: Improvement
>  Components: HTTP Interface
>Affects Versions: 1.0.1
>Reporter: Michel Legnered
>Assignee: Benoit Chesneau
>Priority: Minor
>
> I have this rewrite:
> {
>   "from": "/u/:key",
>   "to": "_list/pouch/user-items",
>   "method": "GET",
>   "query": {"key": ":key"}
> }
> ..where the view returns: {"error":"bad_request","reason":"invalid UTF-8 
> JSON"}. The view query looks like this ?key=somekey, but for the view to 
> succeed "somekey" need to be in double quotes.
> Maybe one could improve the rewriter's behavior for rewriting strings in 
> queries? 
> Here is one workaround:
> {
>   "from": "/u/:startkey",
>   "to": "_list/pouch/user-items",
>   "method": "GET",
>   "query": {
>   "startkey": [":startkey"],
>   "endkey": [":startkey", {}]
>   }
> },

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Commented] (COUCHDB-1017) HTTP Rewrite Handler: Rewriting strings in queries

2011-05-13 Thread Benoit Chesneau (JIRA)

[ 
https://issues.apache.org/jira/browse/COUCHDB-1017?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13032933#comment-13032933
 ] 

Benoit Chesneau commented on COUCHDB-1017:
--

should be fixed in 1.1. Let me know.

> HTTP Rewrite Handler: Rewriting strings in queries
> --
>
> Key: COUCHDB-1017
> URL: https://issues.apache.org/jira/browse/COUCHDB-1017
> Project: CouchDB
>  Issue Type: Improvement
>  Components: HTTP Interface
>Affects Versions: 1.0.1
>Reporter: Michel Legnered
>Assignee: Benoit Chesneau
>Priority: Minor
>
> I have this rewrite:
> {
>   "from": "/u/:key",
>   "to": "_list/pouch/user-items",
>   "method": "GET",
>   "query": {"key": ":key"}
> }
> ..where the view returns: {"error":"bad_request","reason":"invalid UTF-8 
> JSON"}. The view query looks like this ?key=somekey, but for the view to 
> succeed "somekey" need to be in double quotes.
> Maybe one could improve the rewriter's behavior for rewriting strings in 
> queries? 
> Here is one workaround:
> {
>   "from": "/u/:startkey",
>   "to": "_list/pouch/user-items",
>   "method": "GET",
>   "query": {
>   "startkey": [":startkey"],
>   "endkey": [":startkey", {}]
>   }
> },

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Commented] (COUCHDB-1017) HTTP Rewrite Handler: Rewriting strings in queries

2011-05-13 Thread Marcos Zanona (JIRA)

[ 
https://issues.apache.org/jira/browse/COUCHDB-1017?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13032925#comment-13032925
 ] 

Marcos Zanona commented on COUCHDB-1017:


Any news on this subject?
I am having the same issue

> HTTP Rewrite Handler: Rewriting strings in queries
> --
>
> Key: COUCHDB-1017
> URL: https://issues.apache.org/jira/browse/COUCHDB-1017
> Project: CouchDB
>  Issue Type: Improvement
>  Components: HTTP Interface
>Affects Versions: 1.0.1
>Reporter: Michel Legnered
>Assignee: Benoit Chesneau
>Priority: Minor
>
> I have this rewrite:
> {
>   "from": "/u/:key",
>   "to": "_list/pouch/user-items",
>   "method": "GET",
>   "query": {"key": ":key"}
> }
> ..where the view returns: {"error":"bad_request","reason":"invalid UTF-8 
> JSON"}. The view query looks like this ?key=somekey, but for the view to 
> succeed "somekey" need to be in double quotes.
> Maybe one could improve the rewriter's behavior for rewriting strings in 
> queries? 
> Here is one workaround:
> {
>   "from": "/u/:startkey",
>   "to": "_list/pouch/user-items",
>   "method": "GET",
>   "query": {
>   "startkey": [":startkey"],
>   "endkey": [":startkey", {}]
>   }
> },

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] Commented: (COUCHDB-1017) HTTP Rewrite Handler: Rewriting strings in queries

2011-01-09 Thread Michel Legnered (JIRA)

[ 
https://issues.apache.org/jira/browse/COUCHDB-1017?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12979387#action_12979387
 ] 

Michel Legnered commented on COUCHDB-1017:
--

Here is the full debug log for the request:

[info] [<0.32.0>] Apache CouchDB has started on http://127.0.0.1:80/
[debug] [<0.104.0>] 'GET' /inventoria/_design/inventoria/_rewrite/u/miche {1,1}
Headers: 
[{'Accept',"application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5"},
  {'Accept-Charset',"ISO-8859-1,utf-8;q=0.7,*;q=0.3"},
  {'Accept-Encoding',"gzip,deflate,sdch"},
  {'Accept-Language',"en-US,en;q=0.8"},
  {'Cache-Control',"max-age=0"},
  {'Connection',"keep-alive"},
  {'Host',"127.0.0.1"},
  {'User-Agent',"Mozilla/5.0 (X11; U; Linux i686; en-US) 
AppleWebKit/534.10 (KHTML, like Gecko) Chrome/8.0.552.215 Safari/534.10"}]
[debug] [<0.104.0>] OAuth Params: []
[debug] [<0.104.0>] rewrite to 
"/inventoria/_design/inventoria/_list/pouch/user-items?key=miche" 

[debug] [<0.104.0>] 'GET' 
/inventoria/_design/inventoria/_list/pouch/user-items?key=miche {1,1}
Headers: 
[{'Accept',"application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5"},
  {'Accept-Charset',"ISO-8859-1,utf-8;q=0.7,*;q=0.3"},
  {'Accept-Encoding',"gzip,deflate,sdch"},
  {'Accept-Language',"en-US,en;q=0.8"},
  {'Cache-Control',"max-age=0"},
  {'Connection',"keep-alive"},
  {'Host',"127.0.0.1"},
  {'User-Agent',"Mozilla/5.0 (X11; U; Linux i686; en-US) 
AppleWebKit/534.10 (KHTML, like Gecko) Chrome/8.0.552.215 Safari/534.10"}]
[debug] [<0.104.0>] OAuth Params: [{"key","miche"}]
[debug] [<0.101.0>] Spawning new group server for view group _design/inventoria 
in database inventoria.
[debug] [<0.104.0>] request_group {Pid, Seq} {<0.127.0>,233}
[error] [<0.104.0>] attempted upload of invalid JSON (set log_level to debug to 
log it)
[debug] [<0.104.0>] Invalid JSON: "miche"
[info] [<0.104.0>] 127.0.0.1 - - 'GET' 
/inventoria/_design/inventoria/_list/pouch/user-items?key=miche 400
[debug] [<0.83.0>] New task status for inventoria _design/inventoria: Finishing.
[debug] [<0.104.0>] httpd 400 error response:
 {"error":"bad_request","reason":"invalid UTF-8 JSON"}

> HTTP Rewrite Handler: Rewriting strings in queries
> --
>
> Key: COUCHDB-1017
> URL: https://issues.apache.org/jira/browse/COUCHDB-1017
> Project: CouchDB
>  Issue Type: Improvement
>  Components: HTTP Interface
>Affects Versions: 1.0.1
>Reporter: Michel Legnered
>Assignee: Benoit Chesneau
>Priority: Minor
>
> I have this rewrite:
> {
>   "from": "/u/:key",
>   "to": "_list/pouch/user-items",
>   "method": "GET",
>   "query": {"key": ":key"}
> }
> ..where the view returns: {"error":"bad_request","reason":"invalid UTF-8 
> JSON"}. The view query looks like this ?key=somekey, but for the view to 
> succeed "somekey" need to be in double quotes.
> Maybe one could improve the rewriter's behavior for rewriting strings in 
> queries? 
> Here is one workaround:
> {
>   "from": "/u/:startkey",
>   "to": "_list/pouch/user-items",
>   "method": "GET",
>   "query": {
>   "startkey": [":startkey"],
>   "endkey": [":startkey", {}]
>   }
> },

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (COUCHDB-1017) HTTP Rewrite Handler: Rewriting strings in queries

2011-01-09 Thread Benoit Chesneau (JIRA)

[ 
https://issues.apache.org/jira/browse/COUCHDB-1017?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12979341#action_12979341
 ] 

Benoit Chesneau commented on COUCHDB-1017:
--

what is the source url ?, can you paste couchdb log here too ?

> HTTP Rewrite Handler: Rewriting strings in queries
> --
>
> Key: COUCHDB-1017
> URL: https://issues.apache.org/jira/browse/COUCHDB-1017
> Project: CouchDB
>  Issue Type: Improvement
>  Components: HTTP Interface
>Affects Versions: 1.0.1
>Reporter: Michel Legnered
>Priority: Minor
>
> I have this rewrite:
> {
>   "from": "/u/:key",
>   "to": "_list/pouch/user-items",
>   "method": "GET",
>   "query": {"key": ":key"}
> }
> ..where the view returns: {"error":"bad_request","reason":"invalid UTF-8 
> JSON"}. The view query looks like this ?key=somekey, but for the view to 
> succeed "somekey" need to be in double quotes.
> Maybe one could improve the rewriter's behavior for rewriting strings in 
> queries? 
> Here is one workaround:
> {
>   "from": "/u/:startkey",
>   "to": "_list/pouch/user-items",
>   "method": "GET",
>   "query": {
>   "startkey": [":startkey"],
>   "endkey": [":startkey", {}]
>   }
> },

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.