
- •Web Applications
- •Web Application Environment
- •Servlet API
- •HttpServlet
- •Жизненный цикл
- •Аннотации и Resource Injection
- •ServletContext
- •Request
- •Response
- •Filters
- •Session
- •Dispatching Requests
- •Использование Request Dispatcher
- •Error Handling
- •Welcome pages
- •События в приложениях
- •Web Application Deployment
- •Security
- •Distributed Environments

Web Application Deployment
Создаются event listener (<listener>)
Вызываются contextInitialized (ServletContextListener)
Создаются фильтры и вызываются init методы
Создаются сервлеты с определенным элементам load-on-startup и вызываются init методы

Security
Declarative Security
Внешнее описание по отношению к приложению
Programmatic Security
HttpServletRequest
getRemoteUser
isUserInRole
getUserPrincipal
Authentication
HTTP Basic Authentication
HTTP Digest Authentication
HTTPS Client Authentication
Form Based Authentication
<form method=”POST” action=”j_security_check”>
<input type=”text” name=”j_username”> <input type=”password” name=”j_password”>
</form>

<security-constraint> <web-resource-collection>
<web-resource-name>Protected Pages</web-resource-name> <description>accessible by authorized users</description> <url-pattern>/protected/*</url-pattern> <http-method>GET</http-method> <http-method>POST</http-method>
</web-resource-collection> <auth-constraint>
<description>These are the roles who have access</description> <role-name>user</role-name>
</auth-constraint> <user-data-constraint>
<description>This is how the user data must be transmitted</description> <transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint> </security-constraint> <login-config>
<auth-method>FORM</auth-method> <form-login-config>
<form-login-page>/login.jsp</form-login-page> <form-error-page>/failLogin.jsp</form-error-page>
</form-login-config> </login-config> <security-role>
<description>Users</description> <role-name>user</role-name>
</security-role>

Web Container отслеживает authentication на своем уровне
Principal передаются в EJB
Сервлет может иметь элемент run-as
<servlet> <servlet-name>log4j</servlet-name> <servlet-class>SomeClass</servlet-class> <run-as>user</run-as>
</servlet>