@Override protected void writeFrameInternal(SockJsFrame frame) throws IOException { if (isActive()) { SockJsFrameFormat frameFormat = this.frameFormat; ServerHttpResponse response = this.response; if (frameFormat != null && response != null) { String formattedFrame = frameFormat.format(frame); if (logger.isTraceEnabled()) { logger.trace("Writing to HTTP response: " + formattedFrame); } response.getBody().write(formattedFrame.getBytes(SockJsFrame.CHARSET)); response.flush(); } } }
logger.debug("Another " + getTransportType() + " connection still open for " + sockJsSession); String formattedFrame = getFrameFormat(request).format(SockJsFrame.closeFrameAnotherConnectionOpen()); try { response.getBody().write(formattedFrame.getBytes(SockJsFrame.CHARSET));
@Test public void frameFormats() throws Exception { this.servletRequest.setQueryString("c=callback"); this.servletRequest.addParameter("c", "callback"); SockJsFrame frame = SockJsFrame.openFrame(); SockJsFrameFormat format = new XhrPollingTransportHandler().getFrameFormat(this.request); String formatted = format.format(frame); assertEquals(frame.getContent() + "\n", formatted); format = new XhrStreamingTransportHandler().getFrameFormat(this.request); formatted = format.format(frame); assertEquals(frame.getContent() + "\n", formatted); format = new HtmlFileTransportHandler().getFrameFormat(this.request); formatted = format.format(frame); assertEquals("<script>\np(\"" + frame.getContent() + "\");\n</script>\r\n", formatted); format = new EventSourceTransportHandler().getFrameFormat(this.request); formatted = format.format(frame); assertEquals("data: " + frame.getContent() + "\r\n\r\n", formatted); }
@Override protected void writeFrameInternal(SockJsFrame frame) throws IOException { if (isActive()) { SockJsFrameFormat frameFormat = this.frameFormat; ServerHttpResponse response = this.response; if (frameFormat != null && response != null) { String formattedFrame = frameFormat.format(frame); if (logger.isTraceEnabled()) { logger.trace("Writing to HTTP response: " + formattedFrame); } response.getBody().write(formattedFrame.getBytes(SockJsFrame.CHARSET)); response.flush(); } } }
@Override protected void writeFrameInternal(SockJsFrame frame) throws IOException { if (isActive()) { SockJsFrameFormat frameFormat = this.frameFormat; ServerHttpResponse response = this.response; if (frameFormat != null && response != null) { String formattedFrame = frameFormat.format(frame); if (logger.isTraceEnabled()) { logger.trace("Writing to HTTP response: " + formattedFrame); } response.getBody().write(formattedFrame.getBytes(SockJsFrame.CHARSET)); response.flush(); } } }
logger.debug("Another " + getTransportType() + " connection still open for " + sockJsSession); String formattedFrame = getFrameFormat(request).format(SockJsFrame.closeFrameAnotherConnectionOpen()); try { response.getBody().write(formattedFrame.getBytes(SockJsFrame.CHARSET));
logger.debug("Another " + getTransportType() + " connection still open for " + sockJsSession); String formattedFrame = getFrameFormat(request).format(SockJsFrame.closeFrameAnotherConnectionOpen()); try { response.getBody().write(formattedFrame.getBytes(SockJsFrame.CHARSET));