-
Notifications
You must be signed in to change notification settings - Fork 33
/
StompFrameMessage.java
790 lines (653 loc) · 26.7 KB
/
StompFrameMessage.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
/*
* Copyright (c) 2000, 2017 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2021 Contributors to the Eclipse Foundation
* Copyright (c) 2020 Payara Services Ltd.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* This Source Code may also be made available under the following Secondary
* Licenses when the conditions for such availability set forth in the
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
* version 2 with the GNU Classpath Exception, which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/
package com.sun.messaging.bridge.api;
import java.io.IOException;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.io.PrintStream;
import java.io.OutputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import com.sun.messaging.jmq.util.LoggerWrapper;
/**
* @author amyk
*/
public abstract class StompFrameMessage {
private LoggerWrapper logger = null;
public static final String STOMP_PROTOCOL_VERSION_10 = "1.0";
public static final String STOMP_PROTOCOL_VERSION_11 = "1.1";
public static final String STOMP_PROTOCOL_VERSION_12 = "1.2";
public static final String HEADER_SEPERATOR = ":";
private static final String NEWLINESTR = "\n";
private static final byte NEWLINE_BYTE = '\n';
private static final byte NULL_BYTE = '\0';
private static final byte[] END_OF_FRAME = new byte[] { 0, '\n' };
public static final int MIN_COMMAND_LEN = 3;
protected static final int MAX_COMMAND_LEN = 1024;
protected static final int MAX_HEADER_LEN = 1024 * 10;
private static final int MAX_HEADERS = 1000;
public enum Command {
STOMP/* STOMP spec:1.1 */, CONNECT, DISCONNECT,
SEND, SUBSCRIBE, UNSUBSCRIBE, BEGIN, COMMIT, ABORT,
ACK, NACK/* STOMP spec:1.1 not implemented */,
UNKNOWN,
/* responses */
CONNECTED, MESSAGE, RECEIPT, ERROR
}
public enum CommonHeader {
;
public final static String RECEIPT = "receipt";
public final static String TRANSACTION = "transaction";
public final static String CONTENTLENGTH = "content-length";
// STOMP spec:1.1 for SEND, MESSAGE, ERROR, not implemented
public final static String CONTENTTYPE = "content-type";
}
public enum ResponseCommonHeader {
;
public final static String RECEIPTID = "receipt-id";
}
public enum SendHeader {
;
public final static String DESTINATION = "destination";
public final static String EXPIRES = "expires";
public final static String PRIORITY = "priority";
public final static String TYPE = "type";
public final static String PERSISTENT = "persistent";
public final static String REPLYTO = "reply-to";
public final static String CORRELATIONID = "correlation-id";
}
public enum MessageHeader {
;
public final static String DESTINATION = "destination";
public final static String MESSAGEID = "message-id";
public final static String TIMESTAMP = "timestamp";
public final static String EXPIRES = "expires";
public final static String PRORITY = "priority";
public final static String REDELIVERED = "redelivered";
public final static String TYPE = "type";
public final static String REPLYTO = "reply-to";
public final static String CORRELATIONID = "correlation-id";
public final static String SUBSCRIPTION = "subscription";
// STOMP spec:1.2 for client or client-individual ack
public final static String ACK = "ack";
}
public enum SubscribeHeader {
;
public final static String DESTINATION = "destination";
public final static String SELECTOR = "selector";
public final static String ACK = "ack";
public final static String ID = "id";
public final static String DURASUBNAME = "durable-subscriber-name";
public final static String NOLOCAL = "no-local";
}
public enum AckMode {
;
public final static String AUTO = "auto";
public final static String CLIENT = "client";
// STOMP spec:1.1
public final static String CLIENT_INDIVIDUAL = "client-individual";
}
public enum UnsubscribeHeader {
;
// STOMP spec:1.0 optional, obsoleted 1.1
public final static String DESTINATION = "destination";
// STOMP spec:1.1 required; 1.0 optional
public final static String ID = "id";
}
public enum ConnectHeader {
;
public final static String LOGIN = "login";
public final static String PASSCODE = "passcode";
public final static String CLIENTID = "client-id";
// STOMP spec:1.1
public final static String ACCEPT_VERSION = "accept-version";
// STOMP spec:1.1 not implemented
public final static String HEART_BEAT = "heart-beat";
}
public enum ErrorHeader {
;
public final static String MESSAGE = "message";
// optional, implemented
public final static String CONTENT_LENGTH = "content-length";
// STOMP spec:1.1, not implemented
public final static String CONTENT_TYPE = "content-type";
// STOMP spec:1.1, optional, not implemented
public final static String RECEIPTID = "receipt-id";
}
public enum ConnectedHeader {
;
public final static String SESSION = "session";
// STOMP spec:1.1
public final static String VERSION = "version";
// STOMP spec:1.1
public final static String SERVER = "server";
// STOMP spec:1.1 not implemented
public final static String HEART_BEAT = "heart-beat";
}
public enum AckHeader {
;
// STOMP spec:1.2 obsolete
public final static String MESSAGEID = "message-id";
// STOMP spec:1.1, obsoleted 1.2
public final static String SUBSCRIPTION = "subscription";
// for transacted ack
public final static String TRANSACTION = "transaction";
// STOMP spec:1.2, correlates to ack header in MESSAGE
public final static String ID = "id";
}
public enum ParseStage {
COMMAND, HEADER, BODY, NULL, DONE
}
private Command _command = Command.UNKNOWN;
private ArrayList<String> _requiredHeaders = new ArrayList<>();
private LinkedHashMap<String, String> _headers = new LinkedHashMap<>();
private Integer _contentLength = null;
protected ParseStage _parseStage = ParseStage.COMMAND;
private ByteArrayOutputStream _bao = null;
private byte[] _body = null;
private Exception _parseException = null;
private boolean _fatalERROR = false;
private boolean isTextMessage = false;
protected StompFrameMessage(Command cmd, LoggerWrapper logger) {
this.logger = logger;
_command = cmd;
switch (cmd) {
case CONNECT:
case STOMP:
_requiredHeaders.add((ConnectHeader.LOGIN));
_requiredHeaders.add((ConnectHeader.PASSCODE));
break;
case SEND:
_requiredHeaders.add((SendHeader.DESTINATION));
break;
default:
}
}
public boolean isTextMessage() {
return isTextMessage;
}
public void setTextMessageFlag() {
isTextMessage = true;
}
/**
* to be used only for ERROR frame
*/
public void setFatalERROR() {
_fatalERROR = true;
}
public boolean isFatalERROR() {
return _fatalERROR;
}
public Exception getParseException() {
return _parseException;
}
public Command getCommand() {
return _command;
}
public void addHeader(String key, String val) {
_headers.put(key, val);
}
public LinkedHashMap<String, String> getHeaders() {
return _headers;
}
public String getHeader(String key) {
return _headers.get(key);
}
public byte[] getBody() {
if (_body != null) {
return _body;
}
if (_bao == null) {
return (new byte[] {});
}
_body = _bao.toByteArray();
return _body;
}
public String getBodyText() throws StompFrameParseException {
String text = "";
if (_body != null) {
try {
return new String(_body, "UTF-8");
} catch (Exception e) {
throw new StompFrameParseException(e.getMessage(), e);
}
}
if (_bao == null) {
return text;
}
_body = _bao.toByteArray();
try {
text = new String(_body, "UTF-8");
return text;
} catch (Exception e) {
throw new StompFrameParseException(getKStringX_CANNOT_PARSE_BODY_TO_TEXT(getCommand().toString(), e.getMessage()));
}
}
private void writeByteToBody(byte b) throws Exception {
if (_bao == null) {
if (getContentLength() != -1) {
_bao = new ByteArrayOutputStream(getContentLength());
} else {
_bao = new ByteArrayOutputStream();
}
}
_bao.write(b);
}
public void setBody(byte[] data) {
_body = data;
}
protected void writeExceptionToBody(Throwable t) throws Exception {
if (t == null) {
return;
}
if (_bao == null) {
_bao = new ByteArrayOutputStream();
}
t.printStackTrace(new PrintStream(_bao, true, "UTF-8"));
addHeader(CommonHeader.CONTENTLENGTH, String.valueOf(getBodySize()));
}
private int getBodySize() {
if (_bao == null) {
return 0;
}
return _bao.size();
}
protected void setNextParseStage(ParseStage s) {
_parseStage = s;
if (s == ParseStage.BODY) {
for (String key : _requiredHeaders) {
if (_headers.get(key) == null) {
if (_parseException == null) {
_parseException = new StompFrameParseException(getKStringX_HEADER_NOT_SPECIFIED_FOR(key, getCommand().toString()));
logger.logSevere(_parseException.getMessage(), null);
}
}
}
}
if (s == ParseStage.DONE) {
try {
if (_bao != null) {
_bao.close();
}
} catch (Exception e) {
logger.logWarn("Exception in closing ByteArrayOutputStream:" + e.getMessage(), null);
}
}
}
public ParseStage getNextParseStage() {
return _parseStage;
}
public int getContentLength() {
if (_contentLength != null) {
return _contentLength.intValue();
}
String val = _headers.get(CommonHeader.CONTENTLENGTH);
if (val == null) {
return -1;
}
int len = -1;
try {
len = Integer.parseInt(val.trim());
} catch (NumberFormatException e) {
if (_parseException == null) {
_parseException = new StompFrameParseException(getKStringX_INVALID_HEADER_VALUE(val, CommonHeader.CONTENTLENGTH));
len = -1;
logger.logSevere(_parseException.getMessage(), null);
}
}
_contentLength = Integer.valueOf(len);
return len;
}
public ByteBufferWrapper marshall(Object obj, String protocolVersion) throws IOException {
OutputStream bos = null;
DataOutputStream dos = null;
boolean needsEscaping = !protocolVersion.equals(STOMP_PROTOCOL_VERSION_10) && getCommand() != Command.CONNECTED;
try {
bos = newBufferOutputStream(obj);
dos = new DataOutputStream(bos);
StringBuilder sbuf = new StringBuilder();
sbuf.append(getCommand());
sbuf.append(NEWLINESTR);
if (needsEscaping) {
for (String key : _headers.keySet()) {
sbuf.append(escapeSpecialChars(key));
sbuf.append(HEADER_SEPERATOR);
sbuf.append(escapeSpecialChars(_headers.get(key)));
sbuf.append(NEWLINESTR);
}
} else {
for (String key : _headers.keySet()) {
sbuf.append(key);
sbuf.append(HEADER_SEPERATOR);
sbuf.append(_headers.get(key));
sbuf.append(NEWLINESTR);
}
}
sbuf.append(NEWLINESTR);
dos.write(sbuf.toString().getBytes("UTF-8"));
dos.write(getBody());
dos.write(END_OF_FRAME);
dos.flush();
ByteBufferWrapper bb = getBuffer(bos);
bb.flip();
return bb;
} finally {
if (dos != null) {
dos.close();
}
if (bos != null) {
bos.close();
}
}
}
private String unescapeSpecialChars(String keyOrValue) {
return keyOrValue.replace("\\\\", "\\")
.replace("\\c", ":")
.replace("\\r", "\r")
.replace("\\n", "\n");
}
private String escapeSpecialChars(String keyOrValue) {
return keyOrValue.replace("\\", "\\\\")
.replace(":", "\\c")
.replace("\r", "\\r")
.replace("\n", "\\n");
}
/**
*/
public void parseHeader(ByteBufferWrapper buf, String protocolVersion) throws Exception {
String header = null;
boolean needsUnescaping = getCommand() != Command.CONNECT && !protocolVersion.equals(STOMP_PROTOCOL_VERSION_10);
if (logger.isFineLoggable()) {
logger.logFine("in parseHeader: position=" + buf.position() + ", remaining=" + buf.remaining(), null);
}
try {
while (buf.hasRemaining()) {
byte[] line = parseLine(buf, MAX_HEADER_LEN);
if (line == null) {
return;
}
header = new String(line, "UTF-8");
if (logger.isFineLoggable()) {
logger.logFine("parseHeader: got line byte-length=" + line.length + ", header=:" + header + ", header-length=" + header.length()
+ ", position=" + buf.position(), null);
}
if (header.trim().length() == 0) {
setNextParseStage(ParseStage.BODY);
if (logger.isFinestLoggable()) {
logger.logFinest("parseHeader: DONE - position=" + buf.position(), null);
}
return;
}
int index = header.indexOf(HEADER_SEPERATOR);
if (index == -1) {
if (_parseException == null) {
_parseException = new StompFrameParseException(getKStringX_INVALID_HEADER(header));
logger.logSevere(_parseException.getMessage(), null);
}
index = header.length() - 1;
}
String key = header.substring(0, index).trim();
String val = header.substring(index + 1, header.length()).trim();
if (needsUnescaping) {
key = unescapeSpecialChars(key);
val = unescapeSpecialChars(val);
}
addHeader(key, val);
if (_headers.size() > MAX_HEADERS) { // XXX
throw new StompFrameParseException(getKStringX_MAX_HEADERS_EXCEEDED(MAX_HEADERS));
}
}
} catch (Exception e) {
if (e instanceof StompFrameParseException) {
throw e;
}
throw new StompFrameParseException(getKStringX_EXCEPTION_PARSE_HEADER(header, e.getMessage()), e);
}
}
/**
*
*/
public void readBody(ByteBufferWrapper buf) throws Exception {
int clen = getContentLength();
if (logger.isFinestLoggable()) {
logger.logFinest("in readBody:contentLen=" + _contentLength + ", position=" + buf.position() + ", remaining=" + buf.remaining() + ", bodySize="
+ getBodySize(), null);
}
byte b;
while (buf.hasRemaining()) {
if (clen != -1 && clen == getBodySize()) {
if (logger.isFinestLoggable()) {
logger.logFinest("Body has beed read!", null);
}
setNextParseStage(ParseStage.NULL);
return;
}
b = buf.get();
if (b == NULL_BYTE && clen == -1) {
if (buf.hasRemaining()) {
int pos = buf.position();
byte bb = buf.get();
if (bb != '\n' && bb != '\r') {
buf.position(pos);
}
}
if (buf.hasRemaining()) {
int pos = buf.position();
byte bb = buf.get();
if (bb != '\n') {
buf.position(pos);
}
}
if (logger.isFinestLoggable()) {
logger.logFinest("readBody: DONE - position=" + buf.position() + ", remaining=" + buf.remaining(), null);
}
setNextParseStage(ParseStage.DONE);
return;
}
writeByteToBody(b);
}
if (logger.isFinestLoggable()) {
logger.logFinest("leaving readBody(): BODY_SIZE=" + getBodySize(), null);
}
return;
}
/**
*/
public void readNULL(ByteBufferWrapper buf) throws Exception {
if (logger.isFinestLoggable()) {
logger.logFinest("in readNULL:" + buf.position() + ":" + buf.remaining(), null);
}
if (buf.remaining() <= 0) {
return;
}
byte b = buf.get();
if (b != 0) {
throw new StompFrameParseException(getKStringX_NO_NULL_TERMINATOR(CommonHeader.CONTENTLENGTH + " " + getContentLength()));
}
if (logger.isFinestLoggable()) {
logger.logFinest("got NULL readNULL:" + buf.position() + ":" + buf.remaining(), null);
}
setNextParseStage(ParseStage.DONE);
return;
}
@Override
public String toString() {
return _command + "[" + _headers + "]";
}
public String toLongString() throws Exception {
return _command + "[" + _headers + "][" + getBodyText() + "]";
}
/**
*/
public static StompFrameMessage parseCommand(ByteBufferWrapper buf, LoggerWrapper logger, StompFrameMessageFactory factory) throws Exception {
StompFrameMessage message = null;
String cmd = "";
if (logger.isFinestLoggable()) {
logger.logFinest("parseCommand: pos:remaining[" + buf.position() + ":" + buf.remaining() + "]", null);
}
try {
while (cmd.trim().length() == 0) {
byte[] line = parseLine(buf, MAX_COMMAND_LEN);
if (line == null) {
if (logger.isFinestLoggable()) {
logger.logFinest("parseCommand: position[" + buf.position() + "] command line not found", null);
}
return null;
}
cmd = new String(line, "UTF-8");
if (logger.isFinestLoggable()) {
logger.logFinest("parseCommand: got line:" + cmd + ", position=" + buf.position(), null);
}
}
if (cmd.startsWith((Command.CONNECTED).toString())) {
message = factory.newStompFrameMessage(Command.CONNECTED, logger);
} else if (cmd.startsWith((Command.RECEIPT).toString())) {
message = factory.newStompFrameMessage(Command.RECEIPT, logger);
} else if (cmd.startsWith((Command.MESSAGE).toString())) {
message = factory.newStompFrameMessage(Command.MESSAGE, logger);
} else if (cmd.startsWith((Command.ERROR).toString())) {
message = factory.newStompFrameMessage(Command.ERROR, logger);
} else if (cmd.startsWith((Command.CONNECT).toString()) || cmd.startsWith((Command.STOMP).toString())) {
message = factory.newStompFrameMessage(Command.CONNECT, logger);
} else if (cmd.startsWith((Command.SEND).toString())) {
message = factory.newStompFrameMessage(Command.SEND, logger);
} else if (cmd.startsWith((Command.SUBSCRIBE).toString())) {
message = factory.newStompFrameMessage(Command.SUBSCRIBE, logger);
} else if (cmd.startsWith((Command.ACK).toString())) {
message = factory.newStompFrameMessage(Command.ACK, logger);
} else if (cmd.startsWith((Command.NACK).toString())) {
message = factory.newStompFrameMessage(Command.NACK, logger);
} else if (cmd.startsWith((Command.UNSUBSCRIBE).toString())) {
message = factory.newStompFrameMessage(Command.UNSUBSCRIBE, logger);
} else if (cmd.startsWith((Command.BEGIN).toString())) {
message = factory.newStompFrameMessage(Command.BEGIN, logger);
} else if (cmd.startsWith((Command.COMMIT).toString())) {
message = factory.newStompFrameMessage(Command.COMMIT, logger);
} else if (cmd.startsWith((Command.ABORT).toString())) {
message = factory.newStompFrameMessage(Command.ABORT, logger);
} else if (cmd.startsWith((Command.DISCONNECT).toString())) {
message = factory.newStompFrameMessage(Command.DISCONNECT, logger);
} else {
message = factory.newStompFrameMessage(Command.ERROR, logger);
String emsg = message.getKStringX_UNKNOWN_STOMP_CMD(cmd);
message._parseException = new StompFrameParseException(emsg);
logger.logSevere(emsg, null);
}
if (logger.isFinestLoggable()) {
logger.logFinest("parseCommand: DONE - cmd=" + cmd + ", position=" + buf.position(), null);
}
message.setNextParseStage(ParseStage.HEADER);
} catch (Exception e) {
if (e instanceof StompFrameParseException) {
throw e;
}
throw new StompFrameParseException(e.getMessage(), e);
}
return message;
}
/**
*/
private static byte[] parseLine(ByteBufferWrapper buf, int maxbytes) throws Exception {
byte[] line = new byte[maxbytes];
int pos = buf.position();
boolean foundline = false;
int i = 0;
byte b;
while (buf.hasRemaining()) {
b = buf.get();
/*
* if (logger.isFinestLoggable()) { logger.logFinest("parseLine: byte="+Byte.valueOf(b), null); }
*/
if (b == NEWLINE_BYTE) {
foundline = true;
break;
}
line[i++] = b;
if (i >= (maxbytes - 1)) {
StompFrameMessage em = newStompFrameMessageERROR();
throw new StompFrameParseException(em.getKStringX_MAX_LINELEN_EXCEEDED(maxbytes));
}
}
if (!foundline) {
buf.position(pos);
return null;
}
byte[] tmp = new byte[i];
System.arraycopy(line, 0, tmp, 0, i);
return tmp;
}
protected static StompFrameMessage newStompFrameMessageERROR() {
return new StompFrameMessage(StompFrameMessage.Command.ERROR, null) {
@Override
protected OutputStream newBufferOutputStream(Object obj) throws IOException {
throw new RuntimeException("Unexpected call");
}
@Override
protected ByteBufferWrapper getBuffer(OutputStream os) throws IOException {
throw new RuntimeException("Unexpected call");
}
@Override
protected String getKStringX_CANNOT_PARSE_BODY_TO_TEXT(String command, String emsg) {
throw new RuntimeException("Unexpected call");
}
@Override
protected String getKStringX_HEADER_NOT_SPECIFIED_FOR(String header, String command) {
throw new RuntimeException("Unexpected call");
}
@Override
protected String getKStringX_INVALID_HEADER_VALUE(String headerValue, String command) {
throw new RuntimeException("Unexpected call");
}
@Override
protected String getKStringX_INVALID_HEADER(String headerName) {
throw new RuntimeException("Unexpected call");
}
@Override
protected String getKStringX_MAX_HEADERS_EXCEEDED(int maxHeaders) {
throw new RuntimeException("Unexpected call");
}
@Override
protected String getKStringX_EXCEPTION_PARSE_HEADER(String headerName, String emsg) {
throw new RuntimeException("Unexpected call");
}
@Override
protected String getKStringX_NO_NULL_TERMINATOR(String contentlen) {
throw new RuntimeException("Unexpected call");
}
@Override
protected String getKStringX_UNKNOWN_STOMP_CMD(String cmd) {
throw new RuntimeException("Unexpected call");
}
@Override
protected String getKStringX_MAX_LINELEN_EXCEEDED(int maxbytes) {
throw new RuntimeException("Unexpected call");
}
};
}
protected abstract OutputStream newBufferOutputStream(Object obj) throws IOException;
protected abstract ByteBufferWrapper getBuffer(OutputStream os) throws IOException;
protected abstract String getKStringX_CANNOT_PARSE_BODY_TO_TEXT(String cmd, String emsg);
protected abstract String getKStringX_HEADER_NOT_SPECIFIED_FOR(String headerName, String cmd);
protected abstract String getKStringX_INVALID_HEADER_VALUE(String headerValue, String cmd);
protected abstract String getKStringX_INVALID_HEADER(String headerName);
protected abstract String getKStringX_MAX_HEADERS_EXCEEDED(int maxHeaders);
protected abstract String getKStringX_EXCEPTION_PARSE_HEADER(String headerName, String emsg);
protected abstract String getKStringX_NO_NULL_TERMINATOR(String contentlen);
protected abstract String getKStringX_UNKNOWN_STOMP_CMD(String cmd);
protected abstract String getKStringX_MAX_LINELEN_EXCEEDED(int maxbytes);
}