CVS update: JGroups/src/org/jgroups/client StompConnection.java
"Bela Ban" <[email protected]> Wed, 27 Oct 2010 07:43:20 +0000
| Newsgroups | gmane.comp.java.javagroups.cvs |
|---|---|
| Message-ID | <[email protected]> |
User: belaban
Date: 10/10/27 07:43:20
Modified: src/org/jgroups/client StompConnection.java
Log:
ns
Revision Changes Path
1.6 +12 -3 JGroups/src/org/jgroups/client/StompConnection.java
Index: StompConnection.java
===================================================================
RCS file: /cvsroot/javagroups/JGroups/src/org/jgroups/client/StompConnection.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- StompConnection.java 27 Oct 2010 07:10:13 -0000 1.5
+++ StompConnection.java 27 Oct 2010 07:43:20 -0000 1.6
@@ -27,7 +27,7 @@
* <p/>
* [1] http://stomp.codehaus.org/Protocol
* @author Bela Ban
- * @version $Id: StompConnection.java,v 1.5 2010/10/27 07:10:13 belaban Exp $
+ * @version $Id: StompConnection.java,v 1.6 2010/10/27 07:43:20 belaban Exp $
*/
@Experimental @Unsupported
public class StompConnection implements Runnable {
@@ -169,18 +169,23 @@
}
}
- public void send(String destination, byte[] buf, int offset, int length) {
+ public void send(String destination, byte[] buf, int offset, int length, String ... headers) {
StringBuilder sb=new StringBuilder();
sb.append(STOMP.ClientVerb.SEND.name()).append("\n");
if(destination != null)
sb.append("destination: ").append(destination).append("\n");
if(buf != null)
sb.append("content-length: ").append(length +1).append("\n"); // the 1 additional byte is the NULL_BYTE
+ if(headers != null && headers.length % 2 == 0) { // must be even
+ for(int i=0; i < headers.length; i++)
+ sb.append(headers[i]).append(": ").append(headers[++i]).append("\n");
+ }
sb.append("\n");
try {
out.write(sb.toString().getBytes());
- out.write(buf, offset, length);
+ if(buf != null)
+ out.write(buf, offset, length);
out.write(STOMP.NULL_BYTE);
out.flush();
}
@@ -189,6 +194,10 @@
}
}
+ public void send(String destination, byte[] buf, int offset, int length) {
+ send(destination, buf, offset, length, null);
+ }
+
public void send(String destination, byte[] buf) {
send(destination, buf, 0, buf.length);
}
------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
http://p.sf.net/sfu/nokia-dev2dev