cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jose MarĂ­a Zaragoza <demablo...@gmail.com>
Subject Build Location header in HTTP 201 response
Date Fri, 07 Feb 2014 13:52:49 GMT
Hi:

I'm using Apache CXF 2.7.3 and JAX-RS API to build a REST webservice

I've seen that the best response to return from a REST webservice when
an entity is created is a 201 HTTP code and set Location HTTP header
with the resource URI

My webservice is installed behind Apache HTTPD server as reverse proxy
Sometimes my webservice is invoked from internet as

http://www.mycompany.com/ws/myapp/process

and sometimes is invoked from a private network  as

http://internalname/myapp/process

How I can set Location header correctly ? I mean,
if requests come from intranet , to return Location:
http://internalname/myapp/get?id=xxxx
and request from private network , to return
Location:http://www.mycompany.com/ws/myapp/get?id=xxxx

How I can do this ?

Other choice is to return a 200 HTTP code with some payload, but I
don't know if it's forbidden according REST rules

Thanks and regards

Mime
View raw message