Index

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

components, 45

connector element, 6

containers, 45

context element, 6

engine element, 6

host element, 6

server element, 5

service element, 5

authentication types, 122124

installation and configuration

Linux installation, 1213

manual installation, 812

requirements, 67

Windows service installer, 78

realm implementations, 2, 119

supported API and JDK versions, 2

testing, 1316

Tomcat Manager web application, 2

valves, 2

versions, 12

BASIC authentication type, 123124

Catalina script

command line argument options, 19

passing runtime options to, 1920

Changing context path of Java, 189

CLIENT_CERT authentication type, 122

CombinedRealm implementation, 118, 125

Configuring security realms

JDBC realms

accessing an authenticated user, 137138

benefits, 135136

configuring form-based authentication, 130134

configuring Tomcat, 130131

creating users database, 126129

datasourcerealm, 134135

JNDIrealm, 136137

MemoryRealm, 118119

authentication types, 122124

protecting resource using, 119122

protection against brute force attacks, 124125

UserDatabaseRealm, 125126

Realm interface, 117

security constraint, 117

Controller, 199

annotation, 206

DataSourceRealm implementation, 118

Deploying web applications

configuring hosts, 3233

configuring web application contexts, 3335

context.xml configuration file, 36

deploying to root context, 3536

Eclipse IDEs, 37

adding tomcat runtime environment, 4143

creating dynamic web project, 3941

from Eclipse to Tomcat server, 4345

updating, 3739

Java web applications, 2021

deployement descriptor, 2223

directory structure, 2122

manual deployement, 23

adding JSPs, 2527

adding servlets, 2730

adding static content, 2425

copying files to remote servers, 32

creating directory structure, 24

WAR file, 3032

Tomcat directory structure, 1718

Catalina script, 1920

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

JAR files, 173174

Jasper engine, 174

standalone distribution, 174

sample application implementation

Apache Portable Library (APR), 177

examples, 176

startTomcat() and stopTomcat(), 176177

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

Installing Apache Ant, 8889

configuring Tomcat's Ant tasks, 8991

running Ant scripts, 9192

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

using mod_jk, 190192

using mod_proxy, 185190

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:forward>, 6869

<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), 6465

JULI library

API methods, 210

configuring internal Tomcat logging, 215217

configuring Web application logging, 217218

formatters, 211212

handlers, 211

loggers, 210

logging configuration, 212214

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

console logging, 216217

default log handlers, 215, 216

loggers, 216

configuring Web application logging, 217218

JULI library. See JULI library

Log4j library, 219

API log calls, 219

configuration file, 220

internal logging, 222223

logger inheritance, 220

logging levels, 219

PatternLayout, 221222

Web application logging, 223224

Slf4j library, 224226

MemoryRealm

authentication types, 122

configuration, 119

implementation, 118

protecting resource using, 119124

protection against brute force attacks, 124125

UserDatabaseRealm, 125126

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

HTTP protocol, 93, 94

request, 93

session management, 94

servlet implementation

HttpSession Object, 95

invalidating a session, 107

JSESSIONID, 96

shopping basket session, 97105

session management

classes, 106

configuring persistentmanager, 110112

configuring standardmanager, 108109

default standardmanager, 107108

filestore, 112113

JDBCstore, 113116

persistentmanager, 110

server shutdown, 109110

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

definition, 260261

destroy() method, 49

filters, 262

configuring using annotations, 264265

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

SHOPPING_BASKET, 100, 103

Spring framework. See Spring MVC framework

Spring MVC framework, 197

beans, 198

dependency injection container, 198

Front Controller pattern, 200201

architecture, 200

main principle, 200

Java application implementation, 198

MVC pattern, 198

benefits, 199200

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, 205207

configuring DispatcherServlet, 203

implementing controller component, 204205

views and controllers, 204205

Tomcat connectors, 253

AJP connector, 253, 256257

common configuration attributes, 254255

HTTP connector, 253, 255256

Tomcat containers, 245

context container, 250253

additional attributes for configuration, 252

main attributes, 251

engine container, 247248

host container, 248250

additional attributes for configuration, 250

main attributes, 249

server container, 245246

service container, 246247

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

BASIC authentication, 74, 75

deployment, See Deployment, Tomcat's Manager web application

homepage, 76

list command, 7677

reload command, 8182

server status, 7778

sessions, 8284

start command, 8687

stop command, 8486

Text-based interface, See Text-based interface,Tomcat's Manager web application

undeploy command, 8788

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, 3032, 80

Web application logging. See Logging in Tomcat, Log4j library, Logging in Tomcat, Slf4j library

Web.xml file, 120, 259

adding a welcome file list, 265266

confguring ServletContext parameters, 265

error handler configuration, 266

mime mapping configuration, 266

minimal configuration, 259

servlet definition, 260

configuring using annotations, 261262

servlet mapping, 261

servlet filter, 262

configuring using annotations, 264265

filter mapping, 263264

session configuration, 265

web application security, 266

adding a login configuration, 268269

adding a security constraint, 266268

XML schemas

beans schema, 206

mvc schema, 206

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset