• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

consuming data from StreamHub Reverse Ajax & Comet Server via a servlet

 
jite eghagha
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

I'm using a StreamHub Reverse Ajax & Comet Server to pass data to all clients. What one client sends out -- all clients see.

I'd like to have a Servlet that captures ALL traffic (data) that comes into the SteamHub server. (to do some processing of the data)

The trouble: a client (html or jsp page) that consumes data from the StreamHub server uses a javascript file streamhub-min.js

Client header:




The question: if a "servlet was a client to StreamHub server", how do i include, and use streamhub-min.js functions ?
 
Fatih Keles
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
jite eghagha wrote:
I'd like to have a Servlet that captures ALL traffic (data) that comes into the SteamHub server. (to do some processing of the data)

So your SteamHub server is located at some URL and you can write a Filter -not a servlet- to capture the request made by clients to that URL. No difference if the request is done by javascript. Some where in streamhub-min.js file there must be URL defined for requests.

jite eghagha wrote:
The question: if a "servlet was a client to StreamHub server", how do i include, and use streamhub-min.js functions ?

Inside servlet code accesing js code is irrelevant since servlet is server-side and js is client-side.

Regards,

Fatih.
 
jite eghagha
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I understand,

however, let me give a scenario in which i am dealing with Lat / Lng on my SteamHub server:

the google map api has a method.........containsLatLng(latlng:GLatLng) which ...........Returns true if the geographical coordinates of the point lie within this rectangle.

Without using google maps, i don't know of any other way beside mysql or oracle server to get such a function.

how do i call this method in a servlet or any other server side class?

I've notice code here and there in .net, (i may be horribly wrong on that) where people handle google maps on the server side of things



 
Fatih Keles
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I suppose you have to obtain data from an outer source -google maps- that is commonly accessed through a javascript Ajax call from browser within your server side code. Here are the things that comes to my mind:

1) You can find some tricky way to make your client's browser do the request and get data and if necessary bring it to your server side code.
2) Ajax calls are certainly like any other http request, so you may analyze the javascript code that makes the exact request you want to imitate with firebug or some other js debug tool and learn http post variables and imitate it in your server side code. Some proxy code will make the request and get data and parse it and return it to you.

I don't know your exact requirements but either of these may work according to your requirements.

There can be a java client to your service distributed by the service implementors that does what js client does. But I guess there is not,
see this: http://stackoverflow.com/questions/996954/java-api-for-google-maps-or-similar
and this: http://groups.google.com/group/Google-Maps-API/browse_thread/thread/0a0e77fb36769820

I did not inspected deeply but this one seems to use the first approach using php : http://eriestuff.blogspot.com/2008/02/google-maps-point-in-polygon.html

Regards,

Fatih.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic