Re: changing TcpServerEndpoint to HttpServerEndpoint

Tom Cellucci <[email protected]>
Newsgroups gmane.comp.java.sun.jini
Message-ID <[email protected]>
Hi Patrick,

You said:


> I would like to use HttpServerEndpoint and pass all the packets on port
> 80
>

You may want to take a look at the Bantam project (
http://bantam.dev.java.net).  Bantam runs Jini services from within a WAR,
sending all traffic (remoting, unicast discovery, codebase) over the servlet
container's HTTP port.  Technically the implementation provides a custom
ServerEndpoint implementation that delivers servlet input/output streams to
JERI; the hosted Jini services never know the difference.  You can invoke
the services through firewalls, across the Internet, etc.  Documentation is
basically unavailable, but there's an example WAR project that hosts a few
services and provides a simple client.  We also have a demo site out at
http://bantam.skillcorp.com/bantam-examples --you can point the example
client at the site to see Bantam "live", running Reggie, Outrigger, and the
examples).

As I'd mentioned, the project is under active development.  We're currently
working on the following, in various stages of completion:

   - Jini Configuration via Spring Framework - configure Jini services
   using Spring Framework's 'beans' format.  Auto-wiring and shared beans
   reduce the time needed for service configuration .
   - Java 5 Annotations - develop a complete Jini service within a single
   Java file.  Dependency analysis, "-dl" packaging, even Remote generation
   could all be performed "on the fly" when the service is deployed.
   - A user guide

So if you have a little time to invest, download the Bantam distribution +
example WAR and check it out.  I'm here if you have any questions, and of
course would appreciate your participation.

Thanks,

Tom Cellucci
Skill Corporation

On 1/19/07, Patrick Dowler <[email protected]> wrote:

> I have an application (deployed via webstart) that communicates with my
> server
> via RMI (jeri). The server is deployed in tomcat as a servlet (a URL to
> get
> the exported proxy) and a JSP page to dynamically generate the JNLP to
> launch. I currently use TcpServerEndpoint to export, as follows:
>
> this.exporter = new BasicJeriExporter(
>        TcpServerEndpoint.getInstance(host, port), new BasicILFactory() );
> this.impl = new FooImpl(....);
> FooService proxy = (FooService) exporter.export(impl);
> ByteArrayOutputStream bs = new ByteArrayOutputStream();
> ObjectOutputStream ostream = new ObjectOutputStream(bs);
> ostream.writeObject(proxy);
> ostream.flush();
> ostream.close();
> proxyBytes = bs.toByteArray();
>
> Later, when the app is launched, it opens http://$host/path/to/getProxy
> which
> just writes proxyBytes to the output stream, and the client turns that
> back
> into an object and casts it to FooService.
>
> All that works fine, except that I currently use port 9000 and some users
> run
> into trouble because some paranoid (IMO) network admin blocks outgoing tcp
> connections on all ports by default, only opening the ones they know
> about.
>
> So, I would like to use HttpServerEndpoint and pass all the packets on
> port
> 80, except apache runs on 80. Apache passes some http requests on to
> tomcat
> (using mod_rewrite proxying) but I cannot see how to setup the
> HttpServerEndpoint. Can it have a path in the http header? ivoke a
> servlet?
> doPost method passes bytes to jeri? Am I crazy?  I really just want RMI
> and
> use jeri so I do not need an rmi registry.
>
> Ideas?
>
>
> --
>
> Patrick Dowler
> Tel/Tél: (250) 363-6914          | fax/télécopieur: (250) 363-0045
> Canadian Astronomy Data Centre | Centre canadien de donnees astronomiques
> National Research Council Canada | Conseil national de recherches Canada
> Government of Canada      | Gouvernement du Canada
> 5071 West Saanich Road     | 5071, chemin West Saanich
> Victoria, BC              | Victoria (C.-B.)
>
> --------------------------------------------------------------------------
> Getting Started:     http://www.jini.org/wiki/Category:Getting_Started
> Community Web Site:  http://jini.org
> jini-users Archive:  http://archives.java.sun.com/archives/jini-users.html
> Unsubscribing:       email "signoff JINI-USERS"  to [email protected]
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.