...
WebAppJDBCAccessAnnotations.war
includes a Servlet, a JSP and a basic web.xml
. The following excerpt shows the annotation part the wizard has identified and will likely be prompting for additional information while deploying the application.
Code Block |
---|
| java |
---|
borderStyle | solid |
---|
title | Excerpt from ListCustomers.java |
---|
borderStyle | solid |
---|
| java |
---|
|
...
import javax.annotation.Resource;
...
/**
* Servlet implementation class for Servlet: ListCustomers
*
*/
public class ListCustomers extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet {
@Resource(name = "jdbc/MyDataSource")
private DataSource dataSource;
...
|
...
The final configuration page displays the generated deployment plan and allows you to make any additional editing. The following example shows the generated deployment plan.
Code Block |
---|
| xml | borderStyle | solid |
---|
title | Generated deployment plan |
---|
borderStyle | solid |
---|
| xml |
---|
|
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-2.0.1">
<dep:environment xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2">
<dep:moduleId>
<dep:groupId>default</dep:groupId>
<dep:artifactId>WebAppJDBCAccessAnnotations</dep:artifactId>
<dep:version>1.0</dep:version>
<dep:type>war</dep:type>
</dep:moduleId>
<dep:dependencies>
<dep:dependency>
<dep:groupId>console.dbpool</dep:groupId>
<dep:artifactId>BankDB_Pool</dep:artifactId>
<dep:version>1.0</dep:version>
<dep:type>rar</dep:type>
</dep:dependency>
</dep:dependencies>
</dep:environment>
<context-root>WebAppJDBCAccessAnnotations</context-root>
<nam:resource-ref xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.2">
<nam:ref-name>jdbc/MyDataSource</nam:ref-name>
<nam:pattern>
<nam:groupId>console.dbpool</nam:groupId>
<nam:artifactId>BankDB_Pool</nam:artifactId>
<nam:version>1.0</nam:version>
<nam:name>BankDB_Pool</nam:name>
</nam:pattern>
</nam:resource-ref>
</web-app>
|
...
WebAppEjbAccessAnnotations.war
includes a Servlet, a JSP and a basic web.xml
. The following excerpt shows the annotation part the wizard has identified and will likely be prompting for additional information while deploying the application.
Code Block |
---|
| java | borderStyle | solid |
---|
title | Excerpt from ConverterHandler.java |
---|
borderStyle | solid |
---|
| java |
---|
|
...
public class ConverterHandler extends javax.servlet.http.HttpServlet implements
javax.servlet.Servlet {
@EJB(name = "ejb/Converter")
private Converter converter;
...
|
...
The final configuration page displays the generated deployment plan and allows you to make any additional editing. The following example shows the generated deployment plan.
Code Block |
---|
| xml | borderStyle | solid |
---|
title | Generated deployment plan |
---|
borderStyle | solid |
---|
| xml |
---|
|
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-2.0.1">
<dep:environment xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2">
<dep:moduleId>
<dep:groupId>default</dep:groupId>
<dep:artifactId>WebAppEjbAccessAnnotations</dep:artifactId>
<dep:version>1.0</dep:version>
<dep:type>war</dep:type>
</dep:moduleId>
<dep:dependencies>
<dep:dependency>
<dep:groupId>default</dep:groupId>
<dep:artifactId>CurrencyConverterEJB</dep:artifactId>
<dep:version>1199912901187</dep:version>
<dep:type>jar</dep:type>
</dep:dependency>
</dep:dependencies>
</dep:environment>
<context-root>WebAppEjbAccessAnnotations</context-root>
<nam:ejb-ref xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.2">
<nam:ref-name>ejb/Converter</nam:ref-name>
<nam:pattern>
<nam:groupId>default</nam:groupId>
<nam:artifactId>CurrencyConverterEJB</nam:artifactId>
<nam:version>1199912901187</nam:version>
<nam:name>ConverterBean</nam:name>
</nam:pattern>
</nam:ejb-ref>
</web-app>
|
...
WebAppJMSAccessAnnotations.war
includes the two Servlets mentioned above, a JSP and a basic web.xml. The following excerpts show the annotation part the wizard has identified and will likely be prompting for additional information while deploying the application.
Code Block |
---|
| java | borderStyle | solid |
---|
title | Excerpt from ProducerServlet.java |
---|
borderStyle | solid |
---|
| java |
---|
|
...
/**
* Servlet implementation class for Servlet: ProducerServlet
*
*/
public class ProducerServlet extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet {
@Resource(name="jms/TestConnectionFactory")
private ConnectionFactory connectionFactory;
@Resource(name="jms/TestQueue")
private Queue queue;
...
|
Code Block |
---|
| java |
---|
borderStyle | solid |
---|
title | Excerpt from ConsumerServlet.java |
---|
borderStyle | solid |
---|
| java |
---|
|
...
/**
* Servlet implementation class for Servlet: ConsumerServlet
*
*/
public class ConsumerServlet extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet {
@Resource(name="jms/TestConnectionFactory")
private ConnectionFactory connectionFactory;
@Resource(name="jms/TestQueue")
private Queue queue;
...
|
...
The final configuration page displays the generated deployment plan and allows you to make any additional editing. The following example shows the generated deployment plan.
Code Block |
---|
| xml |
---|
borderStyle | solid |
---|
title | Generated deployment plan |
---|
borderStyle | solid |
---|
| xml |
---|
|
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-2.0.1">
<dep:environment xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2">
<dep:moduleId>
<dep:groupId>default</dep:groupId>
<dep:artifactId>WebAppJMSAccessAnnotations</dep:artifactId>
<dep:version>1.0</dep:version>
<dep:type>war</dep:type>
</dep:moduleId>
<dep:dependencies>
<dep:dependency>
<dep:groupId>org.apache.geronimo.configs</dep:groupId>
<dep:artifactId>activemq-ra</dep:artifactId>
<dep:version>2.1-SNAPSHOT</dep:version>
<dep:type>car</dep:type>
</dep:dependency>
</dep:dependencies>
</dep:environment>
<context-root>WebAppJMSAccessAnnotations</context-root>
<nam:resource-ref xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.2">
<nam:ref-name>jms/TestConnectionFactory</nam:ref-name>
<nam:pattern>
<nam:groupId>org.apache.geronimo.configs</nam:groupId>
<nam:artifactId>activemq-ra</nam:artifactId>
<nam:version>2.1-SNAPSHOT</nam:version>
<nam:name>DefaultActiveMQConnectionFactory</nam:name>
</nam:pattern>
</nam:resource-ref>
<nam:resource-env-ref xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.2">
<nam:ref-name>jms/TestQueue</nam:ref-name>
<nam:pattern>
<nam:groupId>org.apache.geronimo.configs</nam:groupId>
<nam:artifactId>activemq-ra</nam:artifactId>
<nam:version>2.1-SNAPSHOT</nam:version>
<nam:name>MDBTransferBeanOutQueue</nam:name>
</nam:pattern>
</nam:resource-env-ref>
</web-app>
|
...
WebAppJDBCAccess.war
includes a Servlet, a JSP and web.xml
. The following sample illustrates the web.xml
, in this example the Plan Creator wizard will look into the <resource-ref>
section.
Code Block |
---|
| xml |
---|
borderStyle | solid |
---|
title | web.xml |
---|
borderStyle | solid |
---|
| xml |
---|
|
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID" version="2.5">
<servlet>
<description></description>
<display-name>ListCustomers</display-name>
<servlet-name>ListCustomers</servlet-name>
<servlet-class>myPackage.ListCustomers</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ListCustomers</servlet-name>
<url-pattern>/listCustomers</url-pattern>
</servlet-mapping>
<resource-ref>
<res-ref-name>jdbc/MyDataSource</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
</web-app>
|
...
Section |
---|
Column |
---|
| Code Block |
---|
| xml |
---|
borderStyle | solid |
---|
title | Generated deployment plan without Annotations |
---|
borderStyle | solid |
---|
| xml |
---|
|
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-2.0.1">
<dep:environment xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2">
<dep:moduleId>
<dep:groupId>default</dep:groupId>
<dep:artifactId>WebAppJDBCAccess</dep:artifactId>
<dep:version>1.0</dep:version>
<dep:type>war</dep:type>
</dep:moduleId>
<dep:dependencies>
<dep:dependency>
<dep:groupId>console.dbpool</dep:groupId>
<dep:artifactId>BankDB_Pool</dep:artifactId>
<dep:version>1.0</dep:version>
<dep:type>rar</dep:type>
</dep:dependency>
</dep:dependencies>
</dep:environment>
<context-root>WebAppJDBCAccess</context-root>
<nam:resource-ref xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.2">
<nam:ref-name>jdbc/MyDataSource</nam:ref-name>
<nam:pattern>
<nam:groupId>console.dbpool</nam:groupId>
<nam:artifactId>BankDB_Pool</nam:artifactId>
<nam:version>1.0</nam:version>
<nam:name>BankDB_Pool</nam:name>
</nam:pattern>
</nam:resource-ref>
</web-app>
|
|
Column |
---|
| Code Block |
---|
| xml | borderStyle | solid |
---|
title | Generated deployment plan with Annotations |
---|
borderStyle | solid |
---|
| xml |
---|
|
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-2.0.1">
<dep:environment xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2">
<dep:moduleId>
<dep:groupId>default</dep:groupId>
<dep:artifactId>WebAppJDBCAccessAnnotations</dep:artifactId>
<dep:version>1.0</dep:version>
<dep:type>war</dep:type>
</dep:moduleId>
<dep:dependencies>
<dep:dependency>
<dep:groupId>console.dbpool</dep:groupId>
<dep:artifactId>BankDB_Pool</dep:artifactId>
<dep:version>1.0</dep:version>
<dep:type>rar</dep:type>
</dep:dependency>
</dep:dependencies>
</dep:environment>
<context-root>WebAppJDBCAccessAnnotations</context-root>
<nam:resource-ref xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.2">
<nam:ref-name>jdbc/MyDataSource</nam:ref-name>
<nam:pattern>
<nam:groupId>console.dbpool</nam:groupId>
<nam:artifactId>BankDB_Pool</nam:artifactId>
<nam:version>1.0</nam:version>
<nam:name>BankDB_Pool</nam:name>
</nam:pattern>
</nam:resource-ref>
</web-app>
|
|
|
...
WebAppEjbAccess.war
includes a Servlet and the web.xml
. In the annotations example we provided a servlet as well but for this sample all the processing is done directly by the JSP. The following sample illustrates the web.xml
, in this example the Plan Creator wizard will look into the <ejb-ref>
section.
Code Block |
---|
| xml | borderStyle | solid |
---|
title | web.xml |
---|
borderStyle | solid |
---|
| xml |
---|
|
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<ejb-ref>
<ejb-ref-name>ejb/Converter</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<remote>myPackage.Converter</remote>
</ejb-ref>
</web-app>
|
...
Section |
---|
Column |
---|
| Code Block |
---|
| xml | borderStyle | solid |
---|
title | Generated deployment plan without Annotations |
---|
borderStyle | solid |
---|
| xml |
---|
|
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-2.0.1">
<dep:environment xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2">
<dep:moduleId>
<dep:groupId>default</dep:groupId>
<dep:artifactId>WebAppEjbAccess</dep:artifactId>
<dep:version>1.0</dep:version>
<dep:type>war</dep:type>
</dep:moduleId>
<dep:dependencies>
<dep:dependency>
<dep:groupId>default</dep:groupId>
<dep:artifactId>CurrencyConverterEJB</dep:artifactId>
<dep:version>1199912901187</dep:version>
<dep:type>jar</dep:type>
</dep:dependency>
</dep:dependencies>
</dep:environment>
<context-root>WebAppEjbAccess</context-root>
<nam:ejb-ref xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.2">
<nam:ref-name>ejb/Converter</nam:ref-name>
<nam:pattern>
<nam:groupId>default</nam:groupId>
<nam:artifactId>CurrencyConverterEJB</nam:artifactId>
<nam:version>1199912901187</nam:version>
<nam:name>ConverterBean</nam:name>
</nam:pattern>
</nam:ejb-ref>
</web-app>
|
|
Column |
---|
| Code Block |
---|
| xml | borderStyle | solid |
---|
title | Generated deployment plan with Annotations |
---|
borderStyle | solid |
---|
| xml |
---|
|
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-2.0.1">
<dep:environment xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2">
<dep:moduleId>
<dep:groupId>default</dep:groupId>
<dep:artifactId>WebAppEjbAccessAnnotations</dep:artifactId>
<dep:version>1.0</dep:version>
<dep:type>war</dep:type>
</dep:moduleId>
<dep:dependencies>
<dep:dependency>
<dep:groupId>default</dep:groupId>
<dep:artifactId>CurrencyConverterEJB</dep:artifactId>
<dep:version>1199912901187</dep:version>
<dep:type>jar</dep:type>
</dep:dependency>
</dep:dependencies>
</dep:environment>
<context-root>WebAppEjbAccessAnnotations</context-root>
<nam:ejb-ref xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.2">
<nam:ref-name>ejb/Converter</nam:ref-name>
<nam:pattern>
<nam:groupId>default</nam:groupId>
<nam:artifactId>CurrencyConverterEJB</nam:artifactId>
<nam:version>1199912901187</nam:version>
<nam:name>ConverterBean</nam:name>
</nam:pattern>
</nam:ejb-ref>
</web-app>
|
|
|
...
WebAppJMSAccess.war
includes the two Servlets mentioned above, a JSP and the web.xml
. The following sample illustrates the web.xml
, in this example the Plan Creator wizard will look into the <resource-ref>
,<message-destination-ref>
and <message-destination>
sections.
Code Block |
---|
| xml | borderStyle | solid |
---|
title | web.xml |
---|
borderStyle | solid |
---|
| xml |
---|
|
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>
WebAppJMSAccess</display-name>
<servlet>
<description>
</description>
<display-name>
ProducerServlet</display-name>
<servlet-name>ProducerServlet</servlet-name>
<servlet-class>
com.apache.geronimo.samples.webAppJMSacess.ProducerServlet</servlet-class>
</servlet>
<servlet>
<description>
</description>
<display-name>
ConsumerServlet</display-name>
<servlet-name>ConsumerServlet</servlet-name>
<servlet-class>
com.apache.geronimo.samples.webAppJMSacess.ConsumerServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ProducerServlet</servlet-name>
<url-pattern>/producer</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>ConsumerServlet</servlet-name>
<url-pattern>/consumer</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<resource-ref>
<res-ref-name>jms/TestConnectionFactory</res-ref-name>
<res-type>javax.jms.ConnectionFactory</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
<message-destination-ref>
<message-destination-ref-name>jms/TestQueue</message-destination-ref-name>
<message-destination-type>javax.jms.Queue</message-destination-type>
<message-destination-usage>ConsumesProduces</message-destination-usage>
<message-destination-link>TestQueue</message-destination-link>
</message-destination-ref>
<message-destination>
<message-destination-name>TestQueue</message-destination-name>
</message-destination>
</web-app>
|
...
Section |
---|
Column |
---|
| Code Block |
---|
| xml |
---|
borderStyle | solid |
---|
title | Generated deployment plan without Annotations |
---|
borderStyle | solid |
---|
| xml |
---|
|
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-2.0.1">
<dep:environment xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2">
<dep:moduleId>
<dep:groupId>default</dep:groupId>
<dep:artifactId>WebAppJMSAccess</dep:artifactId>
<dep:version>1.0</dep:version>
<dep:type>war</dep:type>
</dep:moduleId>
<dep:dependencies>
<dep:dependency>
<dep:groupId>org.apache.geronimo.configs</dep:groupId>
<dep:artifactId>activemq-ra</dep:artifactId>
<dep:version>2.1-SNAPSHOT</dep:version>
<dep:type>car</dep:type>
</dep:dependency>
</dep:dependencies>
</dep:environment>
<context-root>WebAppJMSAccess</context-root>
<nam:resource-ref xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.2">
<nam:ref-name>jms/TestConnectionFactory</nam:ref-name>
<nam:pattern>
<nam:groupId>org.apache.geronimo.configs</nam:groupId>
<nam:artifactId>activemq-ra</nam:artifactId>
<nam:version>2.1-SNAPSHOT</nam:version>
<nam:name>DefaultActiveMQConnectionFactory</nam:name>
</nam:pattern>
</nam:resource-ref>
<nam:message-destination xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.2">
<nam:message-destination-name>TestQueue</nam:message-destination-name>
<nam:admin-object-link>MDBTransferBeanOutQueue</nam:admin-object-link>
</nam:message-destination>
</web-app>
|
|
Column |
---|
| Code Block |
---|
| xml |
---|
borderStyle | solid |
---|
title | Generated deployment plan with Annotations |
---|
borderStyle | solid |
---|
| xml |
---|
|
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-2.0.1">
<dep:environment xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2">
<dep:moduleId>
<dep:groupId>default</dep:groupId>
<dep:artifactId>WebAppJMSAccessAnnotations</dep:artifactId>
<dep:version>1.0</dep:version>
<dep:type>war</dep:type>
</dep:moduleId>
<dep:dependencies>
<dep:dependency>
<dep:groupId>org.apache.geronimo.configs</dep:groupId>
<dep:artifactId>activemq-ra</dep:artifactId>
<dep:version>2.1-SNAPSHOT</dep:version>
<dep:type>car</dep:type>
</dep:dependency>
</dep:dependencies>
</dep:environment>
<context-root>WebAppJMSAccessAnnotations</context-root>
<nam:resource-ref xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.2">
<nam:ref-name>jms/TestConnectionFactory</nam:ref-name>
<nam:pattern>
<nam:groupId>org.apache.geronimo.configs</nam:groupId>
<nam:artifactId>activemq-ra</nam:artifactId>
<nam:version>2.1-SNAPSHOT</nam:version>
<nam:name>DefaultActiveMQConnectionFactory</nam:name>
</nam:pattern>
</nam:resource-ref>
<nam:resource-env-ref xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.2">
<nam:ref-name>jms/TestQueue</nam:ref-name>
<nam:pattern>
<nam:groupId>org.apache.geronimo.configs</nam:groupId>
<nam:artifactId>activemq-ra</nam:artifactId>
<nam:version>2.1-SNAPSHOT</nam:version>
<nam:name>MDBTransferBeanOutQueue</nam:name>
</nam:pattern>
</nam:resource-env-ref>
</web-app>
|
|
|
...
Now that we have configured the environment we go back to the application. timereport.war
provides 2 Servlets, several JSPs and the web.xml
we will be focusing on. In addition this WAR contains the sources and full java docs. The following sample illustrates the web.xml
, here are defined all the security constraints, realms and roles the Plan Creator wizard will use to generate the Geronimo specific deployment plan.
Code Block |
---|
| xml |
---|
borderStyle | solid |
---|
title | web.xml |
---|
borderStyle | solid |
---|
| xml |
---|
|
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<security-constraint>
<web-resource-collection>
<web-resource-name>employee</web-resource-name>
<url-pattern>/employee/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>employee</role-name>
</auth-constraint>
</security-constraint>
<security-constraint>
<web-resource-collection>
<web-resource-name>manager</web-resource-name>
<url-pattern>/manager/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>manager</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>FORM</auth-method>
<realm-name>TimeReportRealm</realm-name>
<form-login-config>
<form-login-page>/login/login.jsp</form-login-page>
<form-error-page>/login/login_error.jsp</form-error-page>
</form-login-config>
</login-config>
<security-role>
<role-name>employee</role-name>
</security-role>
<security-role>
<role-name>manager</role-name>
</security-role>
<servlet>
<display-name>AddTimeRecordServlet</display-name>
<servlet-name>AddTimeRecordServlet</servlet-name>
<servlet-class>org.apache.geronimo.samples.timereport.web.AddTimeRecordServlet</servlet-class>
</servlet>
<servlet>
<display-name>AddEmployeeServlet</display-name>
<servlet-name>AddEmployeeServlet</servlet-name>
<servlet-class>org.apache.geronimo.samples.timereport.web.AddEmployeeServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>AddTimeRecordServlet</servlet-name>
<url-pattern>/employee/add_timerecord</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>AddEmployeeServlet</servlet-name>
<url-pattern>/manager/add_employee</url-pattern>
</servlet-mapping>
</web-app>
|
- Back in the Geronimo Administration Console click on Plan Creator. Browse to the
timereport.war
you just extracted and click on Configure.
- In the resulting screen you will be configuring the web application identity. You may want to change the default proposed values however, for this example, we will be accepting the defaults. Click Next.
- As a difference from the other sample applications, for this example we do not have to resolve any resource references so the wizard will jump directly to the security part of the configuration. In the resulting screen define the security configuration.
- Select TimeReportRealm from the Security Realm Name: pull down menu. This is the security realm you deployed earlier.
- For security role employee select Add -> Principal from the pull down menu and add 2 Group Prinicipals with name EmployeeGroup and ManagerGroup.
- For security role manager, select Add -> Principal and add 1 Group Prinicipal with name ManagerGroup.
- Click Next, the following screen allows you to select WAR dependencies. This application has not dependencies on any these modules, click Next.
- In the Created Plan screen you should see a plan similar to this one.
Code Block |
---|
| xml |
---|
borderStyle | solid |
---|
title | Generated deployment plan without Annotations |
---|
borderStyle | solid |
---|
| xml |
---|
|
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-2.0.1">
<dep:environment xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2">
<dep:moduleId>
<dep:groupId>default</dep:groupId>
<dep:artifactId>timereport</dep:artifactId>
<dep:version>1.0</dep:version>
<dep:type>war</dep:type>
</dep:moduleId>
</dep:environment>
<context-root>timereport</context-root>
<security-realm-name>TimeReportRealm</security-realm-name>
<app:security xsi:type="sec:securityType" xmlns:sec="http://geronimo.apache.org/xml/ns/security-2.0"
xmlns:app="http://geronimo.apache.org/xml/ns/j2ee/application-2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<sec:role-mappings>
<sec:role role-name="employee">
<sec:principal name="EmployeeGroup" class="org.apache.geronimo.security.realm.providers.GeronimoGroupPrincipal"/>
<sec:principal name="ManagerGroup" class="org.apache.geronimo.security.realm.providers.GeronimoGroupPrincipal"/>
</sec:role>
<sec:role role-name="manager">
<sec:principal name="ManagerGroup" class="org.apache.geronimo.security.realm.providers.GeronimoGroupPrincipal"/>
</sec:role>
</sec:role-mappings>
</app:security>
</web-app>
|
- Click on Deploy WAR and then click on Launch Web App to run the sample application. Verify userid and password values from
1_TimeReportDB.sql
.
...