Java Doc for HTTPParserImpl.java in  » Web-Server » JicarillaHTTP » org » jicarilla » http » 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 » Web Server » JicarillaHTTP » org.jicarilla.http 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.jicarilla.http.HTTPParserImpl

HTTPParserImpl
public class HTTPParserImpl implements HTTPParser(Code)

A component that understands HTTP. Fires off events to a handler similarly to the way SAX works. Is *not* threadsafe.

The most common state machine failures are:

  • AssertionError if an expected LF doesn't follow on CR
  • 413 if buffer exceeds MAX_BUFFER_SIZE (for some message parts only)
  • 400 if a byte is encountered that is not acceptable for the current part of a message.

  • author:
       Leo Simons
    version:
       $Id: HTTPParserImpl.java,v 1.10 2004/04/03 10:13:24 lsimons Exp $

Inner Class :final protected class Context

Field Summary
final public static  intDONE
    
 Description:
 Alias for 
NOT_STARTED .
final public static  intINVALID
    
 Description:
 An internal error exists somewhere.
final public static  intLOOKING_FOR_BODY
    
 Description:
 Decide whether there is a body.
final public static  intLOOKING_FOR_CHUNKED_BODY
    
 Description:
 Preparing for a body with chunked transfer coding.
final public static  intLOOKING_FOR_CHUNKED_BODY_CHUNK_CONTENTS
    
 Description:
 Accumulate the current chunk up to its specified size.
final public static  intLOOKING_FOR_CHUNKED_BODY_CHUNK_SIZE
    
 Description:
 Accumulate the hex size of the current chunk.
final public static  intLOOKING_FOR_FIELD1
    
 Description:
 Accumulating the first start line field of the message.
final public static  intLOOKING_FOR_FIELD2
    
 Description:
 Accumulating the second start line field of the message.
final public static  intLOOKING_FOR_FIELD3
    
 Description:
 Accumulating the third start line field of the message.
final public static  intLOOKING_FOR_HEADER_NAME
    
 Description:
 Accumulating the name of the current header.
final public static  intLOOKING_FOR_HEADER_VALUE
    
 Description:
 Accumulating the value of the current header.
final public static  intLOOKING_FOR_HEADER_VALUE_OR_NEXT_HEADER
    
 Description:
 Decide whether a header value is complete or whether it is continued
 on the next line.
final public static  intLOOKING_FOR_NEW_HEADER
    
 Description:
 Deciding on state change to new header or body.
final public static  intLOOKING_FOR_NORMAL_BODY
    
 Description:
 Preparing for a body for which no size is known yet.
final public static  intLOOKING_FOR_NORMAL_BODY_UP_TO_SIZE
    
 Description:
 Accumulating the body up to its specified size.
final public static  intLOOKING_FOR_NO_BODY
    
 Description:
 There is no body to look for.
final public static  intLOOKING_FOR_TRAILER
    
 Description:
 Decide whether a trailer is coming by calling hasTrailers() on
 the handler.
final public static  intLOOKING_FOR_TRAILER_NAME
    
 Description:
 Accumulating the name of the current trailer.
final public static  intLOOKING_FOR_TRAILER_VALUE
    
 Description:
 Accumulating the value of the current trailer.
final public static  intLOOKING_FOR_TRAILER_VALUE_OR_NEXT_TRAILER
    
 Description:
 Decide whether a trailer value is complete or whether it is continued
 on the next line.
final public static  intMAX_BUFFER_SIZE
     If the current view buffer exceeds this value, we throw an HTTP Exception.
final public static  intNOT_STARTED
    
 Description:
 Haven't read a single byte yet of the upcoming message.
final public static  intSKIPPING_HEADER_NEWLINES
    
 Description:
 Ignoring CRLF sequences before the start of the message.
final public static  intSKIPPING_HEADER_VALUE_WHITESPACE
    
 Description:
 Ignoring the continuation whitespace in a multiline header.
final public static  intSKIPPING_TRAILER_VALUE_WHITESPACE
    
 Description:
 Ignoring the continuation whitespace in a multiline trailer.
final public static  intSKIPPING_WHITESPACE_AFTER_HEADER_NAME
    
 Description:
 Ignoring whitespace before the header value.
final public static  intSKIPPING_WHITESPACE_AFTER_TRAILER_NAME
    
 Description:
 Ignoring whitespace before the trailer value.
protected  Contextc
     The basic container for all aspects of the parser state.
protected  HTTPErrorHandlerm_errorHandler
     The handler that will be notified whenever any kind of problem is encountered.
protected  HTTPHandlerm_handler
     The handler that will be notified whenever some piece of information about the message is found.

Constructor Summary
public  HTTPParserImpl(HTTPHandler handler, HTTPErrorHandler errorHandler)
     Create a new instance of the parser.

Method Summary
protected  voidcheckHeaderNameValidity()
     Verify if the character being added to this name is valid.
protected  voidcheckHeaderValueValidity()
     Verify if the character being added to this value is valid.
protected  voidcheckStartLineFirstFieldValidity()
     Verify if the character being added to this field is valid.
protected  voidcheckStartLineSecondFieldValidity()
     Verify if the character being added to this field is valid.
protected  voidcheckStartLineThirdFieldValidity()
     Verify if the character being added to this field is valid.
protected  voiddoParse()
     This is a nearly clean finite state machine.
protected  voiddoParsingLoop()
     Run the state machine.
protected  voiddoPostParsingCleanup()
     Clean up after the state machine and make sure the basic c context is ready for another HTTPParserImpl.parse(ByteBuffer) invocation.
protected  voiddoPreParsingSetup(ByteBuffer source, int limit)
     Prepare for running the state machine and initialize the basic c context .
protected  voidfindSizeOfNormalBody()
     Handle transition from LOOKING_FOR_NORMAL_BODY to LOOKING_FOR_NORMAL_BODY_UP_TO_SIZE or DONE .
protected  voidfoundHeaderName()
     Handle transition from LOOKING_FOR_HEADER_NAME to SKIPPING_WHITESPACE_AFTER_HEADER_NAME .
protected  voidfoundHeaderValue()
     Handle transition from LOOKING_FOR_HEADER_VALUE and closely related states to LOOKING_FOR_HEADER_NAME or a LOOKING_FOR_BODY body state .
protected  voidfoundNormalBody()
     Handle transition from LOOKING_FOR_NORMAL_BODY_UP_TO_SIZE to DONE .
protected  voidfoundStartLineFirstField()
     Handle transition from LOOKING_FOR_FIELD1 to LOOKING_FOR_FIELD2 .
protected  voidfoundStartLineSecondField()
     Handle transition from LOOKING_FOR_FIELD2 to LOOKING_FOR_FIELD3 .
protected  voidfoundStartLineThirdField()
     Handle transition from LOOKING_FOR_FIELD3 to LOOKING_FOR_NEW_HEADER .
protected  voidfoundTrailerName()
    
protected  voidfoundTrailerValue()
    
protected  ContextgetContext()
     Get the basic container for all aspects of the parser state.
public  HTTPErrorHandlergetErrorHandler()
     Get the HTTPErrorHandler where we should direct parsing problems as they occur.
public  HTTPHandlergetHandler()
     Get the HTTPHandler where we should direct parsing events as they occur.
protected  voidgotoBodyState()
     Interact with the m_handler handler to determine what body type to expect and handle the state transition associated with that body type.
protected  voidlookForHeaderValue()
     Handle transition from SKIPPING_HEADER_VALUE_WHITESPACE to LOOKING_FOR_HEADER_VALUE .
public  voidparse(ByteBuffer source)
    

Parse a piece of an HTTP message.

public  voidparse(ByteBuffer source, int limit)
     Parse a piece of an HTTP message.
public  voidreset()
     Re-initialize the parser, throwing away all current parser state.
protected  voidsetContext(Context context)
     Set the basic container for all aspects of the parser state.
public  voidsetErrorHandler(HTTPErrorHandler errorHandler)
     Set the HTTPErrorHandler where we should direct parsing problems as they occur.
public  voidsetHandler(HTTPHandler handler)
     Set the HTTPHandler where we should direct parsing events as they occur.

Field Detail
DONE
final public static int DONE(Code)
 Description:
 Alias for 
NOT_STARTED .
 



INVALID
final public static int INVALID(Code)
 Description:
 An internal error exists somewhere. Unused.
 Next state:
 Not applicable.
 



LOOKING_FOR_BODY
final public static int LOOKING_FOR_BODY(Code)
 Description:
 Decide whether there is a body. This is not actually in use as
 a state, but rather a special function is called from other
 states which are said to change into this one. This function
 decides what to look for by querying the handler using
 getBodyType(). 
 Next state:
 - 
DONE , if there is no body.
 - 
LOOKING_FOR_CHUNKED_BODY , if a body with chunked
 transfer-coding is coming.
 - 
LOOKING_FOR_NORMAL_BODY_UP_TO_SIZE , if a body without
 transfer-coding (or with an unknown transfer-coding) is coming.
 



LOOKING_FOR_CHUNKED_BODY
final public static int LOOKING_FOR_CHUNKED_BODY(Code)
 Description:
 Preparing for a body with chunked transfer coding.
 Next state:
 - 
LOOKING_FOR_CHUNKED_BODY_CHUNK_SIZE , always.
 



LOOKING_FOR_CHUNKED_BODY_CHUNK_CONTENTS
final public static int LOOKING_FOR_CHUNKED_BODY_CHUNK_CONTENTS(Code)
 Description:
 Accumulate the current chunk up to its specified size.
 Next state:
 - 
LOOKING_FOR_CHUNKED_BODY_CHUNK_CONTENTS , if the whole
 chunk hasn't been read yet.
 - 
LOOKING_FOR_CHUNKED_BODY_CHUNK_SIZE , if the whole
 chunk has been read.
 before: send foundBody().
 



LOOKING_FOR_CHUNKED_BODY_CHUNK_SIZE
final public static int LOOKING_FOR_CHUNKED_BODY_CHUNK_SIZE(Code)
 Description:
 Accumulate the hex size of the current chunk.
 Next state:
 - 
LOOKING_FOR_CHUNKED_BODY_CHUNK_SIZE , if the field is not
 complete yet.
 - 
LOOKING_FOR_CHUNKED_BODY_CHUNK_CONTENTS , if CR is
 encountered and the size is not 0.
 - 
LOOKING_FOR_TRAILER , if CR is
 encountered and the size is 0.
 



LOOKING_FOR_FIELD1
final public static int LOOKING_FOR_FIELD1(Code)
 Description:
 Accumulating the first start line field of the message.
 Next state:
 - 
LOOKING_FOR_FIELD1 , if the field hasn't ended yet.
 - 
LOOKING_FOR_FIELD2 , if SP is encountered.
 before: send foundStartLineFirstField().
 



LOOKING_FOR_FIELD2
final public static int LOOKING_FOR_FIELD2(Code)
 Description:
 Accumulating the second start line field of the message.
 Next state:
 - 
LOOKING_FOR_FIELD2 , if the field hasn't ended yet.
 - 
LOOKING_FOR_FIELD3 , if SP is encountered.
 before: send foundStartLineSecondField().
 



LOOKING_FOR_FIELD3
final public static int LOOKING_FOR_FIELD3(Code)
 Description:
 Accumulating the third start line field of the message.
 Next state:
 - 
LOOKING_FOR_FIELD3 , if the field hasn't ended yet.
 - 
LOOKING_FOR_NEW_HEADER , if CR is encountered.
 before: send foundStartLineThirdField().
 



LOOKING_FOR_HEADER_NAME
final public static int LOOKING_FOR_HEADER_NAME(Code)
 Description:
 Accumulating the name of the current header.
 Next state:
 - 
LOOKING_FOR_HEADER_NAME , if the name hasn't finished yet.
 - 
SKIPPING_WHITESPACE_AFTER_HEADER_NAME , if COLON is
 encountered.
 before: send foundHeaderName().
 



LOOKING_FOR_HEADER_VALUE
final public static int LOOKING_FOR_HEADER_VALUE(Code)
 Description:
 Accumulating the value of the current header.
 Next state:
 - 
LOOKING_FOR_HEADER_VALUE , if the header value hasn't ended
 yet.
 - 
LOOKING_FOR_HEADER_VALUE_OR_NEXT_HEADER , if CR is
 encountered.
 



LOOKING_FOR_HEADER_VALUE_OR_NEXT_HEADER
final public static int LOOKING_FOR_HEADER_VALUE_OR_NEXT_HEADER(Code)
 Description:
 Decide whether a header value is complete or whether it is continued
 on the next line.
 Next state:
 - 
SKIPPING_HEADER_VALUE_WHITESPACE , if a SP is encountered.
 - 
LOOKING_FOR_BODY , if a CR is encountered.
 before: send foundHeaderValue().
 - 
LOOKING_FOR_HEADER_NAME , if another header is coming.
 before: send foundHeaderValue().
 



LOOKING_FOR_NEW_HEADER
final public static int LOOKING_FOR_NEW_HEADER(Code)
 Description:
 Deciding on state change to new header or body.
 Next state:
 - 
LOOKING_FOR_HEADER_NAME , if a header is coming.
 - 
LOOKING_FOR_BODY , if CR is encountered.
 



LOOKING_FOR_NORMAL_BODY
final public static int LOOKING_FOR_NORMAL_BODY(Code)
 Description:
 Preparing for a body for which no size is known yet.
 Next state:
 - 
LOOKING_FOR_NORMAL_BODY_UP_TO_SIZE , if the handler can
 provide the expected size for the body.
 Failure:
 - 411 if the handler cannot produce an expected size for the body.
 



LOOKING_FOR_NORMAL_BODY_UP_TO_SIZE
final public static int LOOKING_FOR_NORMAL_BODY_UP_TO_SIZE(Code)
 Description:
 Accumulating the body up to its specified size.
 Next state:
 - 
LOOKING_FOR_NORMAL_BODY_UP_TO_SIZE , if the whole body has
 not been read yet.
 - 
DONE , if the whole body has been read.
 before: send foundBody().
 before: send endMessage().
 



LOOKING_FOR_NO_BODY
final public static int LOOKING_FOR_NO_BODY(Code)
 Description:
 There is no body to look for. This is not actually in use as
 a state, but is included purely to make behaviour of the body
 type selection clearer and consistent with getBodyType()
 contracts.
 Next state:
 not applicable.
 



LOOKING_FOR_TRAILER
final public static int LOOKING_FOR_TRAILER(Code)
 Description:
 Decide whether a trailer is coming by calling hasTrailers() on
 the handler.
 Next state:
 - 
LOOKING_FOR_TRAILER_NAME , if trailers are coming.
 - 
DONE , if no trailers are coming.
 before: send endMessage().
 



LOOKING_FOR_TRAILER_NAME
final public static int LOOKING_FOR_TRAILER_NAME(Code)
 Description:
 Accumulating the name of the current trailer.
 Next state:
 - 
LOOKING_FOR_TRAILER_NAME , if the trailer hasn't finished
 yet.
 - 
SKIPPING_WHITESPACE_AFTER_TRAILER_NAME , if COLON is
 encountered.
 before: send foundFooterName().
 



LOOKING_FOR_TRAILER_VALUE
final public static int LOOKING_FOR_TRAILER_VALUE(Code)
 Description:
 Accumulating the value of the current trailer.
 Next state:
 - 
LOOKING_FOR_HEADER_VALUE , if the trailer value hasn't ended
 yet.
 - 
LOOKING_FOR_HEADER_VALUE_OR_NEXT_HEADER , if CR is
 encountered.
 



LOOKING_FOR_TRAILER_VALUE_OR_NEXT_TRAILER
final public static int LOOKING_FOR_TRAILER_VALUE_OR_NEXT_TRAILER(Code)
 Description:
 Decide whether a trailer value is complete or whether it is continued
 on the next line.
 Next state:
 - 
SKIPPING_HEADER_VALUE_WHITESPACE , if a SP is encountered.
 - 
LOOKING_FOR_BODY , if a CR is encountered.
 before: send foundTrailerValue().
 - 
LOOKING_FOR_HEADER_NAME , if another header is coming.
 before: send foundTrailerValue().
 



MAX_BUFFER_SIZE
final public static int MAX_BUFFER_SIZE(Code)
If the current view buffer exceeds this value, we throw an HTTP Exception. This prevents us from hanging on really big requests. (10kb worth of buffer should be plenty)



NOT_STARTED
final public static int NOT_STARTED(Code)
 Description:
 Haven't read a single byte yet of the upcoming message.
 Next state:
 - 
SKIPPING_HEADER_NEWLINES , always.
 before: send newMessage().
 



SKIPPING_HEADER_NEWLINES
final public static int SKIPPING_HEADER_NEWLINES(Code)
 Description:
 Ignoring CRLF sequences before the start of the message.
 Next state:
 - 
SKIPPING_HEADER_NEWLINES , if there's more CRLF.
 - 
LOOKING_FOR_FIELD1 , if there's anything else.
 



SKIPPING_HEADER_VALUE_WHITESPACE
final public static int SKIPPING_HEADER_VALUE_WHITESPACE(Code)
 Description:
 Ignoring the continuation whitespace in a multiline header. 
 Next state:
 - 
SKIPPING_HEADER_VALUE_WHITESPACE , if SP or HT is
 encountered.
 - 
LOOKING_FOR_HEADER_VALUE , if the continuation whitespace
 ends.
 



SKIPPING_TRAILER_VALUE_WHITESPACE
final public static int SKIPPING_TRAILER_VALUE_WHITESPACE(Code)
 Description:
 Ignoring the continuation whitespace in a multiline trailer. 
 Next state:
 - 
SKIPPING_TRAILER_VALUE_WHITESPACE , if SP or HT is
 encountered.
 - 
LOOKING_FOR_TRAILER_VALUE , if the continuation whitespace
 ends.
 



SKIPPING_WHITESPACE_AFTER_HEADER_NAME
final public static int SKIPPING_WHITESPACE_AFTER_HEADER_NAME(Code)
 Description:
 Ignoring whitespace before the header value.
 Next state:
 - 
SKIPPING_WHITESPACE_AFTER_HEADER_NAME , if there's more
 whitespace.
 - 
LOOKING_FOR_HEADER_VALUE , if non-whitespace is
 encountered.
 - 
LOOKING_FOR_HEADER_VALUE_OR_NEXT_HEADER , if CR is
 encountered.
 



SKIPPING_WHITESPACE_AFTER_TRAILER_NAME
final public static int SKIPPING_WHITESPACE_AFTER_TRAILER_NAME(Code)
 Description:
 Ignoring whitespace before the trailer value.
 Next state:
 - 
SKIPPING_WHITESPACE_AFTER_TRAILER_NAME , if there's more
 whitespace.
 - 
LOOKING_FOR_TRAILER_VALUE , if non-whitespace is
 encountered.
 - 
LOOKING_FOR_TRAILER_VALUE_OR_NEXT_TRAILER , if CR is
 encountered.
 



c
protected Context c(Code)
The basic container for all aspects of the parser state.



m_errorHandler
protected HTTPErrorHandler m_errorHandler(Code)
The handler that will be notified whenever any kind of problem is encountered.



m_handler
protected HTTPHandler m_handler(Code)
The handler that will be notified whenever some piece of information about the message is found.




Constructor Detail
HTTPParserImpl
public HTTPParserImpl(HTTPHandler handler, HTTPErrorHandler errorHandler)(Code)
Create a new instance of the parser. You should create a parser instance per thread of execution, since the parser is single-threaded and it saves state between invocations of HTTPParserImpl.parse(ByteBuffer) .
Parameters:
  handler - the HTTPHandler where we should direct parsingevents as they occur. Should not be null.
Parameters:
  errorHandler - the HTTPErrorHandler where we should directparsing problems as they occur. Should not be null.




Method Detail
checkHeaderNameValidity
protected void checkHeaderNameValidity() throws HTTPException(Code)
Verify if the character being added to this name is valid.
throws:
  HTTPException - if the character being added to this name isinvalid.



checkHeaderValueValidity
protected void checkHeaderValueValidity() throws HTTPException(Code)
Verify if the character being added to this value is valid.
throws:
  HTTPException - if the character being added to this value isinvalid.



checkStartLineFirstFieldValidity
protected void checkStartLineFirstFieldValidity() throws HTTPException(Code)
Verify if the character being added to this field is valid.
throws:
  HTTPException - if the character being added to this field isinvalid.



checkStartLineSecondFieldValidity
protected void checkStartLineSecondFieldValidity() throws HTTPException(Code)
Verify if the character being added to this field is valid.
throws:
  HTTPException - if the character being added to this field isinvalid.



checkStartLineThirdFieldValidity
protected void checkStartLineThirdFieldValidity() throws HTTPException(Code)
Verify if the character being added to this field is valid.
throws:
  HTTPException - if the character being added to this field isinvalid.



doParse
protected void doParse() throws HTTPException(Code)
This is a nearly clean finite state machine. We take a few shortcuts to handle things like CRLF. Also, we sometimes "fall through" to the next state immediately rather than back up a character and run the machine again. To undestand the internals of this machine and the choices made, you'll likely want to refer to the HTTP spec on a routine basis. Also, make sure to understand the possible states and read their descriptions.
throws:
  HTTPException -



doParsingLoop
protected void doParsingLoop() throws HTTPException(Code)
Run the state machine.
throws:
  HTTPException - if an exception occurs in the state machine.



doPostParsingCleanup
protected void doPostParsingCleanup()(Code)
Clean up after the state machine and make sure the basic c context is ready for another HTTPParserImpl.parse(ByteBuffer) invocation.



doPreParsingSetup
protected void doPreParsingSetup(ByteBuffer source, int limit) throws HTTPException(Code)
Prepare for running the state machine and initialize the basic c context .
Parameters:
  source - the source for the HTTP message.
Parameters:
  limit - up to where to read from the source.
throws:
  HTTPException - if the source is too large.



findSizeOfNormalBody
protected void findSizeOfNormalBody() throws HTTPException(Code)
Handle transition from LOOKING_FOR_NORMAL_BODY to LOOKING_FOR_NORMAL_BODY_UP_TO_SIZE or DONE .



foundHeaderName
protected void foundHeaderName()(Code)
Handle transition from LOOKING_FOR_HEADER_NAME to SKIPPING_WHITESPACE_AFTER_HEADER_NAME .



foundHeaderValue
protected void foundHeaderValue()(Code)
Handle transition from LOOKING_FOR_HEADER_VALUE and closely related states to LOOKING_FOR_HEADER_NAME or a LOOKING_FOR_BODY body state .



foundNormalBody
protected void foundNormalBody()(Code)
Handle transition from LOOKING_FOR_NORMAL_BODY_UP_TO_SIZE to DONE .



foundStartLineFirstField
protected void foundStartLineFirstField()(Code)
Handle transition from LOOKING_FOR_FIELD1 to LOOKING_FOR_FIELD2 .



foundStartLineSecondField
protected void foundStartLineSecondField()(Code)
Handle transition from LOOKING_FOR_FIELD2 to LOOKING_FOR_FIELD3 .



foundStartLineThirdField
protected void foundStartLineThirdField()(Code)
Handle transition from LOOKING_FOR_FIELD3 to LOOKING_FOR_NEW_HEADER .



foundTrailerName
protected void foundTrailerName() throws HTTPException(Code)



foundTrailerValue
protected void foundTrailerValue()(Code)



getContext
protected Context getContext()(Code)
Get the basic container for all aspects of the parser state. the basic container for all aspects of the parser state.



getErrorHandler
public HTTPErrorHandler getErrorHandler()(Code)
Get the HTTPErrorHandler where we should direct parsing problems as they occur. the HTTPErrorHandler where we should directparsing problems as they occur.



getHandler
public HTTPHandler getHandler()(Code)
Get the HTTPHandler where we should direct parsing events as they occur. the HTTPHandler where we should direct parsingevents as they occur.



gotoBodyState
protected void gotoBodyState()(Code)
Interact with the m_handler handler to determine what body type to expect and handle the state transition associated with that body type. Used for transitioning into the body state.



lookForHeaderValue
protected void lookForHeaderValue()(Code)
Handle transition from SKIPPING_HEADER_VALUE_WHITESPACE to LOOKING_FOR_HEADER_VALUE .



parse
public void parse(ByteBuffer source) throws HTTPException(Code)

Parse a piece of an HTTP message. Equivalent to calling

 parse( source, source.limit() );
 

Parameters:
  source - the buffer to read from. Note that you shouldnever modify this buffer after passing it to the parser!
throws:
  HTTPException -
See Also:    HTTPParser#parse(ByteBuffer).



parse
public void parse(ByteBuffer source, int limit) throws HTTPException(Code)
Parse a piece of an HTTP message. The buffer will be read from its current position up to its limit. On return, the buffers position will be at its end.
Parameters:
  source - the buffer to read from. Note that you shouldnever modify this buffer after passing it to the parser!
Parameters:
  limit - the number of bytes to read from the source
throws:
  HTTPException -
See Also:    HTTPParser#parse(ByteBuffer,int).



reset
public void reset()(Code)
Re-initialize the parser, throwing away all current parser state.
See Also:    HTTPParser#reset().



setContext
protected void setContext(Context context)(Code)
Set the basic container for all aspects of the parser state. Should not be null.
Parameters:
  context - the basic container for all aspects of the parser state.



setErrorHandler
public void setErrorHandler(HTTPErrorHandler errorHandler)(Code)
Set the HTTPErrorHandler where we should direct parsing problems as they occur. Should not be null.
Parameters:
  errorHandler - the HTTPErrorHandler where we should directparsing problems as they occur.



setHandler
public void setHandler(HTTPHandler handler)(Code)
Set the HTTPHandler where we should direct parsing events as they occur. Should not be null.
Parameters:
  handler - the HTTPHandler where we should direct parsingevents as they occur.



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.