开发者

Request Accept media type in RESTlet 2

开发者 https://www.devze.com 2023-01-15 16:52 出处:网络
How can I identify the resource media type in RESTlet2, I tried following in my class extended from ServerResource

How can I identify the resource media type in RESTlet2, I tried following in my class extended from ServerResource

开发者_C百科
 @Get
 public Object onGET(){
  System.out.println("=================");
  System.out.println(this.getRequestEntity().getMediaType());
...

It prints a null when I do any request. I want to get the list of all Accept media types in header.


Well seems like I figured it out:


Request.getCurrent().getClientInfo().getAcceptedMediaTypes();

Returns list of all accepted media types.

0

精彩评论

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