tomcat和weblogic设置session有效期和tomcat应用访问权限
2017-10-16 20:41
507 查看
Tomcat/weblogic session失效时间的几种设置方法
2010年09月02日 星期四 下午 5:25
12:设置tomcat访问权限的问题,需要在应用工程的web.xml中增加
<web-app>
<security-constraint>
<web-resource-collection>
<display-name>Example Security Constraint</display-name>
<web-resource-name>My Test</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>role1</role-name>
<role-name>tomcat</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>BASIC</auth-method>
<realm-name>My Test</realm-name>
</login-config>
<web-app>
其中,<url-pattern>中指定受限的url,可以使用通配符*,通常对整个目录进行访问权限控制。
<auth-constraint>中指定哪些角色可以访问<url-pattern>指定的url,在<role-name>中可以设置一个或多个角色名。使用的角色名来自tomcat的配置文件${CATALINA_HOME}/conf/tomcat-users.xml。<login-config>中设置登录方式,<auth-method>的取值为BASIC或FORM。如果为BASIC,浏览器在需要登录时弹出一个登录窗口。如果为FORM方式,需要指定登录页面和登录失败时的提示信息显示页面。
2010年09月02日 星期四 下午 5:25
一、在容器中设置 tomcat中配置server.xml中定义context时采用如下定义: <Context path="/livsorder" docBase="/home/httpd/html/livsorder" defaultSessionTimeOut="3600" isWARExpanded="true" isWARValidated="false" isInvokerEnabled="true" isWorkDirPersistent="false"/> weblogci中设置weblogic特有部署描述符weblogic.xml的<session-descriptor>元素的 timeoutsecs 属性。这个值以秒为单位 <session-descriptor> <session-param> <param-name>timeoutsecs</param-name> <param-value>2600</param-value> </session-param> </session-descriptor> 默认值是2600秒 二、web应用设置,优先级比容器中高 设置web应用程序描述符web.xml里的<session-timeout>元素。这个值以分钟为 单位,并覆盖 weblogic.xml中的timeoutsecs属性 <session-config> <session-timeout>24</session-timeout> </session-config> 此例表示session将在24分钟后过期 ,默认设置是30分钟 当<session- timeout>设置为-2,表示将使用在weblogic.xml中设置的 timeoutsecs这个属性值。 当<session- timeout>设置为-1,表示session将永不过期,而忽略在 weblogic.xml中设置的timeoutsecs属性值。 该属性值可以通过console控制台来设置 三、应用代码中设置,优先级最高 jsp中控制 session.setmaxinactiveinterval(7200); session是默认对象,可以直接引 用,单位秒s 4,servlet中控制 httpsession session = request.getsession(); session.setmaxinactiveinterval(7200); 单位秒 s |
<web-app>
<security-constraint>
<web-resource-collection>
<display-name>Example Security Constraint</display-name>
<web-resource-name>My Test</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>role1</role-name>
<role-name>tomcat</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>BASIC</auth-method>
<realm-name>My Test</realm-name>
</login-config>
<web-app>
其中,<url-pattern>中指定受限的url,可以使用通配符*,通常对整个目录进行访问权限控制。
<auth-constraint>中指定哪些角色可以访问<url-pattern>指定的url,在<role-name>中可以设置一个或多个角色名。使用的角色名来自tomcat的配置文件${CATALINA_HOME}/conf/tomcat-users.xml。<login-config>中设置登录方式,<auth-method>的取值为BASIC或FORM。如果为BASIC,浏览器在需要登录时弹出一个登录窗口。如果为FORM方式,需要指定登录页面和登录失败时的提示信息显示页面。
相关文章推荐
- tomcat和weblogic设置session有效期和tomcat应用访问权限
- 部署错误:尚未授予访问 Tomcat 服务器的权限。请在服务器管理器的 Tomcat 定制器中设置 "manager-script" 角色的正确用户名和口令。 有关详细信息,请查看服务器日志。
- android 7.0系统怎么让应用开机就自动设置访问权限。
- 在Tomcat中为页面设置访问权限
- tomcat 设置 ip 端口访问 以及 多应用设置
- 部署错误:尚未授予访问 Tomcat 服务器的权限。请在服务器管理器的 Tomcat 定制器中设置 "manager-script" 角色的正确用户名和口令。
- 在tomcat下访问应用时若想不输项目名的设置方法
- tomcat 详解五 tomcat页面设置访问权限
- 安装程序制作之网站系统安装过程中给系统中应用到的数据库文件设置访问权限
- tomcat页面设置访问权限
- Tomcat 多端口访问多应用设置
- js 设置cookie 的有效期、访问权限
- tomcat下访问应用时不输项目名的设置方法
- 四种设置Tomcat session有效期的方式
- apache rewrite重写配置和本机域名配置,访问权限设置,伪静态实际应用
- 设置tomcat的默认项目名称(默认应用)、端口号,访问连接(url)不需要输入项目名称、端口
- 设置Tomcat session有效期的三种方式
- Eclipse项目配置以及Tomcat访问权限设置
- J2EE安全策略:为tomcat页面设置访问权限(j_security_check)
- 解决同一IP不同端口或跨域访问站点iframe应用session丢失的问与及ASP.NET 开发相关超时设置