0

I have below code INTERFACE consuming application xml

@Path("/user")
public interface UserService {
@CONSUMES(MediaType.APPLICATION_XML)
    @POST
    @Path("/{userId}")
    public Response creaTeUser(@PathParam("userId") Long userId);

}
 I have implementation which consume application JSON

class UserServiceImpl implements UserService {

    @Override
    @POST
    @Path("/{userId}")
@CONSUMES(MediaType.APPLICATION_JSON)
    public Response getUser(@PathParam("userId") Long userId) {
        // TODO Auto-generated method stub
        return null;
    }

}

when i do post user what will be actual media type

user2656713
  • 31
  • 1
  • 8

1 Answers1

0

Java method annotations do not support inheritance, so your media type would be application/json. See this answer: Why java classes do not inherit annotations from implemented interfaces?

Community
  • 1
  • 1
Chris Fei
  • 1,327
  • 8
  • 11