Java 应用系统开发 - ServletContext 和 Web 配置# Java 应用系统开发 ServletContext 和 Web 配置 王晓东 wangxiaodong@ouc.edu.cn 中国海洋大学 November 26, 2018  ,并将 Web 应用的基本信息存储在这个 ServletContext 对象中。 ## Web 应用环境对象的用途 所有 Web 组件都可以访问此 ServletContext 对象,进而取得 Web 应用的基本信息。 ▶ ServletContext 还可以作为整个 Web 应用的共享容器对象,能够被所有会话请求共用,保存0 码力 | 33 页 | 668.91 KB | 2 年前3
Java 应用与开发 - Java EE 监听器编程掌握监听器的编程和配置,学会编写监听器代码。 ## 大纲 监听器概述 Java EE 监听器类型 ServletContext 对象监听器 ServletContext 对象属性监听器 本节习题 接下来… 监听器概述 Java EE 监听器类型 ServletContext 对象监听器 ServletContext 对象属性监听器 本节习题 ## 什么是监听器 监听器,顾名思义就是能监测其他对象 法,完成特定的功能和任务。Java EE 规范在 Servlet 2.3 中引入了监听器(Listener)规范。 Java EE 监听器能够检测 Web 应用的关键对象包括: ▶ ServletContext 上下文 ▶ HttpSession 会话 ▶ ServletRequest 请求对象 ## 监听器的应用场景 ## ▶ 网站访问人数或次数计数器 访问人数计数是所有综合门户网站 ## 会话超时后的清理工作 接下来… 监听器概述 Java EE 监听器类型 ServletContext 对象监听器 ServletContext 对象属性监听器 本节习题 ## Java EE 监听器类型 1. ServletContext 对象监听器 2. ServletContext 对象属性监听器 3. HttpSession 对象监听器 4. HttpSession0 码力 | 22 页 | 549.84 KB | 2 年前3
《Java 应用与开发》课程讲义 - 王晓东248 19.4.5 会话 ID 的保存方式 ..... 248 19.4.6 会话对象的应用示例 ..... 248 19.5 课后习题 ..... 250 20 ServletContext 和 Web 配置 ..... 251 20.1 Web 应用环境对象 ..... 252 20.1.1 Web 应用环境对象 ..... 252 20.1.2 Web 应用环境对象的生命周期 监听器编程 ..... 271 22.1 监听器概述 ..... 272 22.2 Java EE 监听器类型 ..... 272 22.3 ServletContext 对象监听器 ..... 273 22.4 ServletContext 对象属性监听器 ..... 275 22.5 课后习题 ..... 276 23 JSP(Java Server Page) ..... 277 以使外界能够获取该类的实例,达到全局可见的效果。 在任何使用到 Single 类的 Java 程序中(这里指的是一次运行中),需要确保只有一个 Single 类的实例存在(如 Web 应用 ServletContext 全局上下文对象),则使用该模式。 ### 5.4 关键字 final 在声明 Java 类、变量和方法时可以使用关键字 final 来修饰,以使其具有 “终态” 的特性: 1. final0 码力 | 330 页 | 6.54 MB | 2 年前3
Spring Boot 2.0.8.RELEASE Reference Guideembedded in an environment variable or system property). 6. ServletConfig init parameters. 7. ServletContext init parameters. 8. JNDI attributes from java:comp/env. 9. Java System properties (System.properties/) /static (or /public or /resources or /META-INF/resources) in the classpath or from the root of the ServletContext. It uses the ResourceHttpRequestHandler from Spring MVC so that you can modify that behavior from the container is also enabled and acts as a fallback, serving content from the root of the ServletContext if Spring decides not to handle it. Most of the time, this does not happen (unless you modify0 码力 | 662 页 | 634.14 KB | 2 年前3
Spring Boot 2.1.0.M4 Reference Guideembedded in an environment variable or system property). 6. ServletConfig init parameters. 7. ServletContext init parameters. 8. JNDI attributes from java:comp/env. 9. Java System properties (System.properties/) /static (or /public or /resources or /META-INF/resources) in the classpath or from the root of the ServletContext. It uses the ResourceHttpRequestHandler from Spring MVC so that you can modify that behavior from the container is also enabled and acts as a fallback, serving content from the root of the ServletContext if Spring decides not to handle it. Most of the time, this does not happen (unless you modify0 码力 | 680 页 | 643.09 KB | 2 年前3
Spring Framwork Web on Servlet Stack v5.3.36 SNAPSHOTMyWebApplicationInitialize implements WebApplicationInitialize { @Override public void onStartup(ServletContext serviceContext) { // Load Spring web application configuration AnnotationCo } ## Kotlin class MyWebApplication年初: WebApplication年初 { override fun onStartup(servletContext: ServletContext) { // Load Spring web application configuration val context = Annota the DispatcherServlet valservlet = DispatcherServlet(context) valregistration =servletContext.addServlet("app",servlet) registration.setLoadOnStartup(1) registration0 码力 | 259 页 | 3.58 MB | 2 年前3
Spring Framework 1.2.x Changelog* added overloaded constructors to MockFilterConfig, using a MockServletContext instead of a ServletContext argument Package org.springframework.orm * refined JDO PersistenceManagerFactoryUtils to explicitly even after a forward/include * added various RequestLoggingFilters: for Commons Logging, the ServletContext log, and Log4J including NDC support * FrameworkServlet exposes protected "processRequest" Log4jConfigListener/Servlet supports "file:" URL as "log4jConfigLocation" (as alternative to ServletContext resource) * Log4jConfigListener/Servlet and WebAppRootListener remove the web app root system0 码力 | 94 页 | 267.57 KB | 2 年前3
Spring Framework 1.1.5 ChangelogLog4jConfigListener/Servlet supports "file:" URL as "log4jConfigLocation" (as alternative to ServletContext resource) * Log4jConfigListener/Servlet and WebAppRootListener remove the web app root system ServletContextFactoryBean, exposing the ServletContext for bean references (alternative to ServletContextAware) * added ServletContextAttributeFactoryBean, exposing an existing ServletContext attribute for bean references references * added ServletContextAttributeExporter, taking Spring-defined objects and exposing them as ServletContext attributes * added ServletContextPropertyPlaceholderConfigurer, a subclass that falls back to0 码力 | 57 页 | 166.71 KB | 2 年前3
Java 应用与开发 - 面向对象编程进阶## ✓ Singleton 的使用场景 在任何使用到 Single 类的 Java 程序中(这里指的是一次运行中),需要确保只有一个 Single 类的实例存在(如 Web 应用 ServletContext 全局上下文对象),则使用该模式。 ## Singleton 设计模式 ## ✓ Singleton 代码的特点 1. 使用静态属性 onlyone 来引用一个 “全局性” 的 Single ## ✓ Singleton 的使用场景 在任何使用到 Single 类的 Java 程序中(这里指的是一次运行中),需要确保只有一个 Single 类的实例存在(如 Web 应用 ServletContext 全局上下文对象),则使用该模式。 ## Singleton 设计模式 ## ✓ Singleton 代码的特点 1. 使用静态属性 onlyone 来引用一个 “全局性” 的 Single ## ✓ Singleton 的使用场景 在任何使用到 Single 类的 Java 程序中(这里指的是一次运行中),需要确保只有一个 Single 类的实例存在(如 Web 应用 ServletContext 全局上下文对象),则使用该模式。 ## Singleton 设计模式 ## ✓ Singleton 代码的特点 1. 使用静态属性 onlyone 来引用一个 “全局性” 的 Single0 码力 | 49 页 | 659.74 KB | 2 年前3
Apache Shiro参考手册中文版只中会有不只一个启用 Shiro 的应用程序。对于这个简单的例子而言,这是没有问题的,但更为复杂的应用程序环境通常将 SecurityManager 置于应用程序特定的存储中(如在 Web 应用中的 ServletContext 或 Spring,Guice 后 JBoss DI 容器实例)。 ## Using Shiro 现在我们的 SecurityManager 已经设置好并可以使用了,现在我们能够开始 实例(其中包含 Shiro 需要的一切操作,包括 SecurityManager),使得它在 ServletContext 中能够被访问。如果你需要在任何时候获得 WebEnvironment 实例,你可以调用 WebUtils.getRequiredWebEnvironment(ServletContext)。 - ShiroFilter 将使用此 WebEnvironment 对任何过滤的请求执行所有必要的安全操作。 默认情况下,EnvironmentLoaderListener 将创建一个 IniWebEnvironment 实例,呈现 Shiro 基于 INI 文件的配置。如果你愿意,你可以在 web.xml 中指定一个自定义的 ServletContext context-param:shiroEnvironmentClass com 0 码力 | 92 页 | 1.16 MB | 2 年前3
共 328 条
- 1
- 2
- 3
- 4
- 5
- 6
- 33
相关搜索词
ServletContextWeb 配置ServletConfigWeb 环境对象会话超时Java EE 监听器ServletContext 监听器HttpSession 会话ServletContext 对象属性监听器ServletRequest 请求对象Java 应用与开发Java SEJava EE开发环境配置面向对象编程Spring BootSpring Framework嵌入式 Servlet ContainersMavenGradleSpring Boot CLI启动器Spring Web MVCDispatcherServletWebSocketFilterContextLoaderListenerAOPBeanFactoryTransaction ManagementJDBCJMSVelocityViewResolverHibernateTemplateAbstractBeanFactoryAOP框架事务管理视图解析器设计模式创建型模式行为型模式结构型模式单例模式身份验证授权会话管理加密权限检查













