Results 1 to 2 of 2
  1. #1
    akhalsa is offline Member
    Join Date
    Feb 2011
    Rep Power

    Question 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!


  2. #2
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Rep Power

Similar Threads

  1. Accss and define Class within Interfaces
    By in forum Advanced Java
    Replies: 2
    Last Post: 12-20-2010, 06:20 PM
  2. problem in creating a class that should always run in the server
    By harsha.udupa2008 in forum New To Java
    Replies: 1
    Last Post: 07-14-2010, 02:56 PM
  3. Interfaces
    By computerquip in forum New To Java
    Replies: 19
    Last Post: 09-08-2009, 04:58 PM
  4. Class Reflection: Finding implemented interfaces
    By Java Tip in forum java.lang
    Replies: 0
    Last Post: 04-23-2008, 08:09 PM
  5. Interfaces
    By imran_khan in forum New To Java
    Replies: 5
    Last Post: 07-30-2007, 08:11 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts