Call resetRequest after writeFrame for polling sessions

Previous refactoring (fcf6ae and also 43d937) in the SockJsSession
hierarchy consolidated access to the request and response in the
base class AbstractHttpSockJsSession in order to keep synchronization
concerns there. However that also unintentionally removed the call to
resetRequest() after sending a heartbeat for any of the
PollingSockJsSession classes. In general a polling session should call
resetRequest after every frame written.

This commit brings back the writeFrame override in PollingSockJsSession
with an extra call to resetRequest().

Issue: SPR-14107
This commit is contained in:
Rossen Stoyanchev 2016-04-04 18:17:11 -04:00
parent 6c0cae87b4
commit cfdb683449
1 changed files with 6 additions and 2 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2013 the original author or authors. * Copyright 2002-2016 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -58,7 +58,6 @@ public class PollingSockJsSession extends AbstractHttpSockJsSession {
if (initialRequest) { if (initialRequest) {
writeFrame(SockJsFrame.openFrame()); writeFrame(SockJsFrame.openFrame());
resetRequest();
} }
else if (!getMessageCache().isEmpty()) { else if (!getMessageCache().isEmpty()) {
flushCache(); flushCache();
@ -77,6 +76,11 @@ public class PollingSockJsSession extends AbstractHttpSockJsSession {
SockJsMessageCodec messageCodec = getSockJsServiceConfig().getMessageCodec(); SockJsMessageCodec messageCodec = getSockJsServiceConfig().getMessageCodec();
SockJsFrame frame = SockJsFrame.messageFrame(messageCodec, messages); SockJsFrame frame = SockJsFrame.messageFrame(messageCodec, messages);
writeFrame(frame); writeFrame(frame);
}
@Override
protected void writeFrame(SockJsFrame frame) throws SockJsTransportFailureException {
super.writeFrame(frame);
resetRequest(); resetRequest();
} }