Call a method based on string value received - Suggestions?

Discussion in 'Java' started by Karthik D, Aug 21, 2003.

  1. Karthik D

    Karthik D Guest

    Hello All,
    I am working on a small project (of my own to learn Java N/W
    programming)which is to implement a FTP server.I am newbie in
    designing Java programs.
    What I am trying to achieve is when a ftp client sends a message
    like USER,PASS or some message I wanted to invoke the appropriate
    method which does the processing of client's request and sends the
    response back to the client?
    I read the client's request from the socket through BufferedReader
    Stream.
    For e.g when I receive a string called PASS I would call PASS()
    method which sends the request for password to the client asking the
    user to enter the password to login.
    I read in the newsgroups(comp.lang.java.*)that to invoke a method
    dynamically one can use reflection APIs to achieve it.Some of them
    told reflection APIs have some problems/overhead.
    Is there any other way I can invoke methods based on a particular
    string value?
    One more question.I have read little about design patterns.But I
    used to get confused where to use which patterns while designing the
    programs.I would like to understand design patterns well and apply
    them even in my small Java projects.Any suggestions for designing
    better java programs?

    Thanks & Regards,
    Karthik
    Karthik D, Aug 21, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Zenobia
    Replies:
    2
    Views:
    3,940
    Zenobia
    Jun 23, 2004
  2. Karthik D
    Replies:
    0
    Views:
    415
    Karthik D
    Aug 18, 2003
  3. Lilith
    Replies:
    10
    Views:
    480
    peter koch
    Dec 20, 2007
  4. Peña, Botp
    Replies:
    1
    Views:
    221
    Robert Klemme
    Jan 24, 2004
  5. sanju dhoomakethu
    Replies:
    0
    Views:
    113
    sanju dhoomakethu
    Sep 13, 2013
Loading...

Share This Page