Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

XmlPost RestHelper Accept header handling #947

Closed
terjesb opened this Issue · 1 comment

3 participants

@terjesb

Ref discussion on mailing list:

NOTE: My case is a POST and not a GET. So I'd expect it to match the
XmlPost using Content-Type. Or is Accept or extension required for
POSTs, too?

Seems reasonable. Please open a ticket and assign it to me for 2.3-release
(you need to be a watcher of the Assembla Liftweb space to open tickets)


2.3-RC3 seems to require that I append ".xml" to the url or use Accept: text/xml for matching XmlPost. (As indicated by http://www.assembla.com/wiki/show/liftweb/REST_Web_Services for navigating web services.)

2.2 also works without ".xml" appended and with Accept: /, though (as long as the Content-Type is ok).

Is this change a fix or a regression?

May be related to ticket 942. If I add Accept: text/xml, 2.3-RC3 also works without the extension.

NOTE: My case is a POST and not a GET. So I'd expect it to match the XmlPost using Content-Type. Or is Accept or extension required for POSTs, too?

https://github.com/terjesb/lift-rest-xmlpost

object IDocService extends RestHelper {
serve {
case "idoc" :: _ XmlPost xml -> _ =>

}
}

2.2:

curl -v -X POST -H 'Content-Type: text/xml' --data-binary @i.xml
http://server:8080/lift-rest-xmlpost/idoc

Content-Type: text/xml
Accept: /

< HTTP/1.1 100 Continue
< HTTP/1.1 200 OK
< Date: Mon, 21 Mar 2011 21:51:33 GMT
< Expires: Mon, 21 Mar 2011 21:51:33 UTC
< Content-Length: 65
< Cache-Control: no-cache; private; no-store
< Content-Type: text/xml; charset=utf-8
< Pragma: no-cache
< Date: Mon, 21 Mar 2011 21:51:33 UTC
< X-Lift-Version: 2.2
< Server: Jetty(6.1.24)
<
<?xml version="1.0" encoding="UTF-8"?>

2.3-RC3:

curl -v -X POST -H 'Content-Type: text/xml' --data-binary @i.xml
http://server:8080/lift-rest-xmlpost/idoc

Content-Type: text/xml
Accept: /

< HTTP/1.1 100 Continue
< HTTP/1.1 404 Not Found
< Date: Mon, 21 Mar 2011 21:47:37 GMT
< Expires: Mon, 21 Mar 2011 21:47:37 UTC
< Set-Cookie: JSESSIONID=s4cmybkfhqv41i68yrkwldpe0;Path=/lift-rest-
xmlpost
< Content-Length: 119
< Cache-Control: no-cache, private, no-store
< Content-Type: text/html; charset=utf-8
< Pragma: no-cache
< Date: Mon, 21 Mar 2011 21:47:37 UTC
< X-Lift-Version: 2.3-RC3
< Server: Jetty(6.1.24)
<
<!DOCTYPE html>
The Requested URL /lift-rest-xmlpost/idoc was not found
on this server

2.3-RC3 with .xml appended:

curl -v -X POST -H 'Content-Type: text/xml' --data-binary @i.xml
http://server:8080/lift-rest-xmlpost/idoc.xml

Content-Type: text/xml
Accept: /

< HTTP/1.1 100 Continue
< HTTP/1.1 200 OK
< Date: Mon, 21 Mar 2011 22:01:03 GMT
< Expires: Mon, 21 Mar 2011 22:01:03 UTC
< Content-Length: 65
< Cache-Control: no-cache, private, no-store
< Content-Type: text/xml; charset=utf-8
< Pragma: no-cache
< Date: Mon, 21 Mar 2011 22:01:03 UTC
< X-Lift-Version: 2.3-RC3
< Server: Jetty(6.1.24)
<
<?xml version="1.0" encoding="UTF-8"?>

2.3-RC3 without extension but Accept header:

curl -v -X POST -H 'Content-Type: text/xml' --data-binary @i.xml -H
'Accept: text/xml' http://neviroom-test.nevi.priv:8080/lift-rest-xmlpost/idoc

Content-Type: text/xml
Accept: text/xml

< HTTP/1.1 100 Continue
< HTTP/1.1 200 OK
< Date: Mon, 21 Mar 2011 22:09:18 GMT
< Expires: Mon, 21 Mar 2011 22:09:18 UTC
< Content-Length: 65
< Cache-Control: no-cache, private, no-store
< Content-Type: text/xml; charset=utf-8
< Pragma: no-cache
< Date: Mon, 21 Mar 2011 22:09:18 UTC
< X-Lift-Version: 2.3-RC3
< Server: Jetty(6.1.24)
<
<?xml version="1.0" encoding="UTF-8"?>

@dpp dpp was assigned
@etorreborre etorreborre referenced this issue from a commit in etorreborre/framework
@dpp dpp Fixed fixes #947. Better GET type resolution a87c944
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.