Java by API/javax.servlet.http/web.xml — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
Admin (обсуждение | вклад) м (1 версия) |
(нет различий)
|
Текущая версия на 14:35, 31 мая 2010
Содержание
- 1 web.config: login-config
- 2 web.xml: context-param
- 3 web.xml: error page with error code
- 4 web.xml: error page with exception type
- 5 web.xml: filter-name and filter-mapping
- 6 web.xml: mime-mapping
- 7 web.xml: security-constraint
- 8 web.xml: servlet-name, init-param, servlet-mapping
- 9 web.xml: session-config timeout
- 10 web.xml: welcome-file-list
web.config: login-config
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
"http://java.sun.ru/j2ee/dtds/web-app_2_2.dtd">
<web-app>
<security-constraint>
<web-resource-collection>
<web-resource-name>
SecretProtection
</web-resource-name>
<url-pattern>
/servlet/SalaryServer
</url-pattern>
<url-pattern>
/servlet/secret
</url-pattern>
<http-method>
GET
</http-method>
<http-method>
POST
</http-method>
</web-resource-collection>
<auth-constraint>
<role-name>
manager
</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>
BASIC <!-- BASIC, DIGEST, FORM, CLIENT-CERT -->
</auth-method>
<realm-name>
Default <!-- optional, only useful for BASIC -->
</realm-name>
</login-config>
<security-role>
<role-name>
manager
</role-name>
</security-role>
</web-app>
web.xml: context-param
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
"http://java.sun.ru/j2ee/dtds/web-app_2.2.dtd">
<web-app>
<context-param>
<param-name>name</param-name>
<param-value>value</param-value>
</context-param>
<context-param>
<param-name>name2</param-name>
<param-value>1099</param-value>
</context-param>
<mime-mapping>
<extension>java</extension>
<mime-type>text/plain</mime-type>
</mime-mapping>
<mime-mapping>
<extension>cpp</extension>
<mime-type>text/plain</mime-type>
</mime-mapping>
</web-app>
web.xml: error page with error code
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
"http://java.sun.ru/j2ee/dtds/web-app_2.2.dtd">
<web-app>
<error-page>
<error-code>400</error-code>
<location>/400.html</location>
</error-page>
<error-page>
<error-code>404</error-code>
<location>/404.html</location>
</error-page>
<error-page>
<exception-type>javax.servlet.ServletException</exception-type>
<location>/servlet/ErrorDisplay</location>
</error-page>
</web-app>
web.xml: error page with exception type
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
"http://java.sun.ru/j2ee/dtds/web-app_2.2.dtd">
<web-app>
<error-page>
<error-code>400</error-code>
<location>/400.html</location>
</error-page>
<error-page>
<error-code>404</error-code>
<location>/404.html</location>
</error-page>
<error-page>
<exception-type>javax.servlet.ServletException</exception-type>
<location>/servlet/ErrorDisplay</location>
</error-page>
</web-app>
web.xml: filter-name and filter-mapping
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
"http://java.sun.ru/j2ee/dtds/web-app_2_2.dtd">
<web-app>
<filter>
<filter-name>log</filter-name>
<filter-class>LogFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>log</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
web.xml: mime-mapping
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
"http://java.sun.ru/j2ee/dtds/web-app_2.2.dtd">
<web-app>
<context-param>
<param-name>name</param-name>
<param-value>value</param-value>
</context-param>
<context-param>
<param-name>name2</param-name>
<param-value>1099</param-value>
</context-param>
<mime-mapping>
<extension>java</extension>
<mime-type>text/plain</mime-type>
</mime-mapping>
<mime-mapping>
<extension>cpp</extension>
<mime-type>text/plain</mime-type>
</mime-mapping>
</web-app>
web.xml: security-constraint
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
"http://java.sun.ru/j2ee/dtds/web-app_2_2.dtd">
<web-app>
<security-constraint>
<web-resource-collection>
<web-resource-name>
SecretProtection
</web-resource-name>
<url-pattern>
/servlet/SalaryServer
</url-pattern>
<url-pattern>
/servlet/secret
</url-pattern>
<http-method>
GET
</http-method>
<http-method>
POST
</http-method>
</web-resource-collection>
<auth-constraint>
<role-name>
manager
</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>
BASIC <!-- BASIC, DIGEST, FORM, CLIENT-CERT -->
</auth-method>
<realm-name>
Default <!-- optional, only useful for BASIC -->
</realm-name>
</login-config>
<security-role>
<role-name>
manager
</role-name>
</security-role>
</web-app>
web.xml: servlet-name, init-param, servlet-mapping
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
"http://java.sun.ru/j2ee/dtds/web-app_2_2.dtd">
<web-app>
<servlet>
<servlet-name>
tea
</servlet-name>
<servlet-class>
com.go.teaservlet.TeaServlet
</servlet-class>
<init-param>
<param-name>
properties.file
</param-name>
<param-value>
<!-- Edit this to be an absolute path to your prop file -->
/tomcat/webapps/teatime/WEB-INF/TeaServlet.properties
</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>
tea
</servlet-name>
<url-pattern>
/tea/*
</url-pattern>
</servlet-mapping>
</web-app>
web.xml: session-config timeout
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
"http://java.sun.ru/j2ee/dtds/web-app_2.2.dtd">
<web-app>
<session-config>
<session-timeout>
60 <!-- minutes -->
</session-timeout>
</session-config>
</web-app>
web.xml: welcome-file-list
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
"http://java.sun.ru/j2ee/dtds/web-app_2.2.dtd">
<web-app>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.wml</welcome-file>
</welcome-file-list>
</web-app>