python爬虫
关键函数说明:
def getImglink(page):
imgsoup = BeautifulSoup(p.text, 'lxml')
imglink = imgsoup.findAll('img')
for z in range(len(imglist)):
img = requests.get(imglist[z-1])
with open(str(z)+'.jpg', 'wb') as f:
f.write(img.content)
async Servlet
servlet 3提供 async servlet的机制,
首先,支持@WebServlet的注解,
Tomcat’s Comet, WebLogic’s FutureResponseServlet and WebSphere’s Asynchronous Request Dispatcher are some of the example of implementation of asynchronous processing
tomcat io模式
三种策略:
- BIO 默认开启的模式,阻塞IO
- NIO 利用java的非阻塞IO技术
protocol = 'org.apache.coyote.http11.Http11NioProtocol'
- APR
NIO + APR模式的库,这种模式是基于JNI的,即JAVA调用本地库的方式进行IO
tomcat对静态资源的处理
defaultServlet
zero-copy的特性,sendfile之上的tomcat