开发者

How to set an HTTP error code in JAX-RS

开发者 https://www.devze.com 2023-01-17 20:27 出处:网络
I have a web service using jar-rs. 开发者_如何学编程How do I throw a custom http error code to the calling application?

I have a web service using jar-rs. 开发者_如何学编程How do I throw a custom http error code to the calling application?

Thanks


The Response class lets you create a response with a specific HTTP Status. You can also extend WebApplicationException.

There are a couple of examples in the JAX-RS 1.0 features overview docs, in the 'Building Responses' and 'WebApplicationException and mapping Exceptions to Responses' sections that will tell you all you need to know to get started.

0

精彩评论

暂无评论...
验证码 换一张
取 消