首页 > 编程知识 正文

jaxb修改节点名称,javafinal关键字

时间:2023-05-05 20:05:42 阅读:112090 作者:4390

您将要使用@Produces、@ Consumes注释和JAXB创建并运行JAX-RS的简单示例。

@Stateless

@LocalBean

@path(/hotel ) ) )。

公共类rest main {

@GET

@ produces (media type.application _ XML )。

@path () hotelid () ) )

publichotelrestinforead (@ path param ) ' hotelid ' ) long hotelId )。

hoteldatasourcefakehoteldatasourcefake=newhoteldatasourcefake (;

hotelrestinfohotelinfo=hoteldatasourcefake.getfakeplacebyid (hotelid );

返回酒店信息;

}

}

在web.xml中:

REST App

com.sun.jersey.SPI.container.servlet容器

1

jersey网络APP

/rest/*

第二个APP应用程序是客户端

现在有以下客户端代码。

import com.sun.jersey.API.client.client;

import com.sun.jersey.API.client.client response;

import com.sun.jersey.API.client.webresource;

.

客户端客户端=client.create (;

string uri=' http://localhost :8080/rest JEE/rest/hotel/' hotelid;

webresource resource=client.resource (uri;

clientresponseresponse=resource.accept (application/XML ).get (客户端响应. class );

hotelrestinfohotelrestinfo=response.get entity (hotelrestinfo.class );

但是,我不想使用jersey的客户端、客户端响应和WebResource。

我想在@Consumes上做这个。

客户端appliaction web.xml是否需要包含其他参数?

双方(客户端和服务器)都包含HotelRESTInfo类。

@ XML路由

公共类热点

.

}

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。