[英]RESTful service deployed on JBoss does not respond
I have a problem testing a simple Restful service on JBoss. 我在JBoss上测试简单的Restful服务时遇到问题。
I have built the project and deployed to JBoss fine. 我已经建立了项目,并部署到JBoss很好。 This is my Deployer written using Java: 这是我使用Java编写的Deployer:
import javax.ws.rs.core.Application;
public class Deployer extends Application {
}
This is my web.xml: 这是我的web.xml:
<?xml version="1.0"?>
<web-app>
<servlet-mapping>
<servlet-name>com.mxyy.orderservice.deploy.Deployer</servlet-name>
<url-pattern>/orderservice/*</url-pattern>
</servlet-mapping>
</web-app>
This is my Restful service interface written in Scala: 这是我用Scala编写的Restful服务接口:
@Provider
@Path("/customers")
trait ICustomerService {
@POST
@Consumes(Array("application/xml"))
def createCustomer(is: InputStream): Response
@GET
@Path("{id}")
@Produces(Array("application/xml"))
def getCustomer(@PathParam("id") id: Int): StreamingOutput
@PUT
@Path("{id}")
@Consumes(Array("application/xml"))
def updateCustomer(@PathParam("id") id: Int, is: InputStream): Unit
}
This interface is implemented. 该接口已实现。
After I deployed to JBoss, I tried to access the service by typing: 部署到JBoss之后,我尝试通过键入以下内容来访问该服务:
http://localhost:8080/orderservice/customers/1
The browser respond with 浏览器回应
HTTP Status 404 - /orderservice/customers/1
type Status report
message /orderservice/customers/1
description The requested resource (/orderservice/customers/1) is not available.
Can someone point out what I did wrong? 有人可以指出我做错了什么吗?
Many thanks. 非常感谢。
i think everything is fine there except a small mistake that's "/". 我认为除了一个小错误“ /”,那里一切都很好。 just edit as: 只需编辑为:
@Provider
@Path("/customers")
trait ICustomerService {
@POST
@Consumes(Array("application/xml"))
def createCustomer(is: InputStream): Response
@GET
@Path("/{id}")
@Produces(Array("application/xml"))
def getCustomer(@PathParam("id") id: Int): StreamingOutput
@PUT
@Path("/{id}")
@Consumes(Array("application/xml"))
def updateCustomer(@PathParam("id") id: Int, is: InputStream): Unit
}
Inform me if it works. 如果有效,请通知我。 :) :)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.