Class MailUs

MailUs

public class MailUs

This servlet is responsible for sending an e-mail to the web-shop owner. You know, its this ol' guy sittin' in front of it all day readin' newspaper and grumbling 'n moarning to all and everybody...(or maybe i'm wrong?).

Version:
$Id: MailUs.java,v 1.18 2001/07/10 12:53:40 mkranz Exp $
Author:
Erguen Cimen Marco Kranz

Field Summary
private  java.io.BufferedReader in
           
private  java.io.PrintWriter out
          A PrintWriter object.
 
Constructor Summary
MailUs()
           
 
Method Summary
private  void commandReceived(java.io.BufferedReader in)
          This method waits for the SMTP-hosts to answer on every single sended command and checks if the host accepts the commands or not.
 void doGet(HttpServletRequest request, HttpServletResponse response)
          This Method just calls doPost().
 void doPost(HttpServletRequest request, HttpServletResponse response)
          This Method generates the HTML-Code.
private  void send(java.lang.String s)
          Prints the String s to the PrintWriter "out" (which is a private field of this class' instances) followed by the line feed character.
private  void sendMail(HttpServletRequest request, HttpServletResponse response)
          This method provides the sending of the email.
 

Field Detail

out

private java.io.PrintWriter out
A PrintWriter object. Needed to communicate with the mail host.
See Also:
send(String)

in

private java.io.BufferedReader in
Constructor Detail

MailUs

public MailUs()
Method Detail

doGet

public void doGet(HttpServletRequest request,
                  HttpServletResponse response)
           throws ServletException,
                  java.io.IOException
This Method just calls doPost().

doPost

public void doPost(HttpServletRequest request,
                   HttpServletResponse response)
            throws ServletException,
                   java.io.IOException
This Method generates the HTML-Code.

sendMail

private void sendMail(HttpServletRequest request,
                      HttpServletResponse response)
This method provides the sending of the email. Therefore a SMTP-Server is used. It's called with the class ServerData. For our implementation we use the server of the FU-Berlin: "Mail.Zedat.fu-berlin.de smtp".

send

private void send(java.lang.String s)
           throws java.io.IOException
Prints the String s to the PrintWriter "out" (which is a private field of this class' instances) followed by the line feed character. After doing so, it flushes "out".

commandReceived

private void commandReceived(java.io.BufferedReader in)
                      throws java.lang.InterruptedException,
                             java.io.IOException
This method waits for the SMTP-hosts to answer on every single sended command and checks if the host accepts the commands or not.
Parameters:
in - from where to read the hosts answers.