Login  Register

Re: Re: Invalid URL on otherwise valid eXist queries

Posted by HankRatz on Jan 11, 2010; 8:15pm
URL: https://discuss.orbeon.com/Invalid-URL-on-otherwise-valid-eXist-queries-tp1008531p1011544.html


On Jan 8, 2010, at 7:39 PM, Alessandro Vernet wrote:

> Hank,
>
> I am wondering if you get this exception HttpClient exception because it wants more characters (such as the brackets) to be encoded. I use the _query =... trick a lot, and often use it with encode-for-uri(). E.g.:

Indeed that is the issue. Unfortunately for XPath, square brackets are part of the
IP 6 URL specification, but UTF-8 encoding works around this (for now).

[ %5B
] %5D

http://www.ietf.org/rfc/rfc2732.txt

>
> <xforms:submission method="get" action="...?_query={encode-for-uri(...)}"/>
>
> You can't use an AVT in <xforms:instance src="...">, but you can run a submission on xforms-model-construct-done and put the oxfords:readonly on that submission.

Thanks.  It seems a bit counter-intuitive to initialize an instance on the
xforms-model-construct-done, but if that works...

Wind back in the sails, thanks,
Hank



>
> Alex
>
>
>
> On Jan 6, 2010, at 4:45 PM, Hank Ratzesberger <[hidden email]> wrote:
>
>> I could simplify parts of my application, hopefully improve performance a bit if I
>> could use the same URL's as an instance src attribute as I do on a browser address.
>>
>> For example, enter the following in the browser and I get the
>>
>> http://db.nees.ucsb.edu/exist/rest?_query=doc('/pub/sitechan.xml')//sitechan[sta='GVDA'][matches(chan,'^H')]
>>
>> and I get the particular subset I need.  The browser translates the url to this:
>>
>> http://db.nees.ucsb.edu/exist/rest?_query=doc%28%27/pub/sitechan.xml%27%29//sitechan[sta=%27GVDA%27][matches%28chan,%27^H%27%29]
>>
>> However, the same url, translated or not, cannot be used as an instance src attribute:
>>
>> <xforms:instance id="gvda-sitechans"
>> src="http://db.nees.ucsb.edu/exist/rest?_query=doc%28%27/pub/sitechan.xml%27%29//sitechan[sta=%27GVDA%27][matches%28chan,%27i^H%27%29]"
>>  xxforms:readonly="true"/>
>>
>>
>>
>> java.lang.IllegalArgumentException Exception Class java.lang.IllegalArgumentException Message Invalid uri 'http://db.nees.ucsb.edu/exist/rest?_query=doc('/pub/sitechan.xml')//sitechan[sta='GVDA']': Invalid query Servlet Stack Trace
>> (119 method calls)
>> Class Name    Method Name    File Name    Line Number
>> org.apache.commons.httpclient.HttpMethodBase    <init>    HttpMethodBase.java    222
>> org.apache.commons.httpclient.methods.GetMethod    <init>    GetMethod.java    89
>> org.orbeon.oxf.resources.handler.HTTPURLConnection    setRequestMethod    HTTPURLConnection.java    78
>>
>> Is there a way to avoid url checking? Looks like it's part of the apache commons, but
>> it seems to me this behavior is recent, within the last year.
>>
>> Thanks,
>> Hank
>>
>>
>>
>> Hank Ratzesberger
>> NEES@UCSB
>> Institute for Crustal Studies,
>> University of California, Santa Barbara
>> 805-893-8042
>>
>>
>>
>>
>>
>>
>> --
>> You receive this message as a subscriber of the [hidden email] mailing list.
>> To unsubscribe: mailto:[hidden email]
>> For general help: mailto:[hidden email]?subject=help
>> OW2 mailing lists service home page: http://www.ow2.org/wws
>
> --
> You receive this message as a subscriber of the [hidden email] mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
Hank Ratzesberger
NEES@UCSB
Institute for Crustal Studies,
University of California, Santa Barbara
805-893-8042







--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws