RE: Exist REST Problems

Posted by Ryan Puddephatt on
URL: https://discuss.orbeon.com/Exist-REST-Problems-tp31201p31230.html

Alex, Hank,
        I've found a solution, although its more of a work around. I replace
the existing isXMLContentType() function in
org.orbeon.oxf.processor.ProcessorUtils

With

Public static boolean isXMLContentType(String contentType) {
        if(contentType == null)
                return false;
        return contentType.equals(XML_CONTENT_TYPE1)
                || contentType.equals(XML_CONTENT_TYPE2)
                || contentType.endsWith(XML_CONTENT_TYPE3_SUFFIX)
                || contentType.equals(HTML_CONTENT_TYPE);
}

This isn't really addressing the problem, but it does temporarily get the
REST queries to work whilst we get a solution from Exist

Ryan

Ryan Puddephatt
Software Engineer

Teleflex Group - IT UK
1 Michaelson Square
Livingston
West Lothian
Scotland
EH54 7DP

e> [hidden email]
t> +44(0)1506 407 110
f> +44(0)1506 407 108

 

>-----Original Message-----
>From: Ryan Puddephatt [mailto:[hidden email]]
>Sent: 11 November 2006 08:59
>To: [hidden email]
>Subject: RE: [ops-users] Exist REST Problems
>
>Alex,
> I believe Hank has posted a question on the Exist
>mailing list regarding this, I also found this archived email
>http://sourceforge.net/mailarchive/message.php?msg_id=36645468,
> which states that it's the default response (Not sure why). I
>was wondering why an xforms submission can't accept this
>content type and force a change into xml, and only then throw
>an error if it isn't well formed?
>
>Ryan
>
>Ryan Puddephatt
>Software Engineer
>
>Teleflex Group - IT UK
>1 Michaelson Square
>Livingston
>West Lothian
>Scotland
>EH54 7DP
>
>e> [hidden email]
>t> +44(0)1506 407 110
>f> +44(0)1506 407 108
>
>
>
>>-----Original Message-----
>>From: [hidden email] [mailto:[hidden email]] On Behalf Of
>>Alessandro Vernet
>>Sent: 11 November 2006 02:39
>>To: [hidden email]
>>Subject: Re: [ops-users] Exist REST Problems
>>
>>Ryan,
>>
>>Point taken. Let us know if you find a solution through the
>eXist list
>>or otherwise.
>>
>>Alex
>>
>>On 11/10/06, Ryan Puddephatt <[hidden email]> wrote:
>>> Alex,
>>>         I can see your argument, but all my queries are simple,
>>> /product etc. This means I can get all the products in my
>>application
>>> for listing (similar to the DMV Summary). This saves me having to
>>> create a query instance or use XPL because I can do it all
>>in the src
>>> (well in theory)
>>>
>>> Thanks
>>>
>>> Ryan
>>>
>>> Ryan Puddephatt
>>> Software Engineer
>>>
>>> Teleflex Group - IT UK
>>> 1 Michaelson Square
>>> Livingston
>>> West Lothian
>>> Scotland
>>> EH54 7DP
>>>
>>> e> [hidden email]
>>> t> +44(0)1506 407 110
>>> f> +44(0)1506 407 108
>>>
>>>
>>>
>>> >-----Original Message-----
>>> >From: [hidden email] [mailto:[hidden email]] On Behalf Of
>>> >Alessandro Vernet
>>> >Sent: 11 November 2006 01:29
>>> >To: [hidden email]
>>> >Subject: Re: [ops-users] Exist REST Problems
>>> >
>>> >Ryan,
>>> >
>>> >Here I am posting the query from XForms. That is posting a query
>>> >embedded in a <query> document as the one shown on the page linked
>>> >below. Would you get the text/xml content type when doing a
>>POST vs.
>>> >a GET? Is it OK in your case to do a POST?
>>> >
>>> >http://exist.sourceforge.net/devguide.html#N10385
>>> >
>>> >(Unless I am sending trivial queries, I don't like very
>>much the idea
>>> >of sending them in a query string with a GET, because I
>>know that one
>>> >day the query will become too long, exceed the URL length
>limit and
>>> >lead to a bug that is hard to find.)
>>> >
>>> >Alex
>>> >
>>> >On 11/10/06, Ryan Puddephatt <[hidden email]> wrote:
>>> >> Alex,
>>> >>         Apart from the fact I'm using an internal exist the only
>>> >> difference I can see is that I'm using the _query parameter to
>>> >> query the DB rather than pulling a single document, I
>>believe that
>>> >> this is the cause for the change in content type
>>> >>
>>> >> Thanks
>>> >>
>>> >> Ryan
>>> >>
>>> >> Ryan Puddephatt
>>> >> Software Engineer
>>> >>
>>> >> Teleflex Group - IT UK
>>> >> 1 Michaelson Square
>>> >> Livingston
>>> >> West Lothian
>>> >> Scotland
>>> >> EH54 7DP
>>> >>
>>> >> e> [hidden email]
>>> >> t> +44(0)1506 407 110
>>> >> f> +44(0)1506 407 108
>>> >>
>>> >>
>>> >>
>>> >> >-----Original Message-----
>>> >> >From: [hidden email] [mailto:[hidden email]] On Behalf Of
>>> >> >Alessandro Vernet
>>> >> >Sent: 10 November 2006 21:53
>>> >> >To: [hidden email]
>>> >> >Subject: Re: [ops-users] Exist REST Problems
>>> >> >
>>> >> >On 11/10/06, Ryan Puddephatt <[hidden email]> wrote:
>>> >> >> I now have another problem, the REST API always
>>returns text/html.
>>> >> >> There is a parameter that can change it, by adding the
>>> >following to
>>> >> >> the EXistServlet
>>> >> >
>>> >> >Ryan,
>>> >> >
>>> >> >I don't have this problem. I am using a verbatim 1.1.1
>>> >deployed as a
>>> >> >separate war, and if I access
>>> >http://localhost:8090/exist/rest/, the
>>> >> >response I get is:
>>> >> >
>>> >> >HTTP/1.1 200 OK
>>> >> >Server: Apache-Coyote/1.1
>>> >> >Content-Type: text/xml;charset=UTF-8
>>> >> >Content-Length: 321
>>> >> >Date: Fri, 10 Nov 2006 21:50:24 GMT
>>> >> >
>>> >> ><exist:result
>>xmlns:exist="http://exist.sourceforge.net/NS/exist">
>>> >> >...
>>> >> >
>>> >> >Do you see anything that could be different in your case?
>>> >> >
>>> >> >Alex
>>> >> >--
>>> >> >Blog (XML, Web apps, Open Source):
>>> >> >http://www.orbeon.com/blog/
>>> >> >
>>> >> >
>>> >>
>>> >>
>>> >>
>>> >>
>>> >>
>>> >> --
>>> >> 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
>>> >> ObjectWeb mailing lists service home page:
>>> >> http://www.objectweb.org/wws
>>> >>
>>> >>
>>> >>
>>> >
>>> >
>>> >--
>>> >Blog (XML, Web apps, Open Source):
>>> >http://www.orbeon.com/blog/
>>> >
>>> >
>>>
>>>
>>>
>>>
>>>
>>> --
>>> 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
>>> ObjectWeb mailing lists service home page:
>>> http://www.objectweb.org/wws
>>>
>>>
>>>
>>
>>
>>--
>>Blog (XML, Web apps, Open Source):
>>http://www.orbeon.com/blog/
>>
>>
>
>
>



--
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws