两RESTEasy战争,没有问题的问题电影,怎么解决

解决RestEasy 框架中文乱码
是实现REST风格webservice的主流框架之一。该框架易学易用,但是涉及到乱码问题,官方文档没有说明。为了解决中文乱码自己研究摸索,研究结果如下:
首先,客户端和服务器的字符编码要一致,然后新建一个filter
,设置请求的字符编码。
public class SetCharacterEncodingFilter implements Filter{
&&&&&&&&public void destroy(){
public void doFilter(ServletRequest request,ServletResponseresponse,
&&&&&&&&&&&&&&&&&&&&&&&&FilterChainchain) throws IOException, ServletException{
&&&&&&&&&&&&&&&&request.setCharacterEncoding(&UTF-8&);
&&&&&&&&&&&&&&&&//传递控制到下一个过滤器
&&&&&&&&&&&&&&&&chain.doFilter(request,response);
public void init(FilterConfig filterConfig) throws ServletException{
&&&&&&&&&filter&
&&&&&&&&&&&&&&&&&filter-name&SetCharacterEncoding&/filter-name&
&&&&&&&&&&&&&&&&&filter-class&com.mazq.SetCharacterEncodingFilter&/filter-class&
&&&&&&&&&/filter&
&&&&&&&&&filter-mapping&
&&&&&&&&&&&&&&&&&filter-name&SetCharacterEncoding&/filter-name&
&&&&&&&&&&&&&&&&&url-pattern&/*&/url-pattern&
&&&&&&&&&/filter-mapping&&&&&&&&&
响应乱码的原因是没有设置响应的字符编码,如下代码设置响应的字符编码。
&&&&&&&&&&&&&&&&ResponseBuilderresponse =Response.ok();
&&&&&&&&&&&&&&&&response.header(&Content-Type&,&text/charset=UTF-8&);
&&&&&&&&&&&&&&&&returnresponse.entity(&响应&).build();
看过本文的人也看了:
我要留言技术领域:
取消收藏确定要取消收藏吗?
删除图谱提示你保存在该图谱下的知识内容也会被删除,建议你先将内容移到其他图谱中。你确定要删除知识图谱及其内容吗?
删除节点提示无法删除该知识节点,因该节点下仍保存有相关知识内容!
删除节点提示你确定要删除该知识节点吗?-------------
新增文件夹...
新增文件夹
(多个标签用逗号分隔)
RESTEasy 技术说明.docx
RESTEasy是JBoss的一个开源项目,提供各种框架帮助你构建RESTful Web Services和RESTful Java应用程序。它是JAX-RS规范的一个完整实现并通过JCP认证。作为一个JBOSS的项目,它当然能和JBOSS应用服务器很好地集成在一起。但是,它也能在任何运行JDK5或以上版本的Servlet容器中运行。RESTEasy还提供一个RESTEasy JAX-RS客户端调
RESTEasy是JBoss的一个开源项目,提供各种框架帮助你构建RESTful Web Services和RESTful Java应用程序。它是JAX-RS规范的一个完整实现并通过JCP认证。作为一个JBOSS的项目,它当然能和JBOSS应用服务器很好地集成在一起。但是,它也能在任何运行JDK5或以上版本的Servlet容器中运行。RESTEasy还提供一个RESTEasy JAX-RS客户端调用框架。能够很方便与EJB、Seam、Guice、Spring和Spring MVC集成使用。支持在客户端与服务器端自动实现GZIP解压缩。&&
加载中...!
如果长时间没有加载,请点击
来安装或允许flash插件运行!
下载本文档需要登录,并付出相应积分()。
文件大小:134.17 KB
所需积分:& 10
相关资讯  — 
相关讨论话题  — 
浏览:4887次&& 下载:2次
格式:docx
上传时间: 23:07:51
同类热门文档
21083次浏览 &58次下载
9515次浏览 &30次下载
19218次浏览 &35次下载
10069次浏览 &4次下载
7584次浏览 &15次下载
0次浏览 &12次下载
相关经验 -
& 1人评&0页
& 4人评&55页
& 0人评&2页
& 2人评&150页
& 2人评&25页
OPEN-OPEN, all rights reserved.I was working in Resteasy where I've to make a asynchronous request to server. The real purpose is, I'll be submitting a form which will be converted into a .xlsx file which will take atleast 10 seconds to complete. So Asynchronous request is the best way here. I followed the procedures from the following link.
I'm making the ajax request like this.
url : 'rest/parentPath/childPath',
type : 'GET',
success : function(data, status, xhr) {
console.log(xhr.getResponseHeader('Location'));
failure : function(data) {
console.log(data);
error : function(error,status) {
ParentClass.java
import javax.ws.rs.container.AsyncR
import javax.ws.rs.container.S
@Component
@Path("/parentPath")
public class ParentClass {
@Path("childPath")
@Produces("text/plain")
public void asyncFunction(@Suspended final AsyncResponse response){
Thread t = new Thread() {
public void run()
Response jaxrs = Response.ok("basic").type(MediaType.TEXT_PLAIN).build();
System.out.println("entered======================= =================================================");
response.resume(jaxrs);
catch (Exception e){
e.printStackTrace();
t.start();
If I simply make a ajax request, it gives me 503 Service unavailable error but I do get my Asynchronous task executed, I can confirm by seeing my sysout present in wildfly log. But this is not a way how a asynchronous should be done. I've to be able to see the response of my asynchronous task in the second request. I followed the procedures in this link.
If I put ?asynch=true in the request url, immediately i get a response of 202 Accepted with a location of asynchronous job in response. But it didn't even entered into the try statement. An error is thrown in the wildfly terminal like this.
19:11:41,733 WARN
[org.jboss.resteasy.core.ExceptionHandler] (pool-4-thread-1) Failed executing GET /parentPath/childPath: org.jboss.resteasy.spi.BadRequestExcept
ion: Failed processing arguments of org.jboss.resteasy.spi.metadata.ResourceMethod@44d4407c
at org.jboss.resteasy.core.MethodInjectorImpl.injectArguments(MethodInjectorImpl.java:104) [resteasy-jaxrs-3.0.10.Final.jar:]
at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:112) [resteasy-jaxrs-3.0.10.Final.jar:]
at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:296) [resteasy-jaxrs-3.0.10.Final.jar:]
at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:250) [resteasy-jaxrs-3.0.10.Final.jar:]
at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:237) [resteasy-jaxrs-3.0.10.Final.jar:]
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:356) [resteasy-jaxrs-3.0.10.Final.jar:]
at org.jboss.resteasy.core.AsynchronousDispatcher.invokeSuper(AsynchronousDispatcher.java:237) [resteasy-jaxrs-3.0.10.Final.jar:]
at org.jboss.resteasy.core.AsynchronousDispatcher$1.call(AsynchronousDispatcher.java:278) [resteasy-jaxrs-3.0.10.Final.jar:]
at org.jboss.resteasy.core.AsynchronousDispatcher$1.call(AsynchronousDispatcher.java:269) [resteasy-jaxrs-3.0.10.Final.jar:]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [rt.jar:1.8.0_25]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0_25]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0_25]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_25]
Caused by: java.lang.NullPointerException
at org.jboss.resteasy.core.ResourceMethodInvoker.initializeAsync(ResourceMethodInvoker.java:374) [resteasy-jaxrs-3.0.10.Final.jar:]
at org.jboss.resteasy.core.AsynchronousResponseInjector.inject(AsynchronousResponseInjector.java:43) [resteasy-jaxrs-3.0.10.Final.jar:]
at org.jboss.resteasy.core.MethodInjectorImpl.injectArguments(MethodInjectorImpl.java:89) [resteasy-jaxrs-3.0.10.Final.jar:]
... 12 more
If I made the same request again with asynch=true, it shows the same error but with (pool-4-thread-2) instead of (pool-4-thread-1)
This means exception is not occured at the server side but at the runtime layer. Coz any exception occured inside my code will be present in log file but not in wildfly terminal. I'll post the web.xml, WebConfig.java, build.gradle files. I'm just replicating the same thing which is done in jboss docs, but I cant figure out why is this exception occuring at the wildfly layer.
&?xml version="1.0" encoding="UTF-8"?&
&web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0"&
&display-name&Web Application&/display-name&
&distributable /&
&listener&
&listener-class&org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap&/listener-class&
&/listener&
&listener&
&listener-class&org.jboss.resteasy.plugins.spring.SpringContextLoaderListener&/listener-class&
&/listener&
&!-- Context Configuration locations for Spring XML files --&
&context-param&
&param-name&contextConfigLocation&/param-name&
&param-value&
classpath:/applicationContext-resources.xml
classpath:/applicationContext-dao.xml
classpath:/applicationContext-service.xml
classpath*:/applicationContext.xml
/WEB-INF/applicationContext*.xml
&/param-value&
&/context-param&
&context-param&
&param-name&resteasy.servlet.mapping.prefix&/param-name&
&param-value&/rest&/param-value&
&/context-param&
&context-param&
&param-name&resteasy.async.job.service.enabled&/param-name&
&param-value&true&/param-value&
&/context-param&
&context-param&
&param-name&resteasy.async.job.service.max.job.results&/param-name&
&param-value&100&/param-value&
&/context-param&
&!-- Maximum wait time on a job when a client is querying for it --&
&context-param&
&param-name&resteasy.async.job.service.max.wait&/param-name&
&param-value&300000&/param-value&
&/context-param&
&!-- Thread pool size of background threads that run the job --&
&context-param&
&param-name&resteasy.async.job.service.thread.pool.size&/param-name&
&param-value&100&/param-value&
&/context-param&
&!-- Set the base path for the Job uris --&
&context-param&
&param-name&resteasy.async.job.service.base.path&/param-name&
&param-value&/asynch/jobs&/param-value&
&/context-param&
&servlet-name&resteasy-servlet&/servlet-name&
&servlet-class&org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher&/servlet-class&
&init-param&
&param-name&javax.ws.rs.Application&/param-name&
&param-value&com.mypackage.service.WebConfig&/param-value&
&/init-param&
&load-on-startup&1&/load-on-startup&
&/servlet&
&servlet-mapping&
&servlet-name&resteasy-servlet&/servlet-name&
&url-pattern&/rest/*&/url-pattern&
&/servlet-mapping&
&welcome-file-list&
&welcome-file&login.html&/welcome-file&
&/welcome-file-list&
&/web-app&
WebConfig.java
import java.util.HashS
import java.util.S
import javax.ws.rs.core.A
public class WebConfig extends Application {
private Set&Object& singletons = new HashSet&Object&();
private Set&Class&?&& empty = new HashSet&Class&?&&();
public WebConfig() {
// ADD YOUR RESTFUL RESOURCES HERE
this.singletons.add(new SignupService());
this.singletons.add(new UserService());
this.singletons.add(new ParentClass());
public Set&Class&?&& getClasses()
return this.
public Set&Object& getSingletons()
return this.
Build.gradle
apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'eclipse-wtp'
apply plugin: 'eclipse'
// Uses JDK 8
sourceCompatibility = 1.8
targetCompatibility = 1.8
// 1. Get dependencies from Maven local repository
// 2. Get dependencies from Maven central repository
repositories {
mavenLocal()
mavenCentral()
url "http://repo1.maven.org/maven2"
configurations {
sourceSets {
main { compileClasspath += configurations.provided }
//Project dependencies
dependencies {
//Spring framework core
compile 'org.springframework:spring-web:4.1.4.RELEASE'
compile 'org.springframework:spring-core:4.1.4.RELEASE'
compile 'org.springframework:spring-context:4.1.4.RELEASE'
compile 'org.springframework:spring-context-support:4.1.4.RELEASE'
compile 'org.springframework:spring-orm:4.1.4.RELEASE'
compile 'org.springframework.security:spring-security-core:4.0.0.RELEASE'
//MySQL database driver
//compile 'mysql:mysql-connector-java:5.1.34'
compile 'com.oracle:ojdbc6:11.2.0.1.0'
//Hibernate framework
compile 'org.hibernate:hibernate-core:4.3.8.Final'
compile 'commons-dbcp:commons-dbcp:1.2.2'
//Servlet API
compile 'javax.servlet:servlet-api:2.5'
//Base-64 Apache commons
compile 'commons-codec:commons-codec:1.10'
compile 'log4j:log4j:1.2.17'
compile 'org.slf4j:slf4j-simple:1.7.10'
//XmlBeans Equity Valuation
compile 'org.apache.xmlbeans:xmlbeans:2.6.0'
//Poi Equity Valuation
compile 'org.apache.poi:poi:3.10.1'
//Poi ooxml Equity Valuation
compile 'org.apache.poi:poi-ooxml:3.10.1'
//Poi ooxml Schemas Equity Valuation
compile 'org.apache.poi:poi-ooxml-schemas:3.10.1'
//Jacob Equity Valuation
compile 'jacob:jacob:1.18-M2'
//Google gson
compile 'com.google.code.gson:gson:2.3.1'
provided 'org.jboss.resteasy:resteasy-jaxrs:3.0.11.Final'
provided 'org.jboss.resteasy:resteasy-spring:3.0.11.Final'
解决方案 Tried to add in the comment but word limit.
I am able to do the asynchronous job now. I found that using the AsynchResponse and the and the Suspended annotations are causing this Exception. this is not required for asynchronous job processing.The reason for your null pointer is that
there is a mix up for the two.
There are two asynchronous things and the documentation really mixes them up
1. Asynchronous response : Using Suspended and AsynchResponse will free the server thread that received the request and the work will be done by the new thread created. But the client will wait for the response. Until your new thread completes and sends it back. For this no changes are required to the web.xml.
2. Asynchronous Job processing : Here the you set the
resteasy.async.job.service.enabled to true in the web.xml and any other optional parameters (if required). No other changes are required to the APi. My method was
@Path("/helloworld")
public Response getHelloWorld() {
log.info("API invoked");
longLiftingJob();
log.info("API invoke done");
return Response.status(200).entity("Hello World").build();
With the true parameter in the web.xml the framework will invoke you call in a new thread (simply put) and return with the job id for the same in the 202 response. as Location header as
Location → http://127.0.0.1:8080/myrest/asynch/jobs/8-1
The client does a GET / POST on the above url and will get the response as returned by the API once the API finishes. But the actual client never waits so asynchronous job.
本文地址: &
我在RestEasy的工作,我已经做出异步请求到服务器。真正的目的是,我将提交将被转换成一个.xlsx文件将于ATLEAST 10秒填写一份表格。因此,异步请求是这里的最佳方式。我遵循的程序从以下链接。 https://docs.jboss.org/resteasy/docs/3.0.9.Final/userguide/html_single/#Asynchronous_HTTP_Request_Processing我正在做这样的Ajax请求。
$。阿贾克斯({
网址:'休息/ parentPath / childPath',
输入:“GET”,
成功:功能(数据,状态XHR){
的console.log(xhr.getResponseHeader('位置'));
失败:功能(数据){
的console.log(数据);
错误:功能(错误,状态){
ParentClass.java
进口javax.ws.rs.container.AsyncR进口javax.ws.rs.container.S@零件@Path(“/ parentPath”)公共类父类{
@Path(“childPath”)
@Produces(“text / plain的”)
公共无效asyncFunction(@Suspended最终AsyncResponse响应){
线程t =新的Thread(){
公共无效的run()
。响应JAXRS = Response.ok(“基础”)类型(MediaType.TEXT_PLAIN).build();
的System.out.println(“进入======================= =================== ==============================“);
response.resume(JAXRS);
赶上(例外五){
e.printStackTrace();
t.start();
}} 如果我只是做一个Ajax请求,它给了我 503服务不可用错误,但我得到我的异步任务执行,我可以看到我的SYSOUT $ P $确认psent在wildfly日志。但是,这不是一个方式异步应该如何完成。我已经能够看到我的异步任务的第二个请求的响应。我遵循的程序在这个环节。的如果我把?非同步= TRUE 请求URL,我立刻让 202接受与响应异步工作在响应的位置。但它甚至没有进入try语句。引发错误在这样的wildfly终端。
19:11:41733警告[org.jboss.resteasy.core.ExceptionHandler](池4线程1)未能执行GET / parentPath / childPath:org.jboss。 resteasy.spi.BadRequestExcept离子:org.jboss.resteasy.spi.metadata.ResourceMethod@44d4407c的失败处理参数
在org.jboss.resteasy.core.MethodInjectorImpl.injectArguments(MethodInjectorImpl.java:104)RestEasy的-JAXRS-3.0.10.Final.jar:]
在org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:112)RestEasy的-JAXRS-3.0.10.Final.jar:]
在org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:296)RestEasy的-JAXRS-3.0.10.Final.jar:]
在org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:250)RestEasy的-JAXRS-3.0.10.Final.jar:]
在org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:237)RestEasy的-JAXRS-3.0.10.Final.jar:]
在org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:356)RestEasy的-JAXRS-3.0.10.Final.jar:]
在org.jboss.resteasy.core.AsynchronousDispatcher.invokeSuper(AsynchronousDispatcher.java:237)RestEasy的-JAXRS-3.0.10.Final.jar:]
在org.jboss.resteasy.core.AsynchronousDispatcher $ 1.call(AsynchronousDispatcher.java:278)RestEasy的-JAXRS-3.0.10.Final.jar:]
在org.jboss.resteasy.core.AsynchronousDispatcher $ 1.call(AsynchronousDispatcher.java:269)RestEasy的-JAXRS-3.0.10.Final.jar:]
在java.util.concurrent.FutureTask.run(FutureTask.java:266)的rt.jar:1.8.0_25]
在java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)的rt.jar:1.8.0_25]
在java.util.concurrent.ThreadPoolExecutor中的$ Worker.run(ThreadPoolExecutor.java:617)的rt.jar:1.8.0_25]
在java.lang.Thread.run(Thread.java:745)的rt.jar:1.8.0_25]显示java.lang.NullPointerException:产生的原因
在org.jboss.resteasy.core.ResourceMethodInvoker.initializeAsync(ResourceMethodInvoker.java:374)RestEasy的-JAXRS-3.0.10.Final.jar:]
在org.jboss.resteasy.core.AsynchronousResponseInjector.inject(AsynchronousResponseInjector.java:43)RestEasy的-JAXRS-3.0.10.Final.jar:]
在org.jboss.resteasy.core.MethodInjectorImpl.injectArguments(MethodInjectorImpl.java:89)RestEasy的-JAXRS-3.0.10.Final.jar:]
... 12更多 如果我再次提出同样的要求非同步= TRUE ,它显示了同样的错误,但(池4线程2) 而不是(池4线程1) 这意味着异常没有在服务器端,但在运行时发生层。怎么把我的code内发生任何异常将在日志文件present但不是在wildfly终端。我会发布了web.xml,WebConfig.java,的build.gradle文件。我只是复制其在JBoss文档做同样的事情,但我不能弄清楚为什么这个例外在wildfly层存在的。在web.xml
<?XML版本=“1.0”编码=“UTF-8”&GT?;< web应用程序的xmlns =“http://java.sun.com/xml/ns/javaee”的xmlns:XSI =“http://www.w3.org/2001/XMLSchema-instance”XSI:的schemaLocation =“ http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd“版本=”3.0“>
&显示-名称& Web应用程序< /显示-名称&
<分配/>
<听者GT;
&listener-class&org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap&/listener-class&
< /听者GT;
<听者GT;
&listener-class&org.jboss.resteasy.plugins.spring.SpringContextLoaderListener&/listener-class&
< /听者GT;
<! - 为Spring XML文件上下文配置的位置 - >
<的context-param>
<参数-名称&&contextConfigLocation的LT; /参数 - 名称&
<参数值>
类路径:/applicationContext-resources.xml
类路径:/applicationContext-dao.xml
类路径:/applicationContext-service.xml
类路径*:/ applicationContext.xml中
/WEB-INF/applicationContext*.xml
< /参数值>
< /的context-param>
<的context-param>
<参数名方式& resteasy.servlet.mapping preFIX< /参数 - 名称&
<参数值> /休息< /参数值>
< /的context-param>
<的context-param>
<参数-名称&&resteasy.async.job.service.enabled LT; /参数 - 名称&
<参数值>真< /参数值>
< /的context-param>
<的context-param>
<参数-名称&&resteasy.async.job.service.max.job.results LT; /参数 - 名称&
&所述; PARAM-值GT; 100℃/参数值>
< /的context-param>
<! - 最长等待时间当客户端查询它的作业 - >
<的context-param>
<参数-名称&&resteasy.async.job.service.max.wait LT; /参数 - 名称&
<参数值> 300000< /参数值>
< /的context-param>
<! - 那运行作业后台线程线程池的大小 - >
<的context-param>
<参数-名称&&resteasy.async.job.service.thread.pool.size LT; /参数 - 名称&
&所述; PARAM-值GT; 100℃/参数值>
< /的context-param>
<! - 设置作业的基本路径的URI
<的context-param>
<参数-名称&&resteasy.async.job.service.base.path LT; /参数 - 名称&
<参数值> /非同步/工作与LT; /参数值>
< /的context-param>
<&servlet的GT;
< servlet的名称& RestEasy的-的servlet< / servlet的名称&
&servlet-class&org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher&/servlet-class&
<初始化参数>
<参数-名称&&javax.ws.rs.Application LT; /参数 - 名称&
<参数值> com.mypackage.service.WebConfig< /参数值>
< /初始化参数>
&所述;负载上启动→1&下; /负载上启动>
< / servlet的>
< Servlet映射>
< servlet的名称& RestEasy的-的servlet< / servlet的名称&
< URL模式> / REST / *< / URL模式>
< / Servlet映射>
<欢迎-文件列表&
<欢迎-文件&&login.html的LT; /欢迎-文件&
< /欢迎-文件列表&< / web-app的>
WebConfig.java
进口java.util.HashSet中;进口java.util.Set中;进口javax.ws.rs.core.A公共类WebConfig扩展应用{
私人设置<对象&单身=新的HashSet<对象&();
私人设置<班级<>>空=新的HashSet<班级<>>();
公共WebConfig(){
//此处添加您的RESTful资源
this.singletons.add(新SignupService());
this.singletons.add(新UserService());
this.singletons.add(新父类());
公开组<班级<>> getClasses()
公开组<对象& getSingletons()
}} 的build.gradle
应用插件:“Java的应用插件:“战争”应用插件:“Eclipse的WTP”应用插件:“日蚀”//使用JDK 8sourceCompatibility = 1.8targetCompatibility = 1.8// 1. Maven的本地仓库获取依赖// 2. Maven的中央存储库中获得的依赖库{
mavenLocal()
mavenCentral()
网址“http://repo1.maven.org/maven2”
sourceSets {
主要{compileClasspath + = configurations.provided}}//项目依赖依赖{
// Spring框架的核心
编译“org.springframework:弹簧网址:4.1.4.RELEASE”
编译“org.springframework:弹簧芯:4.1.4.RELEASE”
编译“org.springframework:春天上下文:4.1.4.RELEASE”
编译“org.springframework:弹簧上下文支持:4.1.4.RELEASE”
编译“org.springframework:弹簧ORM:4.1.4.RELEASE”
编译“org.springframework.security:spring-security-core:4.0.0.RELEASE”
// MySQL数据库驱动程序
//编译“MySQL的:使用mysql-connector-java的:5.1.34”
编译“com.oracle:ojdbc6:11.2.0.1.0”
// Hibernate框架
编译“org.hibernate作为:休眠核心:4.3.8.Final”
编译“公地DBCP:公地DBCP:1.2.2”
// Servlet API的
编译'的javax.servlet:servlet的API:2.5“
// BASE-64阿帕奇公地
编译“commons- codeC:commons- codeC:1.10”
// log4j的
编译'的log4j:log4j的:1.2.17“
编译“org.slf4j:SLF4J-简单:1.7.10”
// XmlBeans的股票估值
编译“org.apache.xmlbeans:XMLBeans的:2.6.0”
//浦二股权估值
编译“org.apache.poi:POI:3.10.1”
//浦二OOXML股票估值
编译“org.apache.poi:POI-OOXML:3.10.1”
//浦二OOXML架构股权估值
编译“org.apache.poi:POI-OOXML-模式:3.10.1”
//雅各布股票估值
编译“雅各布:侨光:1.18-M2”
//谷歌GSON
编译“com.google code.gson:GSON:2.3.1”
提供'org.jboss.resteasy:RestEasy的-JAXRS:3.0.11.Final“
提供'org.jboss.resteasy:RestEasy的弹簧:3.0.11.Final“} 解决方案 试过在发表评论,但字数限制补充。结果我能现在要做的异步工作。我发现,使用的 AsynchResponse 的和和的暂停的注释是造成此异常。这不是必需的异步作业处理。结果,其原因的空指针是,有两个混合起来。有两个异步的东西和文档真正混合起来结果1. 异步响应:使用暂停和AsynchResponse将释放接收请求和工作将由新创建的线程来完成服务器线程。但是,客户端将等待响应。直到新线程完成并发送回。对于这种不需要更改到web.xml。页2。 异步工作处理:在这里,你设置的 resteasy.async.job.service.enabled 的到的真正的在web.xml和任何其他可选参数(如果需要)。没有其他的变化都需要的API。我的方法是结果
@Path(“/ HelloWorld”的)
市民反应为getHelloWorld(){
log.info(“API调用”);
longLiftingJob();
log.info(“API调用完成”);
返回Response.status(200).entity(的“Hello World”),建立()。
通过在web.xml中的真实参数框架将调用你在一个新的线程中调用(简单地说)和作业ID在202响应返回相同。作为Location头的结果位置→http://127.0.0.1:8080/myrest/asynch/jobs/8-1
客户端不会对上述URL的GET / POST,并会获得响应由曾经的API完成的API返回。但实际的客户端永远不会等待这么异步工作。
本文地址: &
扫一扫关注官方微信

我要回帖

更多关于 如果没有问题 英文 的文章

 

随机推荐