FYI: Just using resteasy to access the service layer, which returns xml, then using xslt to translate it for view. But... issues below
If you can fix it, pls let me known kindly. Regards!
web.xml
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd" >
<web-app>
<display-name>Archetype Created Web Application</display-name>
<context-param>
<param-name>resteasy.scan</param-name>
<param-value>true</param-value>
</context-param>
<!--
<context-param>
<param-name>resteasy.resources</param-name>
<param-value>com.eric.bms.service.BookService</param-value>
</context-param>
-->
<context-param>
<param-name>resteasy.servlet.mapping.prefix</param-name>
<param-value>/resource</param-value>
</context-param>
<listener>
<listener-class>
org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap
</listener-class>
</listener>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<servlet>
<servlet-name>Resteasy</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
<init-param>
<param-name>ContextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>Resteasy</servlet-name>
<url-pattern>/resource/*</url-pattern>
</servlet-mapping>
</web-app>
Bean in applicationContext.xml
<bean id="bookDao" class="com.eric.bms.dao.impl.BookDaoImpl" autowire="byName"/>
<bean id="bookService" class="com.eric.bms.service.impl.BookServiceImpl" autowire="byName"/>
The test page
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Show all the books here</title>
<%String path = request.getContextPath(); %>
<script src="<%=path %>/js/book.js" type="text/javascript"></script>
</head>
<body onload='display("<%=path %>/resource/bs/list", "<%=path %>/xsl/bsummary.xsl", "books")'>
<div id="books" align="center"></div>
</body>
</html>
BookService
@Path("bs")
public interface BookService {
@GET
@Produces(MediaType.APPLICATION_XML)
@Path("/list/")
BookSummary list();
}
BookServiceImpl
public class BookServiceImpl implements BookService {
private BookDao bookDao;
public BookSummary list() {
BookSummary summary = new BookSummary();
List<Book> list = bookDao.getAll();
for(Book book : list) {
summary.getList().add(book);
}
return summary;
}
}
分享到:
相关推荐
Spring整合RestEasy示例工程源码,Spring+Jetty+RestEasy
Resteasy + Spring + Netty sample Inject resteasy provider / controllers as spring bean Authentication Run at Main.java Test http://localhost:8082/resteasy/hello/world 教程 jax-rs规范用法: ...
另外,此RESTEasy Spring Boot启动程序将按预期方式与Spring集成,这意味着每个也是Spring Bean的JAX-RS REST资源都将被自动自动扫描,集成和可用。 产品特点 为Spring Boot应用程序启用RESTEasy 作为Spring bean...
resteasy-spring-netty Resteasy + Spring + Netty sample Inject resteasy provider / controllers as spring bean Authentication ===================== Run at Main.java Test 教程 jax-rs规范用法: resteasy ...
POC 网址 Resteasy Jaxrs 1.0 Spring
宁静的春天 Resteasy + Spring + Netty示例 作为spring bean注入resteasy提供者/控制器 验证 ==================== 在Main.java中运行 测试
任何想要具有REST端点并且更喜欢RESTEasy作为JAX-RS实现的常规Spring Boot应用程序都可以使用此Spring Boot启动器。 另外,此RESTEasy Spring Boot启动程序将按预期方式与Spring集成,这意味着每个也是Spring Bean...
该项目为 Spring Boot 应用程序提供 RESTEasy 自动配置。入门构建此项目并将其安装到您的 Maven 存储库中: $ mvn install然后,您应该在应用程序的build.gradle或pom.xml添加对org.springframework.boot:spring-...
RestEasy-3.09-Spring-3.2.5-Swagger2.0 Jboss EAP 6(Jboss 7)RestEasy 3.09 Spring 3.2.5 Swagger 2.0与Web.xml和Bean配置的Swagger UI集成 为此,您必须将RestEasy安装升级到3.09 说明来自: : Resteasy与...
resteasy
appengine-骨架 这是从 appengine-skeleton 原型生成的应用程序。
resteasy讲解
详细描述了restEasy在servlet3.0前后的不同使用方法;restEasy 结合httpServer 无需容器开发;restEasy的通用差错拦截;附详细实现源码!
resteasy入门级文档、如何使用Restful进行WebService的开发简介及相关RestEasy相关资源的链接
resteasy简单demo使用的jar包
RESTEasy入门经典.docx
resteasy不使用tomcat使用netty实现,实现了高性能,也可以不需要tomcat的容器,一个主函数就能执行
该资源是java restful的应用框架resteasy---实现了jax-rs规范的一个demo,如有疑问请联系caizhh2009@gmail.com
使用RESTEasy+guice实现上传下载文件
resteasy-jaxrs-2.3.2框架源码。希望您了解Resteasy框架有所帮助