You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by jun <cl...@hotmail.com> on 2006/08/15 00:23:23 UTC

client side http post without a web server

Hi, I am new to activeMQ, is there a way to do a http post without a web
server invloved? 

My situation is I have a java application running on the client machine with
an embedded broker (the example embedded broker), the application is
subscribing to a queue(the example consumer). At the same time, there is a
web page on the client machine which needs to communicate with the java
application by sending a message to the queue using java script. All these
actions happen on a same local machine without a web server involved due to
firewall restrictions.


I have browsed throught the website and set up the example embedded broker
and example consumer to work, however, the example web demo is utilizing a
web server(client web page post back to the server and then the server talks
to the queue), while what I need is the client web page post directly to the
queue.


Here is my java script code which does not work

var oXMLHTTP = new ActiveXObject( "Microsoft.XMLHTTP" );

var sURL = "http://localhost:61616/queue/TEST/FOO"

oXMLHTTP.open( "POST", sURL, true );

oXMLHTTP.setRequestHeader("Content-type","application/x-www-form-urlencoded");

oXMLHTTP.send("This is the JMS message");



Thank you !!

Jun
-- 
View this message in context: http://www.nabble.com/client-side-http-post-without-a-web-server-tf2106129.html#a5805360
Sent from the ActiveMQ - User forum at Nabble.com.

Re: client side http post without a web server

Posted by jun <cl...@hotmail.com>.
Thank you for the reply Chris.

I will try jetty or modify the embedded broker code to allow it parse http
requests.

Jun



Christopher St John wrote:
> 
> On 8/15/06, jun <cl...@hotmail.com> wrote:
>>
>> Can the embedded broker parse the incoming http request and post the
>> message
>> to the queue? It does not need to be a full blown http server, it just
>> needs
>> to be a socket server with the capability to parse http post requests.
>>
> 
> Jetty is embeddable, and is configurable via api calls, so it can
> run inside your existing client-side Java application (as Guillaume
> suggested) without too much fuss. Although Jetty is technically
> a full-blown HTTP server, you don't have to use it that way.
> 
> -cks
> 
> -- 
> Christopher St. John
> http://artofsystems.blogspot.com
> 
> 

-- 
View this message in context: http://www.nabble.com/client-side-http-post-without-a-web-server-tf2106129.html#a5822250
Sent from the ActiveMQ - User forum at Nabble.com.


Re: client side http post without a web server

Posted by Christopher St John <ck...@gmail.com>.
On 8/15/06, jun <cl...@hotmail.com> wrote:
>
> Can the embedded broker parse the incoming http request and post the message
> to the queue? It does not need to be a full blown http server, it just needs
> to be a socket server with the capability to parse http post requests.
>

Jetty is embeddable, and is configurable via api calls, so it can
run inside your existing client-side Java application (as Guillaume
suggested) without too much fuss. Although Jetty is technically
a full-blown HTTP server, you don't have to use it that way.

-cks

-- 
Christopher St. John
http://artofsystems.blogspot.com

Re: client side http post without a web server

Posted by jun <cl...@hotmail.com>.
Can the embedded broker parse the incoming http request and post the message
to the queue? It does not need to be a full blown http server, it just needs
to be a socket server with the capability to parse http post requests.

It may not make much sense most of the time, but it can come handy for
certain cases.

Jun


James.Strachan wrote:
> 
> 
> How else do you propose to deal with HTTP without at least a Java
> library which actually parses HTTP like Jetty?
> 
> -- 
> 
> James
> -------
> http://radio.weblogs.com/0112098/
> 
> 

-- 
View this message in context: http://www.nabble.com/client-side-http-post-without-a-web-server-tf2106129.html#a5818542
Sent from the ActiveMQ - User forum at Nabble.com.


Re: client side http post without a web server

Posted by James Strachan <ja...@gmail.com>.
On 8/15/06, jun <cl...@hotmail.com> wrote:
>
> This is bad news, but thank you for the reply.

How else do you propose to deal with HTTP without at least a Java
library which actually parses HTTP like Jetty?

-- 

James
-------
http://radio.weblogs.com/0112098/

Re: client side http post without a web server

Posted by jun <cl...@hotmail.com>.
This is bad news, but thank you for the reply.

Jun
-- 
View this message in context: http://www.nabble.com/client-side-http-post-without-a-web-server-tf2106129.html#a5816569
Sent from the ActiveMQ - User forum at Nabble.com.


Re: client side http post without a web server

Posted by James Strachan <ja...@gmail.com>.
On 8/14/06, jun <cl...@hotmail.com> wrote:
>
> Hi, I am new to activeMQ, is there a way to do a http post without a web
> server invloved?

No - the http and ajax connectors for ActiveMQ depend on at a minimum
a servlet engine and typically Jetty which is a pure Java web server.
By definition if you are reading http then you are a web server  so
its pretty hard to avoid it :)

-- 

James
-------
http://radio.weblogs.com/0112098/

Re: client side http post without a web server

Posted by jun <cl...@hotmail.com>.
Thank you for the reply. I feel the same way too.

Jun


gnodet wrote:
> 
> You could launch some java code in an applet, or use a javascript stomp
> client
> (I don' t think one has been written yet).
> Or start a jetty web server colocated with your local activemq broker and
> post to it.
> In all cases, if you want to use HTTP, you need an http server to parse
> and
> process
> the request.  Jetty is the really good candidate here.
> 
> On 8/15/06, jun <cl...@hotmail.com> wrote:
>>
>>
>> Hi, I am new to activeMQ, is there a way to do a http post without a web
>> server invloved?
>>
>> My situation is I have a java application running on the client machine
>> with
>> an embedded broker (the example embedded broker), the application is
>> subscribing to a queue(the example consumer). At the same time, there is
>> a
>> web page on the client machine which needs to communicate with the java
>> application by sending a message to the queue using java script. All
>> these
>> actions happen on a same local machine without a web server involved due
>> to
>> firewall restrictions.
>>
>>
>> I have browsed throught the website and set up the example embedded
>> broker
>> and example consumer to work, however, the example web demo is utilizing
>> a
>> web server(client web page post back to the server and then the server
>> talks
>> to the queue), while what I need is the client web page post directly to
>> the
>> queue.
>>
>>
>> Here is my java script code which does not work
>>
>> var oXMLHTTP = new ActiveXObject( "Microsoft.XMLHTTP" );
>>
>> var sURL = "http://localhost:61616/queue/TEST/FOO"
>>
>> oXMLHTTP.open( "POST", sURL, true );
>>
>> oXMLHTTP.setRequestHeader
>> ("Content-type","application/x-www-form-urlencoded");
>>
>> oXMLHTTP.send("This is the JMS message");
>>
>>
>>
>> Thank you !!
>>
>> Jun
>> --
>> View this message in context:
>> http://www.nabble.com/client-side-http-post-without-a-web-server-tf2106129.html#a5805360
>> Sent from the ActiveMQ - User forum at Nabble.com.
>>
>>
> 
> 
> -- 
> Cheers,
> Guillaume Nodet
> 
> 

-- 
View this message in context: http://www.nabble.com/client-side-http-post-without-a-web-server-tf2106129.html#a5822221
Sent from the ActiveMQ - User forum at Nabble.com.


Re: client side http post without a web server

Posted by Guillaume Nodet <gn...@gmail.com>.
You could launch some java code in an applet, or use a javascript stomp
client
(I don' t think one has been written yet).
Or start a jetty web server colocated with your local activemq broker and
post to it.
In all cases, if you want to use HTTP, you need an http server to parse and
process
the request.  Jetty is the really good candidate here.

On 8/15/06, jun <cl...@hotmail.com> wrote:
>
>
> Hi, I am new to activeMQ, is there a way to do a http post without a web
> server invloved?
>
> My situation is I have a java application running on the client machine
> with
> an embedded broker (the example embedded broker), the application is
> subscribing to a queue(the example consumer). At the same time, there is a
> web page on the client machine which needs to communicate with the java
> application by sending a message to the queue using java script. All these
> actions happen on a same local machine without a web server involved due
> to
> firewall restrictions.
>
>
> I have browsed throught the website and set up the example embedded broker
> and example consumer to work, however, the example web demo is utilizing a
> web server(client web page post back to the server and then the server
> talks
> to the queue), while what I need is the client web page post directly to
> the
> queue.
>
>
> Here is my java script code which does not work
>
> var oXMLHTTP = new ActiveXObject( "Microsoft.XMLHTTP" );
>
> var sURL = "http://localhost:61616/queue/TEST/FOO"
>
> oXMLHTTP.open( "POST", sURL, true );
>
> oXMLHTTP.setRequestHeader
> ("Content-type","application/x-www-form-urlencoded");
>
> oXMLHTTP.send("This is the JMS message");
>
>
>
> Thank you !!
>
> Jun
> --
> View this message in context:
> http://www.nabble.com/client-side-http-post-without-a-web-server-tf2106129.html#a5805360
> Sent from the ActiveMQ - User forum at Nabble.com.
>
>


-- 
Cheers,
Guillaume Nodet