【发布时间】:2021-04-14 01:20:40
【问题描述】:
我有以下使用jax-rs 框架的POST 端点:
@POST
@NoCache
@Path("/{client}/email/template/type/{type}")
public void sendEmail(
@PathParam("client") String client,
@PathParam("type") String communicationTemplateType) {
emailService.sendEmail(client, communicationTemplateType);
}
每当我点击此端点时,我都会收到以下错误,错误代码为415:
JBWEB000135: The server refused this request because the request entity is in a format not supported by the requested resource for the requested method.
我的端点有什么问题?
【问题讨论】:
-
资源上是否有任何其他注释(即在类级别)?您的 POST 请求发送哪些标头?
-
1.提示:始终使用
@Consumes和@Produces注释。 2.您是否尝试在正文中发送实体?如果是这样,您必须有一个参数来支持该实体。 3. 确保使用正确的 Content-Type 标头...应该处理所有这三件事。 -
还可以显示您是如何发送请求的?
-
你解决了我在之前评论中提到的所有问题吗?添加赏金而不使用 cmets 的请求更新您的帖子是没有意义的。那时没有人能回答你的问题,他们也无法回答,因为你添加了赏金。只是浪费你的网点。如需更好的帮助,请阅读我以前的 cmets 并更新您的帖子。
标签: java rest post jax-rs http-status-code-415