This week's book giveaway is in the Big Data forum.
We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman on-line!
See this thread for details.
The moose likes Java in General and the fly likes information exchange by unrelated classes owned by different users Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "information exchange by unrelated classes owned by different users" Watch "information exchange by unrelated classes owned by different users" New topic

information exchange by unrelated classes owned by different users

Brendan Kennedy
Ranch Hand

Joined: May 02, 2001
Posts: 65
Basically what I want to do is write a servlet that outputs a wml page that will tell me if I have new mail or not. The problem is that all servlets are run as the apache user instead of as me so all processes will be run as apache processes, ie 'frm -S -q' will say whether apache has been mailed anything and not me.
To solve this I do not wish to save the relavent information to a file and have apache access the file, I want the servlet to pass a string to a class run by my account and this class will return a string with the proper results. I do not have access to sockets on the system, but the class wouldn't really be remotely accessed anyway.
What I want to know is the way(if there is one) to comunicate between classes if they're not compiled together or part of the same package or even owned by the same user. I've looked at using Objectoutput/inputstream but it seems to use an intermediary socket which I don't have access to.
Sorry if this is the wrong board to post this, but I don't think it's really a servlet question..
John Mill

Joined: Feb 12, 2002
Posts: 11
Hi Brendan
I may have completely missed your point but I think that all you're after doing is getting a parameter off of the http request and passing it along to another class that you've defined. If so then you have two immediate choices:
1) Build the url manually and use a http 'get' e.g. http://myserver/myPage.html?myParam=myVar
2) Include a form in the page and set the action url to the servlet's url, (thus using post)
You may need more than one param and if so you may find holding a cookie at the client that is then used to recreate the state of the server-side process more appropriate.
The fact that the classes have not been built/compiled together should not affect you at all.
Hope that this helps some
Brendan Kennedy
Ranch Hand

Joined: May 02, 2001
Posts: 65
Thanks for replying
I'm not too knowlegable about cookies or what they can do - but I'll research it and see if they can help.
As far as I can see though nothing really should be happening client side except to initiate the servlet and recieving the wml data. Some of the info sent back that I want can only be gotten by running processes with my uid (basically from my account).
The problem is that all processes run by apache have the apache uid so the relavent information can't be obtained. The way I want to get around it is by haveing a class that was initiated by me in my account (and thus having my id) interact with the servlet and get the information back that way. I was wondering if there was a way to do this without using sockets(which I don't have access to) or periodically updating a text file.
I posted this on the servlet board just in case and was told to check out the Java mail api but it doesn't sound like solution I want :/
Any further comments would be greatly appreciated
I agree. Here's the link:
subject: information exchange by unrelated classes owned by different users