Web architectures
Extending a simple web server
The goal of this assignment is to extend a concurrent http mini-server. The extension aims to execute external processes and handle their responses. Moreover, this allows the external process to respond with dynamic web pages, which will be managed by the server.
RMI Demo
This assignment is focused on Java RMI (Remote Method Invocation) which allows an object running in one Java virtual machine (JVM) to invoke methods on an object running in another JVM.
More specifically, this exercise consists in developing two separate programs, a client and a server. The server shows a remote method addTimestamp with a parameter of type Document. The method adds the string “Viewed on “+Timestamp in the Document. On the other hand, the client creates a new Document and asks the server to add the string “Viewed on “+Timestamp. Finally, the client prints the content of the Document.
Document is a custom class that has the method addString to append a string at the end of the Document and a method toString to print out the entire Document.
Accessing an enterprise bean
The topic of this assignment is the Enterprise JavaBean (EJB), which is a server-side software component that encapsulates the business logic of an application into a single object (the bean).
The first part of the assignment consists of installing WildFly, writing an enterprise bean which exposes a method for giving a string containing the date and the time of the day and finally deploying the enterprise bean on WildFly.
Moreover, the second part of the assignment consists of writing a client (a standard Java Application) which connects to the bean, asks twice the method on the bean and writes the result on screen.
Accessing a DB through an EJB Layer
The goal of this assignment is to develop an Enterprise JavaBean (EJB) which allows users to perform some typical operation of online stores and saves information into a DB.
Moreover, two different client have been developed, one for administrator and one for regular users. The administrator client BookStoreAdministrator allows to add a new book to the DB, specifying title and price, and to list all of buying operation performed by users.
On the other hand, the user client BookStoreClient requires users to register or login to the DB at first. After that the client allows them to add books to the cart, buy all the books present in the cart, empty the cart and see the content of the cart.
However, the purpose of the assignment is to correctly identify where to use stateful beans, stateless beans and entities, using at least one of each sort.
Writing an annotation preprocessor
The goal of this assignment is to develop a program (called BeanGenerator) which transforms a suitably annotated POJO into a JavaBean.
The program takes as input java file containing a POJO and if the class contains the @bean annotation, a java file is generated as output, which contains the same class transformed into a JavaBean.
In order to function as a JavaBean, a class must follow certain conventions about method naming, construction, and behavior: the class instance variables should be private, the class must have a public default constructor without arguments, the class properties must be accessible using get, set and is (which can be used for boolean properties instead of get), the class should be serializable (it is not mandatory).
XML, XSD and XSL
This assignment is focused on XML. In particular the first part of the assignment consists in writing an XML schema for the given XML file named ACMTrento.xml.
On the other hand, the second part of the assignment consists in writing an XSL Transformation (XSLT) that generates a CSV file (comma-separated values) from the given XML file ACMTrento.xml. The CSV file should contain the following fields: Unit Name, Type, Time
Moreover, a Java program was implemented in order to run the transformation.
Servlets, JSPs and Filters
The goal of this assignment is to create a website that replaces the desktop interfaces of the administrator and the user, developed for the 4th assignment. The website allows users to access a DB through an Enterprise JavaBean (EJB) Layer, performing some typical operation of online stores.
The users require to register or login to the website at first. After that, the website shows them in homepage all the available books. Now the user is free to add books to the cart, see the content of the cart, buy all the books present in the cart and empty the cart. Moreover, the user can logout through the session timeouts automatically after 60 minutes.
On the other hand, the website allows the administrator to do the same thing as regular users. In addition, the administrator can add a new book to the DB, specifying title and price, and list all of buying operation performed by users.
The implementation of the website was performed through servlets, JSPs and filters.
Integration between Java EE and AngularJS
The goal of this assignment is to develop a small and simple application which shows an integration between Java EE 7 and AngularJS.
The application allows to handle a very simple library database where it is possible to add authors, add books with its own author, see the books present in the DB and delete a book.
AngularJS was used to display the data, extending the traditional HTML with additional custom tag attributes.
The application was written along the lines shown in this example.