Access logging, 209
AddToBasketServlet class, 99
AJP. See Apache JServ Protocol (AJP)
Apache commons-logging library, 224
Apache JServ Protocol (AJP), 190
connector configuration, 191
Apache Tomcat 7
architecture
Catalina servlet engine, 4
connector element, 6
context element, 6
engine element, 6
host element, 6
server element, 5
service element, 5
installation and configuration
Windows service installer, 7–8
supported API and JDK versions, 2
Tomcat Manager web application, 2
valves, 2
BASIC authentication type, 123–124
Catalina script
command line argument options, 19
passing runtime options to, 19–20
Changing context path of Java, 189
CLIENT_CERT authentication type, 122
CombinedRealm implementation, 118, 125
Configuring security realms
JDBC realms
accessing an authenticated user, 137–138
configuring form-based authentication, 130–134
creating users database, 126–129
protecting resource using, 119–122
protection against brute force attacks, 124–125
Realm interface, 117
security constraint, 117
Controller, 199
annotation, 206
DataSourceRealm implementation, 118
Deploying web applications
configuring web application contexts, 33–35
context.xml configuration file, 36
deploying to root context, 35–36
Eclipse IDEs, 37
adding tomcat runtime environment, 41–43
creating dynamic web project, 39–41
from Eclipse to Tomcat server, 43–45
manual deployement, 23
copying files to remote servers, 32
creating directory structure, 24
Tomcat directory structure, 17–18
configuration files, 20
executing Tomcat scripts, 18
Deployment, Tomcat's Manager web application
Context Path, 80
Context Path Common Error Messages, 81
HTML forms, 79
successful remote deployment, 80
WAR file, 79
Design patterns. See Spring MVC framework
DIGEST authentication type, 123
Eclipse and Apache Ant implementation, 174
Embedding Tomcat
Java components
localhost, 176
main components, 175
minimal embeddable instance, 176
requirements
Jasper engine, 174
standalone distribution, 174
sample application implementation
Apache Portable Library (APR), 177
examples, 176
startTomcat() and stopTomcat(), 176–177
Testing Servlets
automated, 180
GET HTTP method, 180
JUnit test, 181
simpleservlet implementation, 180
startTomcat(), 181
web developement, 180
FORM authentication type, 122
GetPage(…) method, 182
GetServletConfig() method, 69
Http proxy and AJP protocol, 193
HttpShoppingBasket class, 98
configuring Tomcat's Ant tasks, 89–91
Integrated Development Environments (IDEs), 37
Integrating Apache Web Server, 183
HTTP daemon, 183
integrating Tomcat, 184
approach to use, 193
robust, 185
Site under maintenance, 185
load balancing, 193
method property, 195
session replication, 194
sticky_session, 194
workers configuration, 194
Rob McCool, 183
IPSec (Internet Protocol Security), 193
JaasRealm implementation, 118
Java Development Kit (JDK), 7
Java logging framework. See Logging in Tomcat
Java Server Pages (JSPs), 25, 47, 58
components, 60
directives, 61
include directive, 62
pagedirective, 61
taglib directive, 62
implicit objects, 66
application, 67
config, 68
out, 66
page, 68
request, 67
response, 67
session, 67
lifecycle, 59
scripting, 63
declarations, 63
expression language, 64
expressions, 63
scriptlets, 65
standard actions, 68
<jsp:include>, 68
Java servlet specification 2.2, 21
Java Servlets, 47
execution, 47
javax.servlet package, 48
javax.servlet.http package, 48
methods and functions, 48
Java Virtual Machine (JVM), 3, 19
JAVA_OPTS environment variable, 19
JavaScript engine, 182
JavaServer Pages (JSP) web applications, 1
JDBC integration, 174
JDBCRealm implementation, 118
JNDIRealm implementation, 118
JSP Expression Language (EL), 64–65
JULI library
API methods, 210
configuring internal Tomcat logging, 215–217
configuring Web application logging, 217–218
handlers, 211
loggers, 210
logging configuration, 212–214
logging levels, 210
rotating logs, 214
Servlet API logging, 215
Library binaries, 190
Linux installation
CATALINA_HOME environment commands, 12
JAVA_HOME environment commands, 11
List command, 76
LockoutRealm implementation, 118, 125
Logging in Tomcat, 209
configuring internal logging
default log handlers, 215, 216
loggers, 216
configuring Web application logging, 217–218
JULI library. See JULI library
Log4j library, 219
API log calls, 219
configuration file, 220
logger inheritance, 220
logging levels, 219
Web application logging, 223–224
MemoryRealm
authentication types, 122
configuration, 119
implementation, 118
protecting resource using, 119–124
protection against brute force attacks, 124–125
Model view controller framework. See Spring MVC framework
Multi-purpose open source Java framework, 197
Myapp, 178
Persistent sessions, 93
HTTP sessions, 93
cookies, 94
request, 93
session management, 94
servlet implementation
HttpSession Object, 95
invalidating a session, 107
JSESSIONID, 96
shopping basket session, 97–105
session management
classes, 106
configuring persistentmanager, 110–112
configuring standardmanager, 108–109
default standardmanager, 107–108
persistentmanager, 110
standardManager, 107
Proxy_http_module, 186
ProxyPassReverse, 187
Realms, 2
Secured resource, 120
Server.xml file. See Tomcat containers; Tomcat connectors
ServletContext, 47
getServletConfig() method, 69
vs. Servlets, 69
Servlets
configuring using annotations, 261
destroy() method, 49
filters, 262
configuring using annotations, 264–265
filter mapping, 263
sub-elements, 263
GenericServlet and HttpServlet Classes, 51
init() method, 48
mapping, 261
service() method, 49
servlet API 3.0, 55
annotation configuration support, 55
asynchronous servlet support, 58
web fragments, 58
Servlet container, 53
vs. ServletContext, 69
ServletRequest and HttpServletRequest, 49
ServletRequest and ServletResponse, 49
ServletResponse and HttpServletResponse, 50
sub-elements
async-supported, 261
init-param, 260
load-on-startup, 261
servlet-class, 260
servlet-name, 260
Sessions column, 77
Spring framework. See Spring MVC framework
Spring MVC framework, 197
beans, 198
dependency injection container, 198
Front Controller pattern, 200–201
architecture, 200
main principle, 200
Java application implementation, 198
MVC pattern, 198
controller, 199
model, 198
view component, 199
Web application, 199
non-invasive, 198
Web application development, 201
adding view component, 204
architecture, 202
configuring application context, 205–207
configuring DispatcherServlet, 203
implementing controller component, 204–205
views and controllers, 204–205
Tomcat connectors, 253
common configuration attributes, 254–255
Tomcat containers, 245
additional attributes for configuration, 252
main attributes, 251
additional attributes for configuration, 250
main attributes, 249
Tomcat's Manager web application, 71
access, 74
security privileges, 72–73
user configuration, 74
user roles, 73
functionality, 71
Java Management Extension, 71
web interface
deployment, See Deployment, Tomcat's Manager web application
homepage, 76
Text-based interface, See Text-based interface,Tomcat's Manager web application
Universal logging API, 224
UserDatabaseRealm implementation, 118
User-interface design. See Spring MVC framework, MVC pattern
View component, 199
View resolver bean
configured correctly, 207
properties
prefix, 206
suffix, 206
viewClass, 206
Spring application context, 207
VirtualHost directive, 187
WAR (Web ARchive) file, 30–32, 80
Web application logging. See Logging in Tomcat, Log4j library, Logging in Tomcat, Slf4j library
adding a welcome file list, 265–266
confguring ServletContext parameters, 265
error handler configuration, 266
mime mapping configuration, 266
minimal configuration, 259
servlet definition, 260
configuring using annotations, 261–262
servlet mapping, 261
servlet filter, 262
configuring using annotations, 264–265
session configuration, 265
web application security, 266
adding a login configuration, 268–269
adding a security constraint, 266–268
XML schemas
beans schema, 206
mvc schema, 206