首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往
您找到你想要的搜索结果了吗?
是的
没有找到

【Tomcat】《How Tomcat Works》英文版GPT翻译(第八章)

You have seen a simple loader implementation in the previous chapters, which was used for loading servlet classes. This chapter explains the standard web application loader, or loader for short, in Catalina. A servlet container needs a customized loader and cannot simply use the system's class loader because it should not trust the servlets it is running. If it were to load all servlets and other classes needed by the servlets using the system's class loader, as we did in the previous chapters, then a servlet would be able to access any class and library included in the CLASSPATH environment variable of the running Java Virtual Machine (JVM), This would be a breach of security. A servlet is only allowed to load classes in the WEB-INF/classes directory and its subdirectories and from the libraries deployed into the WEB-INF/lib directory. That's why a servlet container requires a loader of its own. Each web application (context) in a servlet container has its own loader. A loader employs a class loader that applies certain rules to loading classes. In Catalina, a loader is represented by the org.apache.catalina.Loader interface.

01
领券