-
Notifications
You must be signed in to change notification settings - Fork 81
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
Clarify how async ReadListener changes the contract of ServletInputStream methods #301
Comments
@markt-asf @stuartwdouglas any thoughts on this? Do you want me to propose some javadoc changes to clarify the way I think it should be? which are:
|
I don't think we can't do anything about |
I am happy with the above, Undertow will already throw an ISE for read() without a prior isReady. |
Perhaps these decisions should be reflected in new TCK tests? |
Yes, please! |
Now with the recent release of the Servlet Spec on post Java 8 bytecodes, I would like to revive this discussion and make these methods also throw ISE. |
The use of an async
ReadListener
allows the normal read methods to be used in async mode. However nowhere in the javadoc do we document how that behaviour is changed and I think they may be a few corner cases that are ambiguous:ServletInputStream.readLine
method be used? Currently it has a default implementation that will fail in async mode asisReady()
is not called. Should implementations override this with a method that works asynchronously and returns 0 if a complete line is not available? Or should the default implementation be updated to throw ISE if there is a ReadListener?readAllBytes()
andreadNBytes(...)
,skip(long)
,skipNBytes(long)
,transferTo(OutputStream)
: should they ISE, block or return null if insufficient data is available?isReady()
is very light on and really needs to make clear the scheduling implications of a false return - ie that one of theReadListener
callbacks will eventually be called if false is return.read(byte[],int,int)
is called without previously callingisReady()
:isReady()
returning false? ie will a callback be scheduled when data is available?read(byte[],int,int)
is called afterisReady()
returns false andonDataAvailable
, should 0 be returned or ISE thrown?read()
is called, then returning 0 is not an option as it is a valid byte. So how shouldread()
handle all of the situations above?The text was updated successfully, but these errors were encountered: