Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## things.data.processing.http
Class RequestLineParserOLD

    java.lang.Object
      things.data.processing.LexicalTool
          things.data.processing.http.RequestLineParserOLD

    public class RequestLineParserOLD

extends LexicalTool

An HTTP Request Line parser. Uses the same method as the AddressParser.

Version:
  1.0

  Version History

      EPG - Initial - 12 FEB 07

Author:
  Erich P. Gatejen

Field Summary

Fields inherited from class things.data.processing.LexicalTool
`ALLOWED, ASCII_HIGH, BAD, BREAKING, CHAR, CHAR_DNSCHAR, CHAR_DNSCHAR_NUMERIC, CHAR_DNSCHAR_POUND, CLASS_ALPHA, CLASS_CONTROL, CLASS_NONE, CLASS_NUMERIC, CLASS_PUNCTUATION, COLONVALUE, CONTROL, CRBYTEVALUE, DASHVALUE, DNSCHAR, DOLLARBYTEVALUE, HEADER_READ_STATE_CHART, HEADER_READ_STATE_CHARTV2, HP____SPECIAL_DEAD, HP____SPECIAL_PAUSE, HP____SPECIAL_WALKING_DEAD, HP_BROKEN, HP_CLEAR_PAUSE, HP_CLEAR_PAUSE_CRLF, HP_CLOSURE, HP_CR, HP_HEAD_CR, HP_HEAD_CRLF, HP_HEAD_LF, HP_LF, HP_LFCR, HP_NOT_USED, HP_PAUSE, HP_PAUSE_CRLF, HP_PAUSE_CRLFCR, HP_READ, HP_START, LEXICAL_HEADER_TERMINATION, LEXICAL_MAP, LEXICAL_MAP_822_HEADERNAME, LEXICAL_MAP_822_TYPE, LEXICAL_MAP_CLASSIFICATION, LEXICAL_MAP_DNS_TYPE, LEXICAL_MAP_HEXVALUE, LEXICAL_MAP_NAME, LEXICAL_MAP_URI_TYPE, LEXICAL_MAP_URLF_TYPE, LFBYTEVALUE, NO_CHARACTER, NOT_ALLOWED, OPENBBYTEVALUE, OTHER, PIPEBYTEVALUE, SLASHBYTEVALUE, SPACEVALUE, SPECIAL, SPECIAL_AMP, SPECIAL_AT, SPECIAL_BACKSLASH, SPECIAL_CHAR_DNSCHAR_DOT, SPECIAL_CLOSEBRACK, SPECIAL_CLOSEPAREN, SPECIAL_COLON, SPECIAL_COMMA, SPECIAL_DOLLAR, SPECIAL_EQ, SPECIAL_GT, SPECIAL_LT, SPECIAL_OPENBRACK, SPECIAL_OPENPAREN, SPECIAL_PERCENT, SPECIAL_PLUS, SPECIAL_QUEST, SPECIAL_QUOTE, SPECIAL_SEMICOLON, SPECIAL_SLASH, SPECIAL_SPLAT, STRING_CRLF, TABVALUE, URLCHAR, URLFCHAR, VALUE_ASCII_BOTTOM, VALUE_ASCII_HIGH_BOTTOM, VALUE_ASCII_HIGH_TOP, VALUE_ASCII_LOW_BOTTOM, VALUE_ASCII_LOW_TOP, VALUE_ASCII_TOP, WS, WS_CR_CONTROL, WS_LF_CONTROL, WS_SPACE, WS_TAB_CONTROL`

Constructor Summary
`RequestLineParserOLD()`

Method Summary
`static void` | `parseAndSave(StreamSource source, HttpRequest request)` Parse the source as an HTTP request.
`void` | `parser(java.io.InputStream ins, HttpRequest request)` Call with an InputStream.
`void` | `parser(StreamSource source, HttpRequest request)` Parse engine grammar.
`void` | `parser(java.lang.String data, HttpRequest request)` Call with a String.

Methods inherited from class things.data.processing.LexicalTool
`get822HeadernameType, get822HeadernameTypeWithDollar, get822Type, getClassification, getDNSType, getHexValue, getLower, getName, getUpper, getURIType, getURLFType`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### RequestLineParserOLD

    public RequestLineParserOLD()

Method Detail

### parseAndSave

    public static void parseAndSave(StreamSource source,
                                    HttpRequest request)
                             throws ThingsException

  Parse the source as an HTTP request.

  Parameters:
    `source` - the source data.
    `request` - put values into this object.
  Throws:
    `ThingsException` - If it is a fault, the request should be considered completely invalid. If it is an error, whatever was set in the request might be useful.

### parser

    public void parser(StreamSource source,
                       HttpRequest request)
                throws ThingsException

  Parse engine grammar.

      Lexical elements:
                      URLCHAR = Letters (A-Z and a-z), numbers (0-9) and the characters '.', '-', '~' and '_', plus we treat # as a character because
                        we don't distinguish is for processing.

                      !OTHER! (meaning anything not listed).
                      PERCENT = %
                      SPLAT   = *
                      FSLASH  = /
                      PLUS    = +
                      QUEST   = ?
                      AMP             = &
                      EQU             = =

      Registers
                      Method                  - request.method
                      Server                  - request.server
                      Path                    - request.path
                      (Hex)Sixteens

      Flags
                      DoneURI

      GEThttp://www.yahoo.com/monkey%20head/?l=1207011680%20monkeHTTP-Version
      method

      [START]
              -> NULL->$Method
              -> NULL->$Server
              -> NULL->$Path
              -> NULL->$Version
              -> NULL->$(Hex)Sixteens
              -> FALSE->!DoneURI
              -> [OPEN]
              -> ^RETURN^

      [OPEN]
              - URLCHAR       - push, METHOD, ^RETURN^
              - !OTHER!       - [DEPLETE], error(must start with a character)
              - !EOF!         - fault(No request present)

      [METHOD]
              - URLCHAR       - push
              - PERCENT       - [ESCAPE]
              - WS            - pop->$Method, [POSTMETHOD], ^RETURN^
              - CR | LF       - error(terminated after METHOD)
              - !OTHER!       - [DEPLETE], error(expecting method)
              - !EOF!         - fault(Only METHOD present)

      [POSTMETHOD]
              - WS            - burn
              - SPLAT         - ""->$Server, ->$Path, [STAR], ^RETURN^
              - FSLASH        - ""->$Server, push, [PATH], ^RETURN^
              - URLCHAR       - push, [SERVER], ^RETURN^
              - PERCENT       - [ESCAPE]
              - QUEST         - [DEPLETE], error(expecteding PATH before URI)
              - CR | LF       - [DRAIN], error(terminated before URI)
              - !OTHER!       - [DEPLETE], error(bad characters)
              - !EOF!         - error(No URI present)

      [STAR]
              - WS            - burn, [POSTSTAR], ^RETURN^
              - CR | LF       - [DRAIN], error(terminated without version))
              - !OTHER!       - [DEPLETE], error(excess characters after SPLAT)
              - !EOF!         - error(No URI present)

      [POSTSTAR]
              - WS            - burn
              - CR | LF       - [DRAIN], error(terminated without version))
              - URLCHAR       - push, [VERSION], ^RETURN^
              - !OTHER!       - [DEPLETE], error(bad characters)
              - !EOF!         - error(No Version present)

      [SERVER]
              - PERCENT       - [ESCAPE]
              - WS            - pop->$Server, ""->$Path, [VERSION], ^RETURN^
              - FSLASH        - pop->$Server, push, [PATH], ^RETURN^
              - QUEST         - [DEPLETE], error(expecteding PATH before URI query)
              - URLCHAR       - push
              - CR | LF       - [DRAIN], error(terminated before finishing URI)
              - !OTHER!       - [DEPLETE], error(bad characters)
              - !EOF!         - error(No compelted URI)

      [PATH]
              - PERCENT       - [ESCAPE]
              - URLCHAR       - push
              - FSLASH        - push
              - AMP           - push
              - PLUS          - push(" ")
              - WS            - pop->$Path, [VERSION], ^RETURN^
              - QUEST         - pop->$Path, [START_URI], ^RETURN^
              - CR | LF       - [DRAIN], error(terminated without version)
              - !OTHER!       - [DEPLETE], error(bad characters in path)
              - !EOF!         - error(No completed URI)

      [START_URI]
              - PERCENT       - [ESCAPE], [NAME]
              - URLCHAR       - push, [NAME], if(!DoneURL==TRUE) ^RETURN^
              - PLUS          - push(" "), [NAME], if(!DoneURL==TRUE) ^RETURN^
              - WS            - [POST_URI], ^RETURN^
              - CR | LF       - [DRAIN], error(terminated without version)
              - !OTHER!       - [DEPLETE], error(bad characters in URI)
              - !EOF!         - error(No completed URI)

      [NAME]
              - PERCENT       - [ESCAPE]
              - WS            - [DEPLETE], error(broken name in URI)
              - URLCHAR       - push
              - SPECIAL_SLASH - push("/");
              - PLUS          - push(" ")
              - EQU           - pop->$Name, [START_VALUE], ^RETURN^
              - CR | LF       - [DRAIN], error(terminated without completing query name)
              - !OTHER!       - [DEPLETE], error(bad characters in URI query name)
              - !EOF!         - error(Truncated URI)

      [START_VALUE]
              - PERCENT       - [ESCAPE], [VALUE], ^RETURN^
              - WS            - [DEPLETE], error(broken value in URI)
              - URLCHAR       - push, [VALUE], ^RETURN^
              - SPECIAL_SLASH - push("/"), [VALUE], ^RETURN^;
              - PLUS          - push(" "), [VALUE], ^RETURN^
              - CR | LF       - [DRAIN], error(terminated completing name/value)
              - !OTHER!       - [DEPLETE], error(bad characters when starting value in URI)
              - !EOF!         - error(Truncated URI missing value for query item.)

      [VALUE]
              - PERCENT       - [ESCAPE]
              - URLCHAR       - push
              - SPECIAL_SLASH - push("/")
              - PLUS          - push(" ")
              - WS            - TRUE->!DoneURI, [SETNV], ^RETURN^
              - AMP           - [SETNV], ^RETURN^
              - CR | LF       - [DRAIN], error(terminated while completing query value)
              - !OTHER!       - [DEPLETE], error(bad characters for value in URI)
              - !EOF!         - error(Truncated URI)

      [SETNV]
      -> pop->$Value
      -> (Set request NV to $Name/$Value
      -> ^RETURN^

      [POST_URI]
              - WS            - burn
              - URLCHAR       - push, [VERSION], ^RETURN^
              - SPECIAL_SLASH - push("/")     , ^RETURN^
              - CR | LF       - [DRAIN], error(terminated without completing VERSION)
              - !OTHER!       - [DEPLETE], error(bad character starting VERSION)
              - !EOF!         - error(No version present.)

      [VERSION]
              - URLCHAR       - push
              - FSLASH        - push
              - CR | LF       - [DRAIN], pop->$Version, ^RETURN^
              - WS            - [DEPLETE], error(spaces after VERSION)
              - !OTHER!       - [DEPLETE], error(bad character in VERSION)
              - !EOF!         - error(Truncated VERSION.)

      [ESCAPE]
              - HEX           - ->$Sixteens, ESCAPEONES, ^RETURN^
              - !OTHER!       - error(broken escape)
              - !EOF!         - error(Truncated line with dangling escape.)

      [ESCAPEONES]
              - HEX           - push( ($SixteensSPLAT16)PLUSHEX ), ^RETURN^
              - !OTHER!       - error(broken escape)
              - !EOF!         - error(Truncated line with dangling escape.)

      [DEPLETE]
              - CR            - [DEPLETE_CR], ^RETURN^
              - !OTHER!       - burn
              - !EOF!         - error(missing CR at end of line)

      [DEPLETE_CR]
              - LF            - ^RETURN^
              - !EOF!         - error(missing LF after CR at end of line: truncated.)
              - !OTHER!       - fault(missing LF after CR at end of line: odd characters found, so stream is unreliable.)

      [DRAIN]
              - LF            - burn, ^RETURN^
              - CR            - burn, ^RETURN^
              - !EOF!         - error(bad CR/LF line termination: truncated.)
              - !OTHER!       - fault(bad CR/LF line termination: odd characters found, so stream is unreliable.)

  Parameters:
    `source` - the stream source.
    `request` - the request object to fill.
  Throws:
    `ThingsException` - If it is a fault, the request should be considered completely invalid. If it is an error, whatever was set in the request might be useful.

### parser

    public void parser(java.io.InputStream ins,
                       HttpRequest request)
                throws ThingsException

  Call with an InputStream.

  Parameters:
    `ins` - the source stream.
    `request` - the request object to fill.
  Throws:
    `ThingsException` - If it is a fault, the request should be considered completely invalid. If it is an error, whatever was set in the request might be useful.

### parser

    public void parser(java.lang.String data,
                       HttpRequest request)
                throws ThingsException

  Call with a String.

  Parameters:
    `data` - the String
    `request` - the request object to fill.
  Throws:
    `ThingsException` - If it is a fault, the request should be considered completely invalid. If it is an error, whatever was set in the request might be useful.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Things.