Java Doc for CookieModule.java in  » Net » SkunkDAV » HTTPClient » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Net » SkunkDAV » HTTPClient 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   HTTPClient.CookieModule

CookieModule
public class CookieModule implements HTTPClientModule,GlobalConstants(Code)
This module handles Netscape cookies (also called Version 0 cookies) and Version 1 cookies. Specifically is reads the Set-Cookie and Set-Cookie2 response headers and sets the Cookie and Cookie2 headers as neccessary.

The accepting and sending of cookies is controlled by a CookiePolicyHandler. This allows you to fine tune your privacy preferences. A cookie is only added to the cookie list if the handler allows it, and a cookie from the cookie list is only sent if the handler allows it.

A cookie jar can be used to store cookies between sessions. This file is read when this class is loaded and is written when the application exits; only cookies from the default context are saved. The name of the file is controlled by the system property HTTPClient.cookies.jar and defaults to a system dependent name. The reading and saving of cookies is enabled by setting the system property HTTPClient.cookies.save to true.
See Also:    Netscape's cookie spec
See Also:    HTTP State Management Mechanism spec
version:
   0.3-2 18/06/1999
author:
   Ronald Tschalär
since:
   V0.3




Constructor Summary
 CookieModule()
    

Method Summary
public static  voidaddCookie(Cookie cookie)
     Add the specified cookie to the list of cookies in the default context.
public static  voidaddCookie(Cookie cookie, Object context)
     Add the specified cookie to the list of cookies for the specified context.
public static  voiddiscardAllCookies()
     Discard all cookies for all contexts.
public static  voiddiscardAllCookies(Object context)
     Discard all cookies for the given context.
public static  Cookie[]listAllCookies()
     List all stored cookies for all contexts.
public static  Cookie[]listAllCookies(Object context)
     List all stored cookies for a given context.
Parameters:
  context - the context Object.
public static  voidremoveCookie(Cookie cookie)
     Remove the specified cookie from the list of cookies in the default context.
public static  voidremoveCookie(Cookie cookie, Object context)
     Remove the specified cookie from the list of cookies for the specified context.
public  intrequestHandler(Request req, Response[] resp)
     Invoked by the HTTPClient.
public  voidresponsePhase1Handler(Response resp, RoRequest req)
     Invoked by the HTTPClient.
public  intresponsePhase2Handler(Response resp, Request req)
     Invoked by the HTTPClient.
public  voidresponsePhase3Handler(Response resp, RoRequest req)
     Invoked by the HTTPClient.
public static synchronized  CookiePolicyHandlersetCookiePolicyHandler(CookiePolicyHandler handler)
     Sets a new cookie policy handler.
public  voidtrailerHandler(Response resp, RoRequest req)
     Invoked by the HTTPClient.


Constructor Detail
CookieModule
CookieModule()(Code)




Method Detail
addCookie
public static void addCookie(Cookie cookie)(Code)
Add the specified cookie to the list of cookies in the default context. If a compatible cookie (as defined by Cookie.equals()) already exists in the list then it is replaced with the new cookie.
Parameters:
  cookie - the Cookie to add
since:
   V0.3-1



addCookie
public static void addCookie(Cookie cookie, Object context)(Code)
Add the specified cookie to the list of cookies for the specified context. If a compatible cookie (as defined by Cookie.equals()) already exists in the list then it is replaced with the new cookie.
Parameters:
  cookie - the cookie to add
Parameters:
  context - the context Object.
since:
   V0.3-1



discardAllCookies
public static void discardAllCookies()(Code)
Discard all cookies for all contexts. Cookies stored in persistent storage are not affected.



discardAllCookies
public static void discardAllCookies(Object context)(Code)
Discard all cookies for the given context. Cookies stored in persistent storage are not affected.
Parameters:
  context - the context Object



listAllCookies
public static Cookie[] listAllCookies()(Code)
List all stored cookies for all contexts. an array of all Cookies
since:
   V0.3-1



listAllCookies
public static Cookie[] listAllCookies(Object context)(Code)
List all stored cookies for a given context.
Parameters:
  context - the context Object. an array of Cookies
since:
   V0.3-1



removeCookie
public static void removeCookie(Cookie cookie)(Code)
Remove the specified cookie from the list of cookies in the default context. If the cookie is not found in the list then this method does nothing.
Parameters:
  cookie - the Cookie to remove
since:
   V0.3-1



removeCookie
public static void removeCookie(Cookie cookie, Object context)(Code)
Remove the specified cookie from the list of cookies for the specified context. If the cookie is not found in the list then this method does nothing.
Parameters:
  cookie - the cookie to remove
Parameters:
  context - the context Object
since:
   V0.3-1



requestHandler
public int requestHandler(Request req, Response[] resp)(Code)
Invoked by the HTTPClient.



responsePhase1Handler
public void responsePhase1Handler(Response resp, RoRequest req) throws IOException(Code)
Invoked by the HTTPClient.



responsePhase2Handler
public int responsePhase2Handler(Response resp, Request req)(Code)
Invoked by the HTTPClient.



responsePhase3Handler
public void responsePhase3Handler(Response resp, RoRequest req)(Code)
Invoked by the HTTPClient.



setCookiePolicyHandler
public static synchronized CookiePolicyHandler setCookiePolicyHandler(CookiePolicyHandler handler)(Code)
Sets a new cookie policy handler. This handler will be called for each cookie that a server wishes to set and for each cookie that this module wishes to send with a request. In either case the handler may allow or reject the operation. If you wish to blindly accept and send all cookies then just disable the handler with CookieModule.setCookiePolicyHandler(null);.

At initialization time a default handler is installed. This handler allows all cookies to be sent. For any cookie that a server wishes to be set two lists are consulted. If the server matches any host or domain in the reject list then the cookie is rejected; if the server matches any host or domain in the accept list then the cookie is accepted (in that order). If no host or domain match is found in either of these two lists and user interaction is allowed then a dialog box is poped up to ask the user whether to accept or reject the cookie; if user interaction is not allowed the cookie is accepted.

The accept and reject lists in the default handler are initialized at startup from the two properties HTTPClient.cookies.hosts.accept and HTTPClient.cookies.hosts.reject. These properties must contain a "|" separated list of host and domain names. All names beginning with a "." are treated as domain names, all others as host names. An empty string which will match all hosts. The two lists are further expanded if the user chooses one of the "Accept All from Domain" or "Reject All from Domain" buttons in the dialog box.

Note: the default handler does not implement the rules concerning unverifiable transactions (section 4.3.5, RFC-2109). The reason for this is simple: the default handler knows nothing about the application using this client, and it therefore does not have enough information to determine when a request is verifiable and when not. You are therefore encouraged to provide your own handler which implements section 4.3.5 (use the CookiePolicyHandler.sendCookie method for this).
Parameters:
  the - new policy handler the previous policy handler




trailerHandler
public void trailerHandler(Response resp, RoRequest req) throws IOException(Code)
Invoked by the HTTPClient.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.