E-mail web service

Objective

The objective of this lab is to design an electronic mail server. The mail server receives requests from clients (seen by it as writers, recipients).

The main features of this mail server are as follows:

  1. receive e-mail messages from writers,
  2. store them in letter boxes,
  3. send them on request to the recipients.
  4. delete read messages from a recipient

Writers have the option of sending a message to a recipient.

Recipients have the option to:

  1. retrieve all messages stored in their mailbox on the mail server
  2. Retrieve new messages that have arrived in their mailbox (since the last consultation)
  3. delete read messages

Server development

Develop two classes Message.java and MailServer.java in a services.mail package.

Here are the skeletons of these two classes:

The Message class:

package services.mail;
public class Message implements java.io.Serializable {
    private String message="";
    private String from;
    private String to;
    private boolean isNew;
 
    public Message(String fromp, String top, String messagep){
	// initialisation des variables	
    }
 
    public String getTo(){
	return to;
    }
    public String getFrom(){
	return from;
    }
    public String getMessage(){
	return message;
    }
    public void setTo(String top){
	to=top;
    }
    public void setFrom(String fromp){
	from=fromp;
    }
    //ici vous pouvez ajouter les methodes que vous jugez nécessaires
 
}

The MailServer class:

package services.mail;
import java.util.*;
public class MailServer{
    Message messages[];
    public MailServer(){
	//initialisation des variables
    }
 
   public String sendMessage(String fromp, String top, String messagep){
       // créer un  nouveau message 
       // ajouter LE dans la listes des messages du serveur
       return ("Message sent successfully");
    }
 
    public Message[] getMessages (String to){
	// recupérer, dans un tableau, les messages dont le destinataire est "to", il faut les marquer comme étant "lu"
	// envoyer le résultat au client
    }
 
    public String removeMessages (String to){
	int oldMessageNumber=0;
	// supprimer tous les messages marqué comme étant "lu" et dont le destinataire est "to"
	if(oldMessageNumber==0)
	   return ("No old messages");
	else
	   return ("Old messages removed successfully");
    }
 
}

Server deployment

Use this lab to help you deploy the service.

Client development

Use this lab to help you develop a client containing a menu for:

  1. sending an email,
  2. reading all emails received
  3. deleting all received mails
  4. deleting an email

Development of composition scenarios

The goal is to develop 2 clients that run 2 scenarios that make up the developed web services:

  1. Read all the messages in the box and delete the messages containing SPAM in their subject
  2. Read the messages in the box and do this conditional treatment:
    1. If the message comes from a particular sender; send him an acknowledgment email, otherwise
    2. Delete Message
teaching_assistant/web_services/web_service_mail_server.txt · Last modified: 2021/11/29 09:13 by IT Courses (NNC)
Back to top
CC Attribution-Share Alike 4.0 International
chimeric.de = chi`s home Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0