咸鱼入门到放弃3--tomcat

Tomcat学习与使用

一. Tomcat安装及配置

二.项目部署(虚拟目录映射)

Web应用开发好后,若想供外界访问,需要把web应用所在目录交给web服务器管理,这个过程称之为虚似目录的映射

  

虚拟目录的映射方式一:在server.xml文件的host元素中配置(高版本Tomcat不建议用)

找到server.xml文件的host元素,如下图所示:

  aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAjAAAAEDCAIAAACklammAAAgAElEQVR4nO2dzbWsKhCFTYuEiMMMHBqFU+dG4cAQOgjOQIECqhT86ab77G+99VZfjkIJyAbUqsYAAAAAFdB82gAAAADAGAgSAACASoAgAQAAqAIIEgAAgCqAIAEAAKgCCBIAAIAqyBCkWbdt07Z6NuPQNm3bDPPzdj1NZ0xjzGhMY4y2idqY5m6NTvPUz0wD2Ct6C1sHsf8N45OFXblMZYx6xCiGzzUHAN+LPDQuRjWmW4wxZh7U9DLGGPPq+hPjzbmzHmW0l94Y04V/emLMUrv/LGXhxridK3qeWffTsv0cHp2xXLzMtwnSR5sDgC+FF6RRm8aqkZEE6dX126zY/jVI1H2vZ1Myf+6UaZRRjWka0yiz0PTGNI1R6509bv9sGqNHo8jB7kh6OstixyZlTGSRSo5s7H80T5eobXpnU9JRLxUkneTJFkQT1Xb1PoXOvneuKAPamGvKpNpWTa711nZjE00kSDaHNE9jjFmmfusLQ6826fJHNi4fgfQyaY256jKkOWh9KpLuailtOBW20SgnGq6NWDsBAEckgrQY1ZgmnIDPQ6oo49ASlWr1vB1pE2fd2sSCFZJujB6NMWbU2w9jzGh/dGoTyaXbTFwXcaM23WKWziqWcb+XzovX9t/h/kkkHtFg544ZSeJ6AB3g9lddygrJSBSFLUiTzF0iu0K6yDg7bei7rQmHpvUNu0kFmxjMOnxTM3kS6RqHbfd3mXqnWPZ3QcONYW2v/1w4bTChZuw3XMM1DZvIthEAoJzgBooWRg5mhUSmxMaY12TnumRk8hs3BYLkVjajVxe/7mm8IK1ypfRmd7cEh+UskiSoeESDXWfMKOsB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9j93+mJUE5QCAADgn5AIkiwJow4kah5SRRmHlqhUq+ftSJs469Ym7qyreDkEAADw0wSCtKcEi1GhSjErpFn3kz/5NantwRJZD/lHTfsbfVgqAQDAP4NfIaVCES2PTJEg+aSu7zv/WxYkjRUSAAD8M7hnSKNpGqM6krIYpeKjuGdI49D706b1cZEZB7pNRwVp+z0OZOW0dKZpjC5/SQIAAMBXI75l1ym/fTfqWCFek4pe+17XRjbdpxh7QLxlR55CbUeu23SJ8gEAAPgPZHyHxC2PAAAAgHuBpwYAAABVAEECAABQBRAkAAAAVfAHh+aiBoyRG64AAAAASUVORK5CYII=" alt="" />

  在<Host></Host>这对标签加上<Context path="/JavaWebApp" docBase="F:\JavaWebDemoProject" />即可将在F盘下的JavaWebDemoProject这个JavaWeb应用映射到JavaWebApp这个虚拟目录上,JavaWebApp这个虚拟目录是由Tomcat服务器管理的,JavaWebApp是一个硬盘上不存在的目录,是我们自己随便写的一个目录,也就是虚拟的一个目录,所以称之为"虚拟目录",

 <Context path="/JavaWebApp" docBase="F:\JavaWebDemoProject" />

其中,Context表示上下文,代表的就是一个JavaWeb应用,Context元素有两个属性,

  Ⅰ.path:用来配置虚似目录,必须以"/"开头。

  Ⅱ.docBase:配置此虚似目录对应着硬盘上的Web应用所在目录。

虚拟目录的映射方式二:让tomcat服务器自动映射

即将项目文件放到webapps下

虚拟目录的映射方式三:定义xml

在tomcat服务器的\conf\Catalina\localhost目录下新建一个xml文件,其名称就是context元素的path属性,

在xml文件中添加Context元素映射JavaWeb应用,代码如下:

1 <Context docBase="F:\JavaWebDemoProject" />

三.打包javaweb应用

在Java中,使用"jar"命令来对将JavaWeb应用打包成一个War包,jar命令的用法如下:

咸鱼入门到放弃3--tomcat

咸鱼入门到放弃3--tomcat

执行完之后,就可以得到一个aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAALYAAAAYCAIAAADYhJDNAAAGUklEQVRoge2a308TWRTHzx+0bbDDy/wXQMpu+OHjvItERJOB7pqwDxtvq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oza8SysjISH53l05JsVgoFW1TQkhlZGSElVjckkBA983H+wGR/q5cXSXzq7gJxM5JMj+JvEaEm0bmJ5FXQPdX1U5B7Jwk8+bmaht4A6rRyL68AXV+Ve0UoOkW9UMfHXGrYI06pk/WM7u3H9PRyFxUZe9eS0vvhGvJqeIeyipytU3snMRNtjvkXjWviB2QldTqBy25QijhcHhvZ2dvdze/t2tMScE+JZVKOBxmJZThXhFacXKFJOPIA+DpVc29dGWFJFfIlVbw9KrDvSLzipOWXMFNIF2JI4+Ahk1h06B6VhDPxklyhSQHJTBfMahnBWgarH50xBk5vw5uArMRd+9UUWOMw1quamnp8bmWOMGqQ1nVcJOAhvX9oHmH/KvmFrEBspLKfNDmMoQyNDS0u71tm5I8nZKi/i+ToaEhVmKidvjA06POZcjcgAQ+FM6QuQwJ94gAUlDPiSOPT2r0iR1xclBahgRbobFVMqrpma1So5k8l8GNAI0DNFkXqh0+gFY85yyodvis5LkBCcA0wK+DG20J1XvcCGDzZhhTO+jR7Ndida+ljSMP0O5cSzSIO3pUW9k48pgmwz2ixyfql6DvD/yJOLxxAFlJLb/XZpYJpb+/f2d72zYle3sF+5T09/ezkpllgloAAKAFmxH1jM/4RPO0SB6QEBs/PI3MDEgA0DBAW+AGW30yE0Me80PTTFPP+KChhX5Q25vS5UP3WPOcOrgBxDOxQ/fAa0QTCHtG5iA1tDHkse0dltigkXavRzSOE0MeaiyGPFTFxvlXXe3NCchKavmdllgilGAwuLO1tbO9ZU7Jjn1KCuVSMRgMshKXz8AE+g6kyyduowqQldTSO+3xS0Lp6+vb3tykU7LLm5K+vj5W4nJ8fpNF8KHfTtpGNSArqZcb2uQioVw82mIlLseiX//LKP1y4k54gKykFje0+CJxceECP/++8DRXnl4i8RcuLhzgr5mVP6ZfPVsjL9Y1F5dqIF8shx9nLt1dOPGv0bp8ncBJfwXfXV/7+g/HQkUyjGv6FQAAAABJRU5ErkJggg==" alt="" />文件,平时开发完JavaWeb应用后,一般都会将JavaWeb应用打包成一个war包,然后将这个war包放到Tomcat服务器的webapps目录下,当Tomcat服务器启动时,就会自动将webapps目录下的war包解压。

比如现在将aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAALYAAAAYCAIAAADYhJDNAAAGUklEQVRoge2a308TWRTHzx+0bbDDy/wXQMpu+OHjvItERJOB7pqwDxtvqlGzMSHgNOquSxfZG2ItGFqw/LChKdk1jitCoVYR/MHP/rxD9mFm7tyZ3gIRDcadm8/DnTPne873Xg4lIQXiLncduKBUrjxIZi+H/5GVlItLNfBnIjM8k11eL27sai4u1cCluwuvP5LMe7K4YRA7cK19LNJMl/8DICup9R3txTqhxGIxUqkQUtE0omlkf1/b39cIqezva0+ePBkbG1ta22LzXb5tjBF5/pZQJiYmKpVy9ZTs72uJRCKfz4+Njf/7apOVuHzDgKyk1re152uE8ujRo3K5xJ2SaDQaiUQikUg0GmUlXw3qxXr44c6J2/gkZtEpEC/OnrSNKkBWUm+3tWdrhDI+Pl4uFcvlUqVcJpWyY0pe53KZ5eVoNMpKLO5IUI8ecl8dmZunAU5j+vjwJ5Gt6Xi0o16oh+/v8OPMkm4ez2FtbI14Tmozi06BeGH2Cxn7dEBWUm+2tKdvCCUajZaKBe6U0EGJRCKsxOK2BPXoAffV0bEVUbvrAUDsnjbe/toOdT+qNbRqdz003z4sflsC4KYdH7W73rQ6jeoY21+m1xc6hQ2QldTrTe3vHKFEIpFiIV8qFkqlYrnETAmxjQgrsQhJIKBR7qujk0B1IJ5P6I+4GaTmdmgO6Y/qeYG+qkY9L9DMA+MJVAfSjWP65Buw7N1oh7qA+rlbHHrYzwzISiq3qS3kCGV0dLSQzzumpGKfktHRUVZiEZJAQFjfJ1Cd+ZHrD5GFnNolQF1A1TNxQDQynWlGprEPSdCOcUCEdmzWlK4b7bDfFJpldaEV5xTMVUeq62A/iF0hw5g/RBZCkj3BpgLLktoliF0Jo8v1dj2fcWVcDk97yNEcQWRVoBdudTSSrTs85KpZb05AVlKvNrV0llAwxvm9vUJ+zz4lJX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lLseiX//LKP1y4k54gKykFje0+CJxceECP/++8DRXnl4i8RcuLhzgr5mVP6ZfPVsjL9Y1F5dqIF8shx9nLt1dOPGv0bp8ncBJfwXfXV/7+g/HQkUyjGv6FQAAAABJRU5ErkJggg==" alt="" />放到放到Tomcat服务器的webapps目录下

Tomcat服务器启动后会自动"Deploying web application",将aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAALYAAAAYCAIAAADYhJDNAAAGUklEQVRoge2a308TWRTHzx+0bbDDy/wXQMpu+OHjvItERJOB7pqwDxtvqlGzMSHgNOquSxfZG2ItGFqw/LChKdk1jitCoVYR/MHP/rxD9mFm7tyZ3gIRDcadm8/DnTPne873Xg4lIQXiLncduKBUrjxIZi+H/5GVlItLNfBnIjM8k11eL27sai4u1cCluwuvP5LMe7K4YRA7cK19LNJMl/8DICup9R3txTqhxGIxUqkQUtE0omlkf1/b39cIqezva0+ePBkbG1ta22LzXb5tjBF5/pZQJiYmKpVy9ZTs72uJRCKfz4+Njf/7apOVuHzDgKyk1re152uE8ujRo3K5xJ2SaDQaiUQikUg0GmUlXw3qxXr44c6J2/gkZtEpEC/OnrSNKkBWUm+3tWdrhDI+Pl4uFcvlUqVcJpWyY0pe53KZ5eVoNMpKLO5IUI8ecl8dmZunAU5j+vjwJ5Gt6Xi0o16oh+/v8OPMkm4ez2FtbI14Tmozi06BeGH2Cxn7dEBWUm+2tKdvCCUajZaKBe6U0EGJRCKsxOK2BPXoAffV0bEVUbvrAUDsnjbe/toOdT+qNbRqdz003z4sflsC4KYdH7W73rQ6jeoY21+m1xc6hQ2QldTrTe3vHKFEIpFiIV8qFkqlYrnETAmxjQgrsQhJIKBR7qujk0B1IJ5P6I+4GaTmdmgO6Y/qeYG+qkY9L9DMA+MJVAfSjWP65Buw7N1oh7qA+rlbHHrYzwzISiq3qS3kCGV0dLSQzzumpGKfktHRUVZiEZJAQFjfJ1Cd+ZHrD5GFnNolQF1A1TNxQDQynWlGprEPSdCOcUCEdmzWlK4b7b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llgilGAwuLO1tbO9ZU7Jjn1KCuVSMRgMshKXz8AE+g6kyyduowqQldTSO+3xS0Lp6+vb3tykU7LLm5K+vj5W4nJ8fpNF8KHfTtpGNSArqZcb2uQioVw82mIlLseiX//LKP1y4k54gKykFje0+CJxceECP/++8DRXnl4i8RcuLhzgr5mVP6ZfPVsjL9Y1F5dqIF8shx9nLt1dOPGv0bp8ncBJfwXfXV/7+g/HQkUyjGv6FQAAAABJRU5ErkJggg==" alt="" />这个war文件解压缩,如下图所示:

  aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAp8AAAAyCAIAAACVlydGAAAQ4klEQVR4nO2da1BV1xXHz9cmbTRRUJ7yBhHxETXGPJqZfug0bSZpGhs10zSJozFpJ01io07b6TTNlyZaNVFEQOThEwUBQY0P9KpJVKIib0FERVBA1Mgb7Id+QMjxnL3XXnuffbmg6zf3w7l7r73Wf62971nc6xWMpXEHl8Qd+Oua/Yu/3PfRqr2uM7XPvfiG0Y/L5WJe80YIgiAIglCmu7s7Pj6+o6Ojvb39zp3WW7dut7TcbGq6UVVdU15+vri47MyZ4hMnvne5vikqKo5bF9fc3BwSGZO+dWfE5Fnhk54Oi50ZOnFGSMx04x9JR/+eePRvCUeWxR9eEldw7NyVF15609PZEQ8+9KMhQRCEHYXuHhQenbYlI3TiUyExM0ImTA+OfjJo/FTjs/RTn6Wf+jTt5L9Svvvnxm+/K234xStvG4bhwmGRJWVMDHeQh4R3VDygmCAIYmhj7u7t7R3t7R1tbW137rRev95UX3+trq7+0qW60tIKc3cfFxqZsmlb0Pip46KmBEZODoiY5B8eayzfWbI8s+SLHcWfZ5z7z/aiwvNNv5y90B4PeS8GzOhu/jCA32U6DwRBEHbM3b2zs+uZWbPmv/POsqVL+x5frl6dk5194UKtubsHBIUnp23xD5voFxrjGzrBNyTaJ3i8Ebe3Jm5vzdo9NWvyL6zJry66eOs38963x6PuTmDAnxP6jIcgCMKOpbsvXLAgLTU1t5+CgoLCwkJLd/cNDElK2TQ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0dk/t2j21a/bUrsm/WFR7+6U3/qxLpTu+OU/fqCQIgiAeVLR19y93X1idW70qp3pVTtXK7KozF279eu6fNAo1N2ON/7XMoQeHGgiCIAjCHWjr7qtyqv676/yKrMoVWZXLMytPV998cc77GoVq7+4OGQoaCIIgCIKJtu6+Mvv8iqzKFZmVyzMrvthZcbq65Vdz3jNEvzkSnjILZXZ3syXSD0aSlDGmzTOXY/zb1xIEQRCEEH3v3bMt791bXpzzPrMlG/e3Z8PWre32hq2hWsYNfkfkdUehNoweXJFRazF5EQRBEAQGd/y7e/XAv7u7bPRFNbcuQ6a72xNgNnW17g7ohJcL4eVrDw3nRRAEQRAYtHX3tXt//ML8wHfmhZ1VV3cHBvHdHelcOAUYO8+XIAiCIIRo6+4JB6/2P+oSDtSVXL7z8h8+4HWvodzdMdc8zeYp5qCCf4IgCIKQRVt3TznamHqsKfVoY8rRxpSjjeVX219960MD/NYY8ylgD/RReyMUxtUYAjM+MMKLa7dhOicIgiAIIdq6+5aTt7b++LhZea3ztfkfezo7K0B3JwiCIIgHBm3dfefZtkzTo7qx+/UFQ/FvxNHbYoIgCOKBR1t3zyntyi3tyul/1NzonfPuEk9nRxAEQRAPI9q6e15Fb35Fb35Fb15FT15Fz8WWu/MWLfN0dgRBEATxMKKru/8fhRW8s1476ZYAAAAASUVORK5CYII=" alt="" />

四、Tomcat的体系结构

咸鱼入门到放弃3--tomcat

Tomcat服务器的启动是基于一个server.xml文件的

<?xml version='1.0' encoding='utf-8'?>
<Server port="8005" shutdown="SHUTDOWN">          //启动server                                  
<Service name="Catalina">                  //启动service
<Connector port="8080" protocol="HTTP/1.1"       //多个Connector等待连接 
connectionTimeout="20000"
redirectPort="8443" />
<Connector port="8443" protocol="org.apache.coyote.http11.Http11Protocol"
maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS"
keystoreFile="conf/.keystore" keystorePass="123456"/>
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
<Engine name="Catalina" defaultHost="localhost">    //将用户请求交给引擎处理 <Host name="localhost" appBase="webapps"       //引擎解析出想访问的host后交其处理
unpackWARs="true" autoDeploy="true">
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="localhost_access_log." suffix=".txt"
pattern="%h %l %u %t "%r" %s %b" />
</Host>
<Host name="www.gacl.cn" appBase="F:\JavaWebApps">  //host解析出用户想访问的web应用,一个应用对应一个context
<Context path="" docBase="F:\JavaWebApps\JavaWebDemo1"/>
</Host> </Engine>
</Service>
</Server>

五.互联网上的加密原理

Tomcat的connector分为加密连接器http连接与非加密连接器https连接。默认8080端口为非加密连接器

拓展:对称加密与非对称加密,对称加密即加密解密使用相同的加密算法,非对称加密即加密解密密钥不同

非对称加密工作原理

  1.A要向B发送信息,A和B都要产生一对用于加密和解密的公钥和私钥。
  2.A的私钥保密,A的公钥告诉B;B的私钥保密,B的公钥告诉A。
  3.A要给B发送信息时,A用B的公钥加密信息,因为A知道B的公钥。
  4.A将这个消息发给B(已经用B的公钥加密消息)。
  5.B收到这个消息后,B用自己的私钥解密A的消息。其他所有收到这个报文的人都无法解密,因为只有B才有B的私钥
 
非对称性加密存在一个问题:A想向B发数据,A如何确定拿到的公钥一定是B发的呢?存在公钥被截获的问题。那么如何解决这个问题呢?只能靠一个第三方机构(CA机构,即证书授权中心(Certificate Authority ),或称证书授权机构)来担保。A想向B发数据,B首先将公钥发给CA机构,CA机构拿到B的公钥后跑到B的家里问:这是你发的公钥吗?B确认过后说是:没错,是我发的!那么此时CA机构就会为B的公钥做担保,生成一份数字证书给B,数字证书包含了CA的担保认证签名和B的公钥,B拿到CA的这份数字证书后,就发给A,A拿到数字证书后,看到上面有CA的签名,就可以确定当前拿到的公钥是B发的,那么就可以放心大胆地使用公钥加密数据,然后发给B了。
 
 
上一篇:纯js制作遮罩层对话框 -- g皓皓


下一篇:jQuery学习笔记之插件开发(4)