<!-- [if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
p\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
v\:textbox {display:none;}
</style>
<![endif]-->幻灯片 9<!-- [if !ppt]-->
.O
{color:black;
font-size:149%;}
.O1
{color:black;
font-size:149%;}
.O2
{color:black;
font-size:149%;}
a:link
{color:#CB00CB !important;}
a:active
{color:#3300FF !important;}
a:visited
{color:#0098CB !important;}
<!--.sld
{left:0px !important;
width:6.0in !important;
height:4.5in !important;
font-size:103% !important;}
-->
<!-- [endif]-->
n
A
cookie
is a small bit of text sent to the client that can be read again
later
n
Limitations (for the protection of the client):
n
Not more than 4KB per cookie (more than enough in general)
n
Not more than 20 cookies per site(一个站点的cookie不能超过20个)
n
Not more than 300 cookies total(一个浏览器不超过300个)
n
Cookies are
not
a security threat
n
Cookies
can be
a privacy threat
n
Cookies can be used to customize advertisements
n
Outlook Express allows cookies to be embedded in email
n
A servlet can read your cookies
n
Incompetent companies might keep your credit card info in a cookie
n
Netscape and Firefox let you refuse cookies to sites
other than that to which you
connected
Using Cookies
<!-- [if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
p\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
v\:textbox {display:none;}
</style>
<![endif]-->幻灯片 10<!-- [if !ppt]-->
.O
{color:black;
font-size:149%;}
.O1
{color:black;
font-size:149%;}
.O2
{color:black;
font-size:149%;}
a:link
{color:#CB00CB !important;}
a:active
{color:#3300FF !important;}
a:visited
{color:#0098CB !important;}
<!--.sld
{left:0px !important;
width:6.0in !important;
height:4.5in !important;
font-size:103% !important;}
-->
<!-- [endif]-->
n
import javax.servlet.http.*;
n
Constructor:
Cookie(String name, String value)
n
Assuming
request
is an
HttpServletRequest
and
response
is an
HttpServletResponse
,
n
response
.addCookie(cookie);
n
Cookie[ ] cookies =
request
.getCookies();
n
String name = cookies[i].getName();
n
String value = cookies[i].getValue();
n
There are, of course, many more methods in the
HttpServletRequest
,
HttpServletResponse
, and
Cookie
classes in the
javax.servlet.http
package
<!-- [if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
p\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
v\:textbox {display:none;}
</style>
<![endif]-->幻灯片 11<!-- [if !ppt]-->
.O
{color:black;
font-size:149%;}
a:link
{color:#CB00CB !important;}
a:active
{color:#3300FF !important;}
a:visited
{color:#0098CB !important;}
<!--.sld
{left:0px !important;
width:6.0in !important;
height:4.5in !important;
font-size:103% !important;}
-->
<!-- [endif]-->
Some more
Cookie
methods
<!-- [if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
p\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
v\:textbox {display:none;}
</style>
<![endif]-->幻灯片 11<!-- [if !ppt]-->
.O
{color:black;
font-size:149%;}
.O1
{color:black;
font-size:149%;}
a:link
{color:#CB00CB !important;}
a:active
{color:#3300FF !important;}
a:visited
{color:#0098CB !important;}
<!--.sld
{left:0px !important;
width:6.0in !important;
height:4.5in !important;
font-size:103% !important;}
-->
<!-- [endif]-->
n
public void setComment(String
purpose
)
n
public String getComment()
n
public void setMaxAge(int
expiry
)
n
public int getMaxAge()
n
Max age in seconds after which cookie will expire
n
If
expiry
is negative, delete when browser exits
n
If
expiry
is zero, delete cookie immediately
n
setSecure(boolean
flag
)
n
public boolean getSecure()
n
Indicates to the browser whether the cookie should only be sent using a secure
protocol, such as HTTPS or SSL
<!-- [if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
p\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
v\:textbox {display:none;}
</style>
<![endif]-->幻灯片 12<!-- [if !ppt]-->
.O
{color:black;
font-size:149%;}
a:link
{color:#CB00CB !important;}
a:active
{color:#3300FF !important;}
a:visited
{color:#0098CB !important;}
<!--.sld
{left:0px !important;
width:6.0in !important;
height:4.5in !important;
font-size:103% !important;}
-->
<!-- [endif]-->
What cookies are good for
<!-- [if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
p\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
v\:textbox {display:none;}
</style>
<![endif]-->幻灯片 12<!-- [if !ppt]-->
.O
{color:black;
font-size:149%;}
.O1
{color:black;
font-size:149%;}
.O2
{color:black;
font-size:149%;}
a:link
{color:#CB00CB !important;}
a:active
{color:#3300FF !important;}
a:visited
{color:#0098CB !important;}
<!--.sld
{left:0px !important;
width:6.0in !important;
height:4.5in !important;
font-size:103% !important;}
-->
<!-- [endif]-->
n
Advantages:
n
Java’s Session Tracking API (to be discussed) makes cookies dead simple to
use
n
Cookies can easily contain more data than hidden fields
n
Data is stored on the client computer, not on yours
n
This saves space on the server
n
May let you avoid keeping track of multiple(session) data structures
n
Disadvantages:
n
Data is stored on the client computer, not on yours
n
This means the data is neither safe nor secure
n
Should not be used for user data--cookies may be discarded or the user may
contact the server from another computer
n
Users can tell their browser to turn cookies off
<!-- [if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
p\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
v\:textbox {display:none;}
</style>
<![endif]-->幻灯片 12<!-- [if !ppt]-->
.O
{color:black;
font-size:149%;}
a:link
{color:#CB00CB !important;}
a:active
{color:#3300FF !important;}
a:visited
{color:#0098CB !important;}
<!--.sld
{left:0px !important;
width:6.0in !important;
height:4.5in !important;
font-size:103% !important;}
-->
<!-- [endif]-->
n
Cookies are good for keeping session data, not user data
分享到:
相关推荐
Cookie介绍ppt,pdf格式
session与cookie区别课件,可以下载根据自己的需求改动,节省整理的时间
(ASP.net课件)第六章Application、Session和Cookie对象.ppt
Java Web基础与实例教程的PPT,自己制作的PPT,将近400页,免费分享,童鞋们努力学习吧。
第六章ApplicationSession与Cookie对象.ppt
第6章 Application、Session和Cookie对象.ppt
第11章 Session与Cookie.ppt 第12章 类与对象.ppt 第13章 使用PHP操作XML.ppt 第14章 PHP与MySQL.ppt 第15章 Ajax简介.ppt 第16章 XMLHTTPRequest对象.ppt 第17章 发送请求并处理响应.ppt 第18章 AJAX实际...
关于asp.net的需要讲解,对session and cookies的讲解很精简。
JSP相关资料
基于cookie劫持的deep-web用户数据安全性分析(PPT下载) 王昆 北京邮电大学
ppt介绍了cookie的基本知识,cookie欺骗产生的原理,跨站脚本攻击盗取Cookie,以及Cookie的安全对策
此课件超详细讲解了asp.net中的lication、Session和Cookie对象,帮你你拨开迷雾,走进那奇妙的原始深林……呵呵……超有用……
NULL 博文链接:https://shmilywzc.iteye.com/blog/1191743
网安培训的PPT 适合安全人员学习 可恶的20个字符限制。
session cookie asp.net 的教学ppt
百度账号cookie格式转换工具是一款专门为百度文库打造的文档批量上传... 1、支持批量添加 word、ppt、xls、pdf 及 txt 等常见格式文档; 2、支持文档大小范围过滤,支持文档价格定义; 3、支持文档标签自动获取
第3章 计算机硬件系统.PPT。
V512工作室Java web的ppt 第1章 讲解本书中所使用的Java Web开发工具Eclipse 3.3、MyEclipse 6.0和Tomcat6的安装、配置和使用。 第2章 介绍Servlet技术的发展起源,还介绍了Web编程中需要了解的其他相关技术,例如...
7.8 Cookie和Session. 239 7.8.1 PHP的Cookie. 239 7.8.2 PHP的Session. 241 7.9 PHP访问MySQL数据库... 242 7.9.1 MySQL数据库概述... 242 7.9.2MySQL的命令操作... 243 7.9.3 PHP操纵MySQL. 245
PPT教学课件。作者:梁峥嵘 <br>目录: 0、WEB应用程序。 1、servlet与JSP技术概述 2、servlet基础 3、客户请求的处理:表单数据 4、客户请求的处理:HTTP请求报头 5、服务器响应的生成:HTTP...