Re: Interapp Communications

2008-09-15 Thread Johnny Kewl


- Original Message - 
From: Darryl Pentz [EMAIL PROTECTED]

To: Tomcat Users List users@tomcat.apache.org
Sent: Monday, September 15, 2008 10:37 AM
Subject: Interapp Communications


Some time back I needed to communicate between two apps running in the 
same Tomcat instance. I decided on using a simple HTTP call with Apache 
Commons HttpClient. For some reason use of this class is causing PermGen 
errors (I should add that I use a dynamic language in the mix, which might 
impact that in some way) so I want to abandon that approach anyway, 
because it just doesn't 'feel right' :-).


So I was wondering, is JMS the way to go with something like this? I see 
Tomcat is able to use JMS via a JNDI read-only lookup.


Many thanks,
Darryl Pentz


Well, the way you doing it is also good for cross machine, cross domain 
you using simple SOAP... Axis your way...
That HTTPd client is quite heavy, maybe Java's URL Connection will do what 
you need


I dont bother too much with the stuff out there... JMS is a way, but you 
looking for JNDI registries now.

Not sure if TC built in JNDI... targeting tomcat... will be enuf?
Some very rough code for you to play with... Java really makes http very 
very easy



private byte[] loadURLFileBytes(String urlPlusFile) {

   byte[] data = new byte[0];
   try {
   URL url = new URL(urlPlusFile);

   URLConnection connection = url.openConnection();

   connection.setDoInput(true);//GET
   connection.setUseCaches(false); // get fresh from server
   InputStream in = connection.getInputStream();
   BufferedInputStream bis = new BufferedInputStream(in);

   int length = connection.getContentLength();

   int len;
   byte[] buffer = new byte[512];
   while ((len = bis.read(buffer)) != -1) {
   data = appendBlock(data,buffer,len);

   }

   in.close();
   bis.close();

   } catch(Exception ex) {
   //JOptionPane.showMessageDialog(null, ex.getMessage() , Error 
during data download, JOptionPane.WARNING_MESSAGE);

   return null;
   }

   return data;
}

That all your HTTP is doing for you...
Then Tomcat can do cross contexts as well... theres a cross context flag to 
set and some code that looks like this..

The post also describes the issue...
http://forums.java.net/jive/thread.jspa?messageID=215873

One day when your site is huge, you making millions... maybe your cross 
machine way will sound good again ;)


Theres SOA/EJB as well... ;)

Have fun...
---
HARBOR : http://www.kewlstuff.co.za/index.htm
The most powerful application server on earth.
The only real POJO Application Server.
See it in Action : http://www.kewlstuff.co.za/cd_tut_swf/whatisejb1.htm
---




-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Applications/software for Tomcat 6 / PhP

2008-09-15 Thread ayden
Hello,
I hope I have asked the right forum for this question. Im not rechnical so
anying in simple terms would be greatly appreciated.

I am having a auction website built in PhP, using a sun coolthreads server
and Solaris 10 and wish to implement a SUN optimised AMP stack (Apache,
MySQl 64bit, PhP), as well as adding to it Tomcat 6.

My questions are:

Can anyone recommend LEADING edge/ BLEEDING edge apps/software which will
work on Tomcat 6.x.x.x. ? PhP or J2EE/Java/AJAX stuff

My Auction site will also have blogs (looking at Apache ROLLER or
WordPress unless someone can recommend something better?) as well as
pushing auction updates to clients (asynchronous, web-based push of
presentation changes to the client browser based on server-side events). I
am looking at Icefaces.org AJAX push technology unless someone can
recommend something else? however I believe this requires NIO or comet or
something, which I believe is called MINA under apache?? So I am guessing
I need to install MINA as well to Tomcat?

I also wish to have desktop widgets (someone can select the
auction/picture, drag onto desktop and continue to watch it with browser
closed). Can anyone recommend any app's/software or prebuilt widgets which
works on mutiple platforms? Hoping to eventually leverage off the Icefaces
AJAX technology and send auction status updates to the widget

If anyone has any knowledge or thoughts they wish to share, I would
greatly appreciate it.

Many Thanks,

Ayden



-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]