## php.java.bridge
Class Request

    java.lang.Object
      php.java.bridge.Request

All Implemented Interfaces:
  IDocHandler

    public final class Request

extends java.lang.Object
implements IDocHandler

This class is used to handle requests from the front-end.

Author:
  jostb

Field Summary
`Response` `response` The current response handle or null.

Constructor Summary
`Request(JavaBridge bridge)` Creates an empty request object.

Method Summary
`void` `begin(ParserTag[] tag)` Called for each <tag arg1 ...
`ParserString` `createParserString()` Create a parser string, according to options
`void` `end(ParserString[] string)` Called for each </tag>
`void` `handleRequests()` Start handling requests until EOF.
`boolean` `init(java.io.InputStream in, java.io.OutputStream out)` This method must be called with the current input and output streams.
`void` `recycle()` re-initialize for new requests
`void` `reset()` Reset the internal state so that a new input and output stream can be used for the next packed.

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

Field Detail

### response

    public Response response

  The current response handle or null. There is only one response handle for each request object. `response.reset()` or `response.flush()` must be called at the end of each packet.

Constructor Detail

### Request

    public Request(JavaBridge bridge)

  Creates an empty request object.

  Parameters:
    `bridge` - The bridge instance.
  See Also:
    `init(InputStream, OutputStream)`

Method Detail

### init

    public boolean init(java.io.InputStream in,
                        java.io.OutputStream out)
                 throws java.io.IOException

  This method must be called with the current input and output streams. It reads the protocol header and initializes the request object.

  Parameters:
    `in` - The input stream.
    `out` - The output stream.
  Returns:
    true, if the protocol header was valid, false otherwise.
  Throws:
    `java.io.IOException`

### begin

    public void begin(ParserTag[] tag)

  Description copied from interface: `IDocHandler`
  Called for each <tag arg1 ... argn>

  Specified by:
    `begin` in interface `IDocHandler`
  Parameters:
    `tag` - The tag and the args.

### end

    public void end(ParserString[] string)

  Description copied from interface: `IDocHandler`
  Called for each </tag>

  Specified by:
    `end` in interface `IDocHandler`
  Parameters:
    `string` - The tag and the args.
  See Also:
    `IDocHandler.begin(ParserTag[])`

### handleRequests

    public void handleRequests()
                        throws java.io.IOException

  Start handling requests until EOF. Creates a response object and handles all packets.

  Throws:
    `java.io.IOException`

### reset

    public void reset()

  Reset the internal state so that a new input and output stream can be used for the next packed. Note that request options (from init()) remain valid.

  See Also:
    `init(InputStream, OutputStream)`

### recycle

    public void recycle()

  re-initialize for new requests

### createParserString

    public ParserString createParserString()

  Create a parser string, according to options

  Specified by:
    `createParserString` in interface `IDocHandler`
  Returns:
    The parser string