CSC 330 Chapter 7 sessions and cookies

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

To provide session tracking when cookies are disabled in the browser, you can use ___________ to store the session ID in the URL for each page of an application. However, there are several problems with this technique, and it is not considered best practice

URL encoding

You can use __________ to pass parameters to a servlet or JSP. To do that, you add the parameters to the end of the URL

URL rewriting

Adds the specified cookie to the response

addCookie(Cookie c)

By default, the servlet API uses a _______ to store a session ID in each browser. Then, the browser passes the cookie to the server with each request.

cookie

How do you create a per-session cookie?

cookie.setMaxAge(-1);

Returns the value of the specified attribute as an object type. If no attribute exists for the specified name, this method returns a null value.

getAttribute(String name);

Returns a java.util.Enumeration object that conatins the names of all atrributes in the HttpSession object

getAttributeNames();

Returns an array of Cookie objects that the client sent with this request. If no cookies were sent, this method returns a null value

getCookies();

Returns a string for the unique Java session identifier that the serlvet engine generates for each session

getId();

returns name of cookie

getName()

Returns the HTTPSession object associated with this request. If the request is not associated with a session, this method creates a new HttpSession object and returns it.

getSession();

returns a string that contains the value of the cookie

getValue()

You can use ______ to pass parameters to a servlet or JSP. To do that, you code hidden fields within a form tag

hidden fields (shouldn't be used for passwords, not secure)

Invalidates the session and unbinds any objects that are bound to it

invalidate()

Returns a true value if the client does not yet know about the session or if the client chooses not to join the session

isNew();

There are two types of cookies: _____ are stored on the user's PC, and ________ are deleted when the session ends

persistent cookies, per-session cookies

Removes the specified attribute from this session

removeAttribute(String name);

To store data for each session, the server creates a _____________

session object

Stores any object in the session as an attribute and specifies a name for the attribute

setAttribute(String name, Object o);

Returns a cookie to other hosts within the same domain.

setDomain(String domainPattern)

Deletes a persistent cookie

setMaxAge(0);

Sets the amount of time before the session is invalidated. Default is 1800 seconds

setMaxInactiveInterval(int seconds);

Specify which pages have access to the cookie ("/" for the whole application)

setPath(String path)

HTTP is a _______. Once a browser makes a request, it drops the connection to the server. So to maintain _____ , a web application must use _________________.

stateless protocol, state, session tracking


संबंधित स्टडी सेट्स

Path 370 Quiz 4 (CH. 22, 23, 24, 25)

View Set

American Public School Law - Landmark Cases (Alexander Text)

View Set

Conceptual Physics study guide modules 5,6,7,1

View Set

Lektion 13 - wann, wenn oder als? (Grammatik)

View Set