Hi everybody,
I am currently refactoring a REST application whose implementation is based on
a subclass of javax.servlet.http.HttpServlet and thus is using
javax.servlet.http.HttpServletRequest and
javax.servlet.http.HttpServletResponse quite extensively to use CXF and JAXRS.
The refactored version of the application extends
org.apache.cxf.transport.servlet.CXFNonSpringServlet and is using a service
class which defines methods using the javax.ws.rs.core.Context annotation to
obtain HttpServletRequest objets, e.g.
@POST
public void doPost(@Context HttpServletRequest request,
@Context HttpServletResponse response) {
...
}
Now, for GET operations this works as expected. When I try to read the body of
a POST request using the javax.servlet.ServletRequest.getInputStream(), the
returned InputStream ist empty.
According to JAX-RS spec, I guess I could extend my method to something like
@POST
public void doPost(@Context HttpServletRequest request,
@Context HttpServletResponse response, String body) {
...
}
in order to get the body. However, I'd like to avoid that because I don't want
to change the existing application implementation too much.
So I have 2 questions:
1. Why does javax.servlet.ServletRequest.getInputStream() return an
InputStream that contains no data whe I using CXF? This work fine in the old
style of the application.
2. What can I do to be able to read the body that way using CXF?
Viele Grüße,
Julien
Avitech GmbH
Engineering AxL
Tel.: +49 (0)7541/282-177
Fax: +49 (0)7541/282-199
e-mail: [email protected]<mailto:[email protected]>
________________________________________________
Avitech GmbH
Principal Office: Bahnhofplatz 1 | 88045 Friedrichshafen | Germany
Court Registration: Amtsgericht Ulm | HRB 728293
Geschäftsführer/Managing Director: Antonio Maria Gonzalez Gorostiza
http://avitech.aero<http://avitech.aero/>
This message may contain confidential information and is intended only for the
individual named. If you are not the named addressee you should not
disseminate, distribute or copy this e-mail. Please notify the sender
immediately by e-mail if you have received this e-mail by mistake and delete
this e-mail from your system.