Results 1 to 2 of 2
Thread: class interfaces to server
- 02-03-2011, 04:43 AM #1
Member
- Join Date
- Feb 2011
- Posts
- 1
- Rep Power
- 0
class interfaces to server
Hi Guys
This may not be the right forum for this question, but if anyone has any thoughts, I would appreciate it.
I am a bit unclear on what the best approach is given the following scenario:
I have a program I am writing which needs to interface to my server and database. To do so, I have am writing a ServerRequest class (actually its an interface with an implementation and a factory class to instantiate... although for the purposes of this question, I don't think that makes a difference)
Other classes instantiate the ServerRequest class and make various requests to the server through it. The ServerRequest class creates a new thread, and handles the http request.
Unfortunately, I need my listener for the server's response to be from the original class which had the ServerRequest instance, and not the ServerRequest class itself. Barring that, I would still need to get the information back to the original class from the ServerRequest.
In other languages, I would simply pass a function from the original class to the ServerRequest class to be the listener. However, I don't think that is quite right in java.
Can anyone point me in the right direction for the best way to attack this?
Thanks in advance!
Avtar
- 02-03-2011, 04:48 AM #2
Moderator
- Join Date
- Jul 2010
- Location
- California
- Posts
- 1,619
- Rep Power
- 5
Similar Threads
-
Accss and define Class within Interfaces
By rajselva@cooltoad.com in forum Advanced JavaReplies: 2Last Post: 12-20-2010, 05:20 PM -
problem in creating a class that should always run in the server
By harsha.udupa2008 in forum New To JavaReplies: 1Last Post: 07-14-2010, 02:56 PM -
Interfaces
By computerquip in forum New To JavaReplies: 19Last Post: 09-08-2009, 04:58 PM -
Class Reflection: Finding implemented interfaces
By Java Tip in forum java.langReplies: 0Last Post: 04-23-2008, 08:09 PM -
Interfaces
By imran_khan in forum New To JavaReplies: 5Last Post: 07-30-2007, 08:11 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks