![](/img/trans.png)
[英]How to send list of parameters in an array in Restful webservice
[英]How to list all request parameters in springboot webservice?
我正在嘗試將應用程序從spring轉換為springboot,springboot應用程序中的Web服務參數有問題。
這是我的春季申請:
@GET
@Path("/personels")
public Response getAllPersonels(@Context HttpHeaders headers, @Context Request request) {
String url = String.valueOf(((ContainerRequest) request).getRequestUri());
System.out.println(url);
return Response.status(Status.OK).entity(new Personel()).type(MediaType.APPLICATION_XML).build();
}
這也是我的springboot應用程序:
@RequestMapping("/personels")
public Response saveWebService(@Context HttpHeaders headers, @Context Request request) {
String url = String.valueOf(((ContainerRequest) request).getRequestUri());
System.out.println(url);
return Response.status(Status.OK).entity(new Personel()).type(MediaType.APPLICATION_JSON).build();
}
這是springboot錯誤
{
"timestamp": 1500382494978,
"status": 500,
"error": "Internal Server Error",
"exception": "org.springframework.beans.BeanInstantiationException",
"message": "Failed to instantiate [javax.ws.rs.core.HttpHeaders]: Specified class is an interface",
"path": "/personels/"
}
這些只是示例,但將來我將使用所有請求參數(方法,標頭,實體,類型..)
這個問題有注釋嗎?
問題是有關Jax-RS和spring mvc混合的。 我注意到了@M。 Deinum和@Viswanath Lekshmanan
最后,我改變了這樣的方法參數;
@RequestMapping("/virtual")
public Response saveWebService(HttpServletRequest request){
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.