/javaee_projects

Repository for Java EE projects to test the plataform.

Primary LanguageJavaMIT LicenseMIT

Java EE Projects

Repository for Java EE projects to test the plataform. To test I've created a ToyShop application using different technologies of Java EE.

Bean Validation

Project to test the some features of bean validation.

JSF Handler

Project to test JSF Exception Handler (sadly CDI isn't working at ExceptionHandler class, so comment the line of eventFirer.fire)

CDI

Project to test a little of power of CDI.

JAX-RS

Project to test some features of JAX-RS specification. Example of request: curl -v -H "Authorization: Odair" http://127.0.0.1:8080/jaxrs-specification/resources/person/1

  • ToyShop US.txt: user stories used of the features of the application;
  • ToyShopDbScript.sql: script of database with tables for Realm, inserts of data and so on.

ToyShop Faces

Project using: JSF (with bean validation), EJB, JPA, JAAS and JAX-WS/RS.

  • JSF: presentation layer;
  • JPA: model layer;
  • EJB: business layer;
  • Web service: layer to allow other applications integrate with the ToyShop;
  • Test: JUnit, Mockito and Arquillian.

ToyShop Servlets

Project using: Servlets, JSP, EJB, JPA and JAAS.

  • Servlets/JSP: presentation layer;
  • JPA: model layer;
  • EJB: business layer.

JDBCRealm

Tomcat - server.xml:

<Realm className="org.apache.catalina.realm.JDBCRealm" debug="99" driverName="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://localhost/DbWithTables?user=root&amp;password=123123" userTable="USER" userNameCol="username" userCredCol="password" userRoleTable="ROLE" roleNameCol="rolename" />

JBoss - standalone.xml:

  • In <security-domain> named as "other" include this in <authentication> node: <login-module code="UsersRoles" flag="required"/>
  • Then include this node in <security-domains>
<security-domain name="ToyShopRealm" cache-type="default">
    <authentication>
        <login-module code="Database" flag="required">
            <module-option name="dsJndiName" value="java:/jdbc/DataSourceToDB"/>
            <module-option name="principalsQuery" value="select password from USER where username=?"/>
            <module-option name="rolesQuery" value="select rolename,'Roles' from USER_ACL where username=?"/>
            <module-option name="hashAlgorithm" value="MD5"/>
            <module-option name="hashEncoding" value="base64"/>
            <module-option name="unauthenticatedIdentity" value="Guest"/>
        </login-module>
    </authentication>
</security-domain>

To Do

  • Include a support chat using WebSockets

Links