Java Doc for CookieParser.java in  » Groupware » hipergate » com » oreilly » servlet » 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 » Groupware » hipergate » com.oreilly.servlet 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.oreilly.servlet.CookieParser

CookieParser
public class CookieParser (Code)
A class to simplify cookie retrieval. It can retrieve cookie values by name and return the value as any primitive type (no casting or parsing required). It can also throw an exception when a cookie is not found (simplifying error handling), and can accept default values (eliminating error handling).

It is used like this:

 CookieParser parser = new CookieParser(req);
  
 float ratio = parser.getFloatCookie("ratio", 1.0);
  
 int count = 0;
 try {
 count = parser.getIntCookie("count");
 }
 catch (NumberFormatException e) {
 handleMalformedCount();
 }
 catch (CookieNotFoundException e) {
 handleNoCount();
 }
 

See Also:   com.oreilly.servlet.CookieNotFoundException
author:
   Jason Hunter, Copyright © 2000
version:
   1.0, 2000/03/19



Constructor Summary
public  CookieParser(HttpServletRequest req)
     Constructs a new CookieParser to handle the cookies of the given request.

Method Summary
public  booleangetBooleanCookie(String name)
    
public  booleangetBooleanCookie(String name, boolean def)
     Gets the named cookie value as a boolean, with a default.
public  bytegetByteCookie(String name)
    
public  bytegetByteCookie(String name, byte def)
     Gets the named cookie value as a byte, with a default.
public  chargetCharCookie(String name)
    
public  chargetCharCookie(String name, char def)
     Gets the named cookie value as a char, with a default.
public  doublegetDoubleCookie(String name)
    
public  doublegetDoubleCookie(String name, double def)
     Gets the named cookie value as a double, with a default.
public  floatgetFloatCookie(String name)
    
public  floatgetFloatCookie(String name, float def)
     Gets the named cookie value as a float, with a default.
public  intgetIntCookie(String name)
    
public  intgetIntCookie(String name, int def)
     Gets the named cookie value as a int, with a default.
public  longgetLongCookie(String name)
    
public  longgetLongCookie(String name, long def)
     Gets the named cookie value as a long, with a default.
public  shortgetShortCookie(String name)
    
public  shortgetShortCookie(String name, short def)
     Gets the named cookie value as a short, with a default.
public  StringgetStringCookie(String name)
    
public  StringgetStringCookie(String name, String def)
     Gets the named cookie value as a String, with a default.
 voidparseCookies()
    


Constructor Detail
CookieParser
public CookieParser(HttpServletRequest req)(Code)
Constructs a new CookieParser to handle the cookies of the given request.
Parameters:
  req - the servlet request




Method Detail
getBooleanCookie
public boolean getBooleanCookie(String name) throws CookieNotFoundException(Code)
Gets the named cookie value as a boolean
Parameters:
  name - the cookie name the cookie value as a boolean
exception:
  CookieNotFoundException - if the cookie was not found



getBooleanCookie
public boolean getBooleanCookie(String name, boolean def)(Code)
Gets the named cookie value as a boolean, with a default. Returns the default value if the cookie is not found.
Parameters:
  name - the cookie name
Parameters:
  def - the default cookie value the cookie value as a boolean, or the default



getByteCookie
public byte getByteCookie(String name) throws CookieNotFoundException, NumberFormatException(Code)
Gets the named cookie value as a byte
Parameters:
  name - the cookie name the cookie value as a byte
exception:
  CookieNotFoundException - if the cookie was not found
exception:
  NumberFormatException - if the cookie value could notbe converted to a byte



getByteCookie
public byte getByteCookie(String name, byte def)(Code)
Gets the named cookie value as a byte, with a default. Returns the default value if the cookie is not found or cannot be converted to a byte.
Parameters:
  name - the cookie name
Parameters:
  def - the default cookie value the cookie value as a byte, or the default



getCharCookie
public char getCharCookie(String name) throws CookieNotFoundException(Code)
Gets the named cookie value as a char
Parameters:
  name - the cookie name the cookie value as a char
exception:
  CookieNotFoundException - if the cookie was not found



getCharCookie
public char getCharCookie(String name, char def)(Code)
Gets the named cookie value as a char, with a default. Returns the default value if the cookie is not found.
Parameters:
  name - the cookie name
Parameters:
  def - the default cookie value the cookie value as a char, or the default



getDoubleCookie
public double getDoubleCookie(String name) throws CookieNotFoundException, NumberFormatException(Code)
Gets the named cookie value as a double
Parameters:
  name - the cookie name the cookie value as a double
exception:
  CookieNotFoundException - if the cookie was not found
exception:
  NumberFormatException - if the cookie could not be convertedto a double



getDoubleCookie
public double getDoubleCookie(String name, double def)(Code)
Gets the named cookie value as a double, with a default. Returns the default value if the cookie is not found.
Parameters:
  name - the cookie name
Parameters:
  def - the default cookie value the cookie value as a double, or the default



getFloatCookie
public float getFloatCookie(String name) throws CookieNotFoundException, NumberFormatException(Code)
Gets the named cookie value as a float
Parameters:
  name - the cookie name the cookie value as a float
exception:
  CookieNotFoundException - if the cookie was not found
exception:
  NumberFormatException - if the cookie could not be convertedto a float



getFloatCookie
public float getFloatCookie(String name, float def)(Code)
Gets the named cookie value as a float, with a default. Returns the default value if the cookie is not found.
Parameters:
  name - the cookie name
Parameters:
  def - the default cookie value the cookie value as a float, or the default



getIntCookie
public int getIntCookie(String name) throws CookieNotFoundException, NumberFormatException(Code)
Gets the named cookie value as a int
Parameters:
  name - the cookie name the cookie value as a int
exception:
  CookieNotFoundException - if the cookie was not found
exception:
  NumberFormatException - if the cookie could not be convertedto a int



getIntCookie
public int getIntCookie(String name, int def)(Code)
Gets the named cookie value as a int, with a default. Returns the default value if the cookie is not found.
Parameters:
  name - the cookie name
Parameters:
  def - the default cookie value the cookie value as a int, or the default



getLongCookie
public long getLongCookie(String name) throws CookieNotFoundException, NumberFormatException(Code)
Gets the named cookie value as a long
Parameters:
  name - the cookie name the cookie value as a long
exception:
  CookieNotFoundException - if the cookie was not found
exception:
  NumberFormatException - if the cookie could not be convertedto a long



getLongCookie
public long getLongCookie(String name, long def)(Code)
Gets the named cookie value as a long, with a default. Returns the default value if the cookie is not found.
Parameters:
  name - the cookie name
Parameters:
  def - the default cookie value the cookie value as a long, or the default



getShortCookie
public short getShortCookie(String name) throws CookieNotFoundException, NumberFormatException(Code)
Gets the named cookie value as a short
Parameters:
  name - the cookie name the cookie value as a short
exception:
  CookieNotFoundException - if the cookie was not found
exception:
  NumberFormatException - if the cookie could not be convertedto a short



getShortCookie
public short getShortCookie(String name, short def)(Code)
Gets the named cookie value as a short, with a default. Returns the default value if the cookie is not found.
Parameters:
  name - the cookie name
Parameters:
  def - the default cookie value the cookie value as a short, or the default



getStringCookie
public String getStringCookie(String name) throws CookieNotFoundException(Code)
Gets the named cookie value as a String
Parameters:
  name - the cookie name the cookie value as a String
exception:
  CookieNotFoundException - if the cookie was not found



getStringCookie
public String getStringCookie(String name, String def)(Code)
Gets the named cookie value as a String, with a default. Returns the default value if the cookie is not found
Parameters:
  name - the cookie name
Parameters:
  def - the default cookie value the cookie value as a String, or the default



parseCookies
void parseCookies()(Code)



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.