[
https://issues.apache.org/jira/browse/CXF-5373?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13812923#comment-13812923
]
Sergey Beryozkin commented on CXF-5373:
---------------------------------------
Hmm... Actually, what exactly the issue is ?
"AsyncResponse asyncResp = exchange.get(AsyncResponse.class);" will be null on
the initial call, the exchange is initialized after the initial call returns,
and then on the suspended thread returning "exchange.get(AsyncResponse.class)"
is expected to return a saved AsyncResponse.
Are you saying it is 'null' after your createToken() method returns and when
the execution is resumed later ?
If yes: please attach a test project, we have the tests running against Jetty,
I also tried Tomcat
> Issue resolving AsynchResponse
> ------------------------------
>
> Key: CXF-5373
> URL: https://issues.apache.org/jira/browse/CXF-5373
> Project: CXF
> Issue Type: Bug
> Components: JAX-RS
> Affects Versions: 2.7.7
> Reporter: Sridhar Jonnalagadda
>
> Spring config
> <task:executor id="servicePool" pool-size="1"
> queue-capacity="${aw.concurrentUsers.download:5000}"/>
> JAX-RS server config
> <jaxrs:server id="restContainer" address="/" >
> <jaxrs:executor>
> <ref bean="servicePool"/>
> </jaxrs:executor>
> <jaxrs:serviceBeans>
> <ref bean="tokenService" />
> </jaxrs:serviceBeans>
> </jaxrs:server>
> Java End-Point
> @POST
> @Path("/createToken/{fileName}")
> @Produces(MediaType.APPLICATION_FORM_URLENCODED)
>
> //http://localhost:8000/contentGateway/integrationServices/tokenService/createToken/{fileName}
> public void createToken(@PathParam("fileName")final String fileName,
> final AsyncResponse asyncResponse){
> validateInput(fileName);
> final String randomUUID = UUID.randomUUID().toString();
> this.tokenRepository.storeToken(randomUUID.toString(),fileName);
> asyncResponse.resume(randomUUID);
>
> }
> JAXRSUtils.java : 766- 767
> if (parameterClass == AsyncResponse.class) {
> return new AsyncResponseImpl(message);
> }
> AsyncResponseImpl 53 - 59
> public AsyncResponseImpl(Message inMessage) {
> inMessage.put(AsyncResponse.class, this);
> inMessage.getExchange().put(ContinuationCallback.class, this);
> this.inMessage = inMessage;
>
> initContinuation();
> }
> Line: 55
> inMessage.getExchange().put(ContinuationCallback.class, this);
> JAXRSInvoker.java : Line 86
> AsyncResponse asyncResp = exchange.get(AsyncResponse.class);
> Will always yield null, Since when setting the key will be for
> ContinuationCallback and when retrieving it will be for AsyncResponse
--
This message was sent by Atlassian JIRA
(v6.1#6144)