Author: mladen.turk(a)jboss.com
Date: 2008-05-29 03:40:36 -0400 (Thu, 29 May 2008)
New Revision: 1635
Added:
sandbox/aloha/examples/org/jboss/aloha/MessageExample.java
Modified:
sandbox/aloha/java/org/jboss/aloha/HttpConnection.java
Log:
Add Message Example. Can be run by ant run -Dexample=MessageExample
Added: sandbox/aloha/examples/org/jboss/aloha/MessageExample.java
===================================================================
--- sandbox/aloha/examples/org/jboss/aloha/MessageExample.java
(rev 0)
+++ sandbox/aloha/examples/org/jboss/aloha/MessageExample.java 2008-05-29 07:40:36 UTC
(rev 1635)
@@ -0,0 +1,56 @@
+/*
+ *
+ * Copyright(c) 2008 Red Hat Middleware, LLC,
+ * and individual contributors as indicated by the @authors tag.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library in the file COPYING.LIB;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ *
+ */
+
+package org.jboss.aloha;
+
+public class MessageExample
+{
+
+ public MessageExample()
+ {
+ }
+
+ public static void main(String [] args) {
+ try {
+
+ ConnectionFactory cf = new ConnectionFactory(HttpConnection.class);
+ Connection c;
+
+ cf.setPort(8000);
+ c = cf.getConnection();
+ Message m = new Message(Command.Info, "*/*;*");
+ c.sendMessage(m);
+ System.out.println("**** Response " + c.getResponseCode());
+ System.out.println("**** Message >>");
+ System.out.println(c.getResponse());
+ System.out.println("**** << Message");
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+
+
+}
Property changes on: sandbox/aloha/examples/org/jboss/aloha/MessageExample.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: sandbox/aloha/java/org/jboss/aloha/HttpConnection.java
===================================================================
--- sandbox/aloha/java/org/jboss/aloha/HttpConnection.java 2008-05-29 06:51:33 UTC (rev
1634)
+++ sandbox/aloha/java/org/jboss/aloha/HttpConnection.java 2008-05-29 07:40:36 UTC (rev
1635)
@@ -185,9 +185,9 @@
sb.append(':');
sb.append(getPort());
}
+ sb.append(getManagerUrl());
sb.append('/');
sb.append(path);
- sb.append(getManagerUrl());
return sb.toString();
}