Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AsyncContext.get[Request|Response] cannot be called after dispatch() #152

Open
jmcc0nn3ll opened this issue Feb 16, 2016 · 2 comments
Open
Labels
Bug For general bugs on Jetty side Specification For all industry Specifications (IETF / Servlet / etc)

Comments

@jmcc0nn3ll
Copy link
Contributor

migrated from Bugzilla #441390
status ASSIGNED severity normal in component server for 9.2.x
Reported in version 9.2.2 on platform PC
Assigned to: Greg Wilkins

On 2014-08-07 17:33:52 -0400, Simone Bordet wrote:

The javadocs for those 2 methods in JEE 7 has been "enhanced" with the requirement of throwing an IllegalStateException: http://docs.oracle.com/javaee/7/api/javax/servlet/AsyncContext.html#getRequest%28%29

By contract JEE 6 did not have this clause.

We should probably enforce this behavior, because it's quite common to call these methods after a dispatch(), and if Jetty allows it, applications won't be portable.

On 2014-08-07 20:04:15 -0400, Greg Wilkins wrote:

Hmmm we already had some ISE code, but it waits until the servlet dispatch cycle has completed. Will toughen it up a bit... but have also raised https://java.net/jira/browse/SERVLET_SPEC-103

On 2014-08-07 21:23:04 -0400, Greg Wilkins wrote:

I'm not going to make any changes until I hear back from SPEC-103

We gave a use-case where we log the request in an onComplete callback as follows:

    @Override
    public void onComplete(AsyncEvent event) throws IOException
    {
        AsyncContextState context = (AsyncContextState)event.getAsyncContext();
        Request request=context.getHttpChannelState().getBaseRequest();
        Response response=request.getResponse();
        _requestLog.log(request,response);
    }

If getRequest throws an ISE after dispatch, then this does not work.

@jmcc0nn3ll jmcc0nn3ll added the Bug For general bugs on Jetty side label Feb 16, 2016
@sbordet sbordet self-assigned this Feb 17, 2016
@joakime
Copy link
Contributor

joakime commented Oct 9, 2017

New SERVLET_SPEC-103 issue location is https://github.com/javaee/servlet-spec/issues/103

@joakime joakime added the Specification For all industry Specifications (IETF / Servlet / etc) label Mar 13, 2018
@gregw
Copy link
Contributor

gregw commented Apr 7, 2021

Now at jakartaee/servlet#103

@sbordet sbordet removed their assignment May 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For general bugs on Jetty side Specification For all industry Specifications (IETF / Servlet / etc)
Projects
None yet
Development

No branches or pull requests

4 participants