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:
Writers have the option of sending a message to a recipient.
Recipients have the option to:
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"); } }
Use this lab to help you deploy the service.
Use this lab to help you develop a client containing a menu for:
The goal is to develop 2 clients that run 2 scenarios that make up the developed web services: