当资源方法返回void或null时,我可以让Jersey使用我的MessageBodyWriter而不是返回204吗?

时间:2013-01-29 20:15:53

标签: jersey jax-rs

我希望能够编写这样的方法:

@GET
@Template(SIGNUP_FORM)
@Produces("text/html")
public void form() {}

我的MessageBodyWriter匹配使用@Template注释的方法,因此这应该可以正常工作。但是,Jersey会跳过我的MessageBodyWriter并返回204(无内容)。要解决这个问题,我必须做这样的事情:

@GET
@Template(SIGNUP_FORM)
@Produces("text/html")
public Object form() { return new Object(); }

我也不能返回null。

0 个答案:

没有答案
相关问题