Tomcat组成
Server代表Tomcat
Server包含一个或多个service
service由一个或多个Connector和一个Engine组成,多个Connector共享一个Engine
Connector侦听指定端口,获取请求,交给Engin处理
两个典型Connector:HTTP/JK2 分别处理来自浏览器和Apache服务器的请求
Engine由一个或多个虚拟主机Host组成
Host与某个域名匹配,每个Host下可运行多个WebApp
WebApp根目录对应Context
tomcat编码问题、
问题描述:使用tomcat7部署一个新的项目,启动项目后进入登录注册页面,使用js获取当前城市的名称;
然后将城市名称作为参数传入后台获取城市的区域信息;
ajax请求成功,但是返回的信息是获取区域信息失败。
如果server.xml的Connector配置中不设置URIEncoding,
Tomcat conf文件夹下配置文件
- catalina.policy
- catalina.properties
## List of comma-separated packages that start with or equal this string# will cause a security exception to be thrown when# passed to checkPackageAccess unless the# corresponding RuntimePermission ("accessClassInPackage."+package) has# been granted.package.access=sun.,org.apache.catalina.,org.apache.coyote.,org.apache.jasper.,org.apache.tomcat.## List of comma-separated packages that start with or equal this string# will cause a security exception to be thrown when# passed to checkPackageDefinition unless the# corresponding RuntimePermission ("defineClassInPackage."+package) has# been granted.## by default, no packages are restricted for definition, and none of# the class loaders supplied with the JDK call checkPackageDefinition.#package.definition=sun.,java.,org.apache.catalina.,org.apache.coyote.,\org.apache.jasper.,org.apache.naming.,org.apache.tomcat.### List of comma-separated paths defining the contents of the "common"# classloader. Prefixes should be used to define what is the repository type.# Path may be relative to the CATALINA_HOME or CATALINA_BASE path or absolute.# If left as blank,the JVM system loader will be used as Catalina's "common"# loader.# Examples:# "foo": Add this folder as a class repository# "foo/*.jar": Add all the JARs of the specified folder as class# repositories# "foo/bar.jar": Add bar.jar as a class repository## Note: Values are enclosed in double quotes ("...") in case either the# ${catalina.base} path or the ${catalina.home} path contains a comma.# Because double quotes are used for quoting, the double quote character# may not appear in a path.common.loader="${catalina.base}/lib","${catalina.base}/lib/*.jar","${catalina.home}/lib","${catalina.home}/lib/*.jar"## List of comma-separated paths defining the contents of the "server"# classloader. Prefixes should be used to define what is the repository type.# Path may be relative to the CATALINA_HOME or CATALINA_BASE path or absolute.# If left as blank, the "common" loader will be used as Catalina's "server"# loader.# Examples:# "foo": Add this folder as a class repository# "foo/*.jar": Add all the JARs of the specified folder as class# repositories# "foo/bar.jar": Add bar.jar as a class repository## Note: Values may be enclosed in double quotes ("...") in case either the# ${catalina.base} path or the ${catalina.home} path contains a comma.# Because double quotes are used for quoting, the double quote character# may not appear in a path.server.loader=## List of comma-separated paths defining the contents of the "shared"# classloader. Prefixes should be used to define what is the repository type.# Path may be relative to the CATALINA_BASE path or absolute. If left as blank,# the "common" loader will be used as Catalina's "shared" loader.# Examples:# "foo": Add this folder as a class repository# "foo/*.jar": Add all the JARs of the specified folder as class# repositories# "foo/bar.jar": Add bar.jar as a class repository# Please note that for single jars, e.g. bar.jar, you need the URL form# starting with file:.## Note: Values may be enclosed in double quotes ("...") in case either the# ${catalina.base} path or the ${catalina.home} path contains a comma.# Because double quotes are used for quoting, the double quote character# may not appear in a path.shared.loader=# Default list of JAR files that should not be scanned using the JarScanner# functionality. This is typically used to scan JARs for configuration# information. JARs that do not contain such information may be excluded from# the scan to speed up the scanning process. This is the default list. JARs on# this list are excluded from all scans. The list must be a comma separated list# of JAR file names.# The list of JARs to skip may be over-ridden at a Context level for individual# scan types by configuring a JarScanner with a nested JarScanFilter.# The JARs listed below include:# - Tomcat Bootstrap JARs# - Tomcat API JARs# - Catalina JARs# - Jasper JARs# - Tomcat JARs# - Common non-Tomcat JARs# - Test JARs (JUnit, Cobertura and dependencies)tomcat.util.scan.StandardJarScanFilter.jarsToSkip=\bootstrap.jar,commons-daemon.jar,tomcat-juli.jar,\annotations-api.jar,el-api.jar,jsp-api.jar,servlet-api.jar,websocket-api.jar,\catalina.jar,catalina-ant.jar,catalina-ha.jar,catalina-storeconfig.jar,\catalina-tribes.jar,\jasper.jar,jasper-el.jar,ecj-*.jar,\tomcat-api.jar,tomcat-util.jar,tomcat-util-scan.jar,tomcat-coyote.jar,\tomcat-dbcp.jar,tomcat-jni.jar,tomcat-websocket.jar,\tomcat-i18n-en.jar,tomcat-i18n-es.jar,tomcat-i18n-fr.jar,tomcat-i18n-ja.jar,\tomcat-juli-adapters.jar,catalina-jmx-remote.jar,catalina-ws.jar,\tomcat-jdbc.jar,\tools.jar,\commons-beanutils*.jar,commons-codec*.jar,commons-collections*.jar,\commons-dbcp*.jar,commons-digester*.jar,commons-fileupload*.jar,\commons-httpclient*.jar,commons-io*.jar,commons-lang*.jar,commons-logging*.jar,\commons-math*.jar,commons-pool*.jar,\jstl.jar,taglibs-standard-spec-*.jar,\geronimo-spec-jaxrpc*.jar,wsdl4j*.jar,\ant.jar,ant-junit*.jar,aspectj*.jar,jmx.jar,h2*.jar,hibernate*.jar,httpclient*.jar,\jmx-tools.jar,jta*.jar,log4j*.jar,mail*.jar,slf4j*.jar,\xercesImpl.jar,xmlParserAPIs.jar,xml-apis.jar,\junit.jar,junit-*.jar,ant-launcher.jar,\cobertura-*.jar,asm-*.jar,dom4j-*.jar,icu4j-*.jar,jaxen-*.jar,jdom-*.jar,\jetty-*.jar,oro-*.jar,servlet-api-*.jar,tagsoup-*.jar,xmlParserAPIs-*.jar,\xom-*.jar# Default list of JAR files that should be scanned that overrides the default# jarsToSkip list above. This is typically used to include a specific JAR that# has been excluded by a broad file name pattern in the jarsToSkip list.# The list of JARs to scan may be over-ridden at a Context level for individual# scan types by configuring a JarScanner with a nested JarScanFilter.tomcat.util.scan.StandardJarScanFilter.jarsToScan=\log4j-web*.jar,log4j-taglib*.jar,log4javascript*.jar,slf4j-taglib*.jar# String cache configuration.tomcat.util.buf.StringCache.byte.enabled=true#tomcat.util.buf.StringCache.char.enabled=true#tomcat.util.buf.StringCache.trainThreshold=500000#tomcat.util.buf.StringCache.cacheSize=5000
- context.xml
WEB-INF/web.xml ${catalina.base}/conf/web.xml
- logging.properties
handlers = 1catalina.org.apache.juli.AsyncFileHandler, 2localhost.org.apache.juli.AsyncFileHandler, 3manager.org.apache.juli.AsyncFileHandler, 4host-manager.org.apache.juli.AsyncFileHandler, java.util.logging.ConsoleHandler.handlers = 1catalina.org.apache.juli.AsyncFileHandler, java.util.logging.ConsoleHandler############################################################# Handler specific properties.# Describes specific configuration info for Handlers.############################################################1catalina.org.apache.juli.AsyncFileHandler.level = FINE1catalina.org.apache.juli.AsyncFileHandler.directory = ${catalina.base}/logs1catalina.org.apache.juli.AsyncFileHandler.prefix = catalina.2localhost.org.apache.juli.AsyncFileHandler.level = FINE2localhost.org.apache.juli.AsyncFileHandler.directory = ${catalina.base}/logs2localhost.org.apache.juli.AsyncFileHandler.prefix = localhost.3manager.org.apache.juli.AsyncFileHandler.level = FINE3manager.org.apache.juli.AsyncFileHandler.directory = ${catalina.base}/logs3manager.org.apache.juli.AsyncFileHandler.prefix = manager.4host-manager.org.apache.juli.AsyncFileHandler.level = FINE4host-manager.org.apache.juli.AsyncFileHandler.directory = ${catalina.base}/logs4host-manager.org.apache.juli.AsyncFileHandler.prefix = host-manager.java.util.logging.ConsoleHandler.level = FINEjava.util.logging.ConsoleHandler.formatter = org.apache.juli.OneLineFormatter############################################################# Facility specific properties.# Provides extra control for each logger.############################################################org.apache.catalina.core.ContainerBase.[Catalina].[localhost].level = INFOorg.apache.catalina.core.ContainerBase.[Catalina].[localhost].handlers = 2localhost.org.apache.juli.AsyncFileHandlerorg.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager].level = INFOorg.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager].handlers = 3manager.org.apache.juli.AsyncFileHandlerorg.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/host-manager].level = INFOorg.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/host-manager].handlers = 4host-manager.org.apache.juli.AsyncFileHandler# For example, set the org.apache.catalina.util.LifecycleBase logger to log# each component that extends LifecycleBase changing state:#org.apache.catalina.util.LifecycleBase.level = FINE# To see debug messages in TldLocationsCache, uncomment the following line:#org.apache.jasper.compiler.TldLocationsCache.level = FINE
- server.xml
- tomcat-users.xml
- tomcat-users.xsd
- web.xml
default org.apache.catalina.servlets.DefaultServlet debug 0 listings false 1 jsp org.apache.jasper.servlet.JspServlet fork false xpoweredBy false 3 default / jsp *.jsp *.jspx 30 123 application/vnd.lotus-1-2-3 3dml text/vnd.in3d.3dml index.html index.htm index.jsp
web.xml配置文件中的路径
classpath指WEB-INF/classes/
classpath 和 classpath* 区别:
- classpath:只会到你的class路径中查找找文件;
- classpath*:不仅包含class路径,还包括jar文件中(class路径)进行查找.
classpath*:context/conf/controller*.xml classpath:context/conf/controller.xml
http://blog.csdn.net/yi2672379417/article/details/51442229