> On Apr 12, 2021, at 8:43 AM, Rob Sargent <[email protected]> wrote:
>
>
>
>
> Begin forwarded message:
>
>> From: Konstantin Kolinko <[email protected]>
>> Date: April 12, 2021 at 8:38:14 AM MDT
>> To: Tomcat Users List <[email protected]>
>> Subject: Re: Again with the missing headers
>> Reply-To: Tomcat Users List <[email protected]>
>>
>> пн, 12 апр. 2021 г. в 16:20, Rob Sargent <[email protected]>:
>>>
>>> Thank you.
>>>
>>> Can you suggest a way to confirm the problem is size related? Or are you
>>> convinced by the numbers shown?
>>
>> Look at "ServletResponse.isCommitted()"
>>
>> https://cwiki.apache.org/confluence/display/TOMCAT/Specifications#Specifications-JavaServletSpecifications
>> https://javaee.github.io/javaee-spec/javadocs/javax/servlet/ServletResponse.html#isCommitted--
>>
>>> The client is a Java 15 app so there’s a chance I could use trailer
>>> headers. I’m not explicitly using chunked encoding currently.
>>>
>>> I don’t like the idea of buffering the entire response as this is the part
>>> of my setup where there are likely thousands of nearly simultaneous
>>> requests and the server isn’t that beefy.
>>>
>>> And I take it there is no mechanism in tomcat 9 to force the headers out on
>>> an implicit flush? Or other mechanism which ensures headers are sent?
>>
>> What are those headers, and what code at what place sets them?
>>
>> BTW,
>> an AccessLogValve can be configured to log a value of a response
>> header with "%{xxx}o" pattern.
>> https://tomcat.apache.org/tomcat-9.0-doc/config/valve.html#Access_Log_Valve
>>
>>
>> https://tomcat.apache.org/lists.html#tomcat-users
>> -> 6. " Top-posting is bad.”
I’m sorry, I didn’t get the impression this was a bottom-post list. Thanks for
informing me.
The datum of concern is handled via the session.
//Hold the offset of the first explicit marker in the chased
//segment. That marker at most 16th locus up-stream of
//segment. Less at pter. There are more markers found within the
//spanning cliques but these are not at predictable positions
private void setRebase(HttpServletRequest req, Integer value) {
req.getSession().setAttribute("rebase", value);
}
private Integer getRebase(HttpServletRequest req) {
return (Integer)(req.getSession().getAttribute("rebase"));
}
I confess, in preparing this response I noticed that I start sending the first
lines of the streamed data then set the header as follows:
response.setHeader("rebaseSegment", "" + getRebase(req));
then the remainder of the stream. I’ll correct that and see if that plays into
the behaviour at all.
The isCommitted() will come in handy too. Thanks for that.
rjs