diff --git a/TP3/.vscode/settings.json b/TP3/.vscode/settings.json new file mode 100644 index 0000000..a879d43 --- /dev/null +++ b/TP3/.vscode/settings.json @@ -0,0 +1,52 @@ +{ + "java.project.referencedLibraries": [ + "lib/**/*.jar", + "apache-tomcat-ws/lib/activation-1.1.jar", + "apache-tomcat-ws/lib/annotations-api.jar", + "apache-tomcat-ws/lib/catalina.jar", + "apache-tomcat-ws/lib/catalina-ant.jar", + "apache-tomcat-ws/lib/catalina-ha.jar", + "apache-tomcat-ws/lib/catalina-storeconfig.jar", + "apache-tomcat-ws/lib/catalina-tribes.jar", + "apache-tomcat-ws/lib/commons-codec-1.6.jar", + "apache-tomcat-ws/lib/commons-io-2.1.jar", + "apache-tomcat-ws/lib/commons-logging-1.1.1.jar", + "apache-tomcat-ws/lib/ecj-4.6.3.jar", + "apache-tomcat-ws/lib/el-api.jar", + "apache-tomcat-ws/lib/httpclient-4.2.6.jar", + "apache-tomcat-ws/lib/httpcore-4.2.5.jar", + "apache-tomcat-ws/lib/jackson-core-asl-1.9.12.jar", + "apache-tomcat-ws/lib/jackson-jaxrs-1.9.12.jar", + "apache-tomcat-ws/lib/jackson-mapper-asl-1.9.12.jar", + "apache-tomcat-ws/lib/jackson-xc-1.9.12.jar", + "apache-tomcat-ws/lib/jasper.jar", + "apache-tomcat-ws/lib/jasper-el.jar", + "apache-tomcat-ws/lib/jaspic-api.jar", + "apache-tomcat-ws/lib/jaxrs-api-3.0.9.Final.jar", + "apache-tomcat-ws/lib/jboss-annotations-api_1.1_spec-1.0.1.Final.jar", + "apache-tomcat-ws/lib/jcip-annotations-1.0.jar", + "apache-tomcat-ws/lib/jsp-api.jar", + "apache-tomcat-ws/lib/resteasy-client-3.0.9.Final.jar", + "apache-tomcat-ws/lib/resteasy-jackson-provider-3.0.9.Final.jar", + "apache-tomcat-ws/lib/resteasy-jaxb-provider-3.0.9.Final.jar", + "apache-tomcat-ws/lib/resteasy-jaxrs-3.0.9.Final.jar", + "apache-tomcat-ws/lib/resteasy-servlet-initializer-3.0.9.Final.jar", + "apache-tomcat-ws/lib/servlet-api.jar", + "apache-tomcat-ws/lib/tomcat-api.jar", + "apache-tomcat-ws/lib/tomcat-coyote.jar", + "apache-tomcat-ws/lib/tomcat-dbcp.jar", + "apache-tomcat-ws/lib/tomcat-i18n-de.jar", + "apache-tomcat-ws/lib/tomcat-i18n-es.jar", + "apache-tomcat-ws/lib/tomcat-i18n-fr.jar", + "apache-tomcat-ws/lib/tomcat-i18n-ja.jar", + "apache-tomcat-ws/lib/tomcat-i18n-ko.jar", + "apache-tomcat-ws/lib/tomcat-i18n-ru.jar", + "apache-tomcat-ws/lib/tomcat-i18n-zh-CN.jar", + "apache-tomcat-ws/lib/tomcat-jdbc.jar", + "apache-tomcat-ws/lib/tomcat-jni.jar", + "apache-tomcat-ws/lib/tomcat-util.jar", + "apache-tomcat-ws/lib/tomcat-util-scan.jar", + "apache-tomcat-ws/lib/tomcat-websocket.jar", + "apache-tomcat-ws/lib/websocket-api.jar" + ] +} \ No newline at end of file diff --git a/TP3/index.html b/TP3/index.html new file mode 100644 index 0000000..c944095 --- /dev/null +++ b/TP3/index.html @@ -0,0 +1,46 @@ + + + + + + + + + + + +
+ First Name:
+ Last Name:
+ Lecture:
+
+ +
+ +
+ +
+
+ + + diff --git a/TP3/rappel-ws.odp b/TP3/rappel-ws.odp new file mode 100644 index 0000000..51d82aa Binary files /dev/null and b/TP3/rappel-ws.odp differ diff --git a/TP3/rappel-ws.pdf b/TP3/rappel-ws.pdf new file mode 100644 index 0000000..750469d Binary files /dev/null and b/TP3/rappel-ws.pdf differ diff --git a/TP3/server-config.wsdd b/TP3/server-config.wsdd new file mode 100644 index 0000000..2ca3233 --- /dev/null +++ b/TP3/server-config.wsdd @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + http://xml.apache.org/axis/wsdd/ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/TP3/students-server/WebContent/META-INF/MANIFEST.MF b/TP3/students-server/WebContent/META-INF/MANIFEST.MF new file mode 100644 index 0000000..5e94951 --- /dev/null +++ b/TP3/students-server/WebContent/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Class-Path: + diff --git a/TP3/students-server/WebContent/WEB-INF/web.xml b/TP3/students-server/WebContent/WEB-INF/web.xml new file mode 100644 index 0000000..8ae0607 --- /dev/null +++ b/TP3/students-server/WebContent/WEB-INF/web.xml @@ -0,0 +1,18 @@ + + + essai-server + + resteasy-servlet + + org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher + + + javax.ws.rs.Application + pack.RestApp + + + + resteasy-servlet + /rest/* + + \ No newline at end of file diff --git a/TP3/students-server/src/pack/Record.java b/TP3/students-server/src/pack/Record.java new file mode 100644 index 0000000..7ba9b5e --- /dev/null +++ b/TP3/students-server/src/pack/Record.java @@ -0,0 +1,85 @@ +package pack; + +public class Record { + + String INE; + String mathematics; + String middleware; + String networks; + String systems; + String architecture; + String programming; + + public Record() {} + + public Record(String INE, String mathematics, String middleware, String networks, String systems, + String architecture, String programming) { + super(); + this.INE = INE; + this.mathematics = mathematics; + this.middleware = middleware; + this.networks = networks; + this.systems = systems; + this.architecture = architecture; + this.programming = programming; + } + + public String getINE() { + return INE; + } + + public void setINE(String INE) { + this.INE = INE; + } + + public String getMathematics() { + return mathematics; + } + + public void setMathematics(String mathematics) { + this.mathematics = mathematics; + } + + public String getMiddleware() { + return middleware; + } + + public void setMiddleware(String middleware) { + this.middleware = middleware; + } + + public String getNetworks() { + return networks; + } + + public void setNetworks(String networks) { + this.networks = networks; + } + + public String getSystems() { + return systems; + } + + public void setSystems(String systems) { + this.systems = systems; + } + + public String getArchitecture() { + return architecture; + } + + public void setArchitecture(String architecture) { + this.architecture = architecture; + } + + public String getProgramming() { + return programming; + } + + public void setProgramming(String programming) { + this.programming = programming; + } + + + +} diff --git a/TP3/students-server/src/pack/RestApp.java b/TP3/students-server/src/pack/RestApp.java new file mode 100644 index 0000000..1614d02 --- /dev/null +++ b/TP3/students-server/src/pack/RestApp.java @@ -0,0 +1,19 @@ +package pack; + +import java.util.HashSet; +import java.util.Set; + +import javax.ws.rs.core.Application; + +public class RestApp extends Application { + private Set singletons = new HashSet(); + + public RestApp() { + singletons.add(new Students()); + } + + @Override + public Set getSingletons() { + return singletons; + } +} diff --git a/TP3/students-server/src/pack/Student.java b/TP3/students-server/src/pack/Student.java new file mode 100644 index 0000000..9b7a0ee --- /dev/null +++ b/TP3/students-server/src/pack/Student.java @@ -0,0 +1,126 @@ +package pack; + +public class Student { + + String INE; + String firstname; + String lastname; + String birthdate; + String sex; + String address; + String city; + String zip; + String country; + String phone; + String email; + + public Student() {} + + public Student(String INE, String firstname, String lastname, String birthdate, String sex, String address, + String city, String zip, String country, String phone, String email) { + super(); + this.INE = INE; + this.firstname = firstname; + this.lastname = lastname; + this.birthdate = birthdate; + this.sex = sex; + this.address = address; + this.city = city; + this.zip = zip; + this.country = country; + this.phone = phone; + this.email = email; + } + + public String getINE() { + return INE; + } + + public void setINE(String INE) { + this.INE = INE; + } + + public String getFirstname() { + return firstname; + } + + public void setFirstname(String firstname) { + this.firstname = firstname; + } + + public String getLastname() { + return lastname; + } + + public void setLastname(String lastname) { + this.lastname = lastname; + } + + public String getBirthdate() { + return birthdate; + } + + public void setBirthdate(String birthdate) { + this.birthdate = birthdate; + } + + public String getSex() { + return sex; + } + + public void setSex(String sex) { + this.sex = sex; + } + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + + public String getCity() { + return city; + } + + public void setCity(String city) { + this.city = city; + } + + public String getZip() { + return zip; + } + + public void setZip(String zip) { + this.zip = zip; + } + + public String getCountry() { + return country; + } + + public void setCountry(String country) { + this.country = country; + } + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + + + +} diff --git a/TP3/students-server/src/pack/Students.java b/TP3/students-server/src/pack/Students.java new file mode 100644 index 0000000..a1a393b --- /dev/null +++ b/TP3/students-server/src/pack/Students.java @@ -0,0 +1,61 @@ +package pack; + +import java.util.Hashtable; + +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; + +@Path("/rest") +public class Students { + + // bad + static Hashtable students = new Hashtable(); + static Hashtable records = new Hashtable(); + + static void addStudent(Student s) { + students.put(s.getFirstname() + "-" + s.getLastname(), s); + } + + static void addRecord(Record r) { + records.put(r.getINE(), r); + } + + static { + addStudent(new Student("1111111111", "Alain", "Tchana", "18/12/1984", "male", "3 rue Jeff Rouchon", "Toulouse", + "31000", "France", "0102030405", "alain.tchana@enseeiht.fr")); + addStudent(new Student("2222222222", "Boris", "Teabe", "12/03/1990", "male", "6 rue Paul Biya", "Yaoundé", + "xxxxx", "Cameroun", "0607080910", "boris.teabe@enseeiht.fr")); + addStudent(new Student("3333333333", "Axel", "Carlier", "05/07/1987", "male", "9 rue Denis Dartus", "Toulouse", + "31000", "France", "0102030405", "axel.carlier@enseeiht.fr")); + addStudent(new Student("4444444444", "Zouheir", "Hamrouni", "07/10/1970", "male", "2 rue Geraldine Morin", + "Toulouse", "31000", "France", "0102030405", "zouheir.hamrouni@enseeiht.fr")); + addStudent(new Student("5555555555", "Daniel", "Hagimont", "08/07/1965", "male", "1 Francois Asselineau", + "Toulouse", "31000", "France", "0102030405", "daniel.hagimont@enseeiht.fr")); + + addRecord(new Record("1111111111", "12", "14", "11", "5", "16", "18")); + addRecord(new Record("2222222222", "11", "7", "15", "16", "16", "2")); + addRecord(new Record("3333333333", "9", "18", "11", "15", "16", "20")); + addRecord(new Record("4444444444", "7", "19", "13", "5", "16", "18")); + addRecord(new Record("5555555555", "9", "12", "11", "18", "3", "18")); + } + + @GET + @Path("/getstudent") + @Produces({ "application/json" }) + public Student getStudent(@QueryParam("firstname") String firstname, @QueryParam("lastname") String lastname) { + String key = firstname + "-" + lastname; + System.out.println("access student: " + key); + return students.get(key); + } + + @GET + @Path("/getrecord") + @Produces({ "application/json" }) + public Record getRecord(@QueryParam("ine") String ine) { + System.out.println("access record: " + ine); + return records.get(ine); + } + +} diff --git a/TP3/tp-ws.odt b/TP3/tp-ws.odt new file mode 100644 index 0000000..5b8eb0d Binary files /dev/null and b/TP3/tp-ws.odt differ diff --git a/TP3/tp-ws.pdf b/TP3/tp-ws.pdf new file mode 100644 index 0000000..5237629 Binary files /dev/null and b/TP3/tp-ws.pdf differ