简体   繁体   English

部署在JBoss上的RESTful服务没有响应

[英]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.

相关问题 来自Jboss 7.1.1中部署的RESTful Web服务的HTTP错误404 - HTTP error 404 from a RESTful web service deployed in Jboss 7.1.1 未部署使用在Eclipse IDE中开发的Jersey实现的Java Restful Web Service,并在JBoss服务器上调用 - Java Restful Web Service using Jersey implementation developed in Eclipse IDE not deployed and call on JBoss server JBoss RESTful服务中的漂亮打印JSON输出 - Pretty print JSON output in JBoss RESTful service jboss as7.1.1上的restful服务启动 - restful service on jboss as7.1.1 start up 如何使用@GET从RESTful服务响应List &lt;&gt; - How to respond List<> from a RESTful Service using @GET 如何在JBoss AS上使用Java Restful Web服务启用CORS - How to enable CORS with a java restful web service on JBoss AS 在tomcat 6和centos中部署的Web服务稳定时出错 - Error when deployed web service restful in tomcat 6 and centos 带有 Jersey 的 JAX-RS:测试部署在 weblogic/JBoss 中的 REST 服务 - JAX-RS with Jersey: Testing REST service deployed in weblogic/JBoss 是否可以以某种方式从部署在BEA AquaLogic Service Bus上的业务服务调用部署在JBoss上的EJB? - Is it possible to call in some way an EJB deployed on JBoss from a Business Service deployed on BEA AquaLogic Service Bus? 回复安静的电话 - Respond to a Restful call
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM