### php.java.bridge

# Class Response

- `java.lang.Object`

- `php.java.bridge.Response`

`public class Response`
`extends java.lang.Object`

This class is used to write the response to the frontent.

Author:
  jostb

## Field Summary

`static int`

`COERCE_WRITER`
  A specialized writer which casts the value.

`static int`

`VALUES_WRITER`
  A specialized writer which writes arrays as values.

## Constructor Summary

`Response(JavaBridge bridge)`
  Creates a new response object.

## Method Summary

`void`

`flush()`
  Write the response.

`php.java.bridge.Response.Writer`

`selectWriter(int writerType)`
  Selects a different writer.

`void`

`setResult(java.lang.Object value, java.lang.Class type)`
  Set the result packet.

`java.lang.String`

`toString()`

### Methods inherited from class java.lang.Object

`equals`, `getClass`, `hashCode`, `notify`, `notifyAll`, `toString`, `wait`, `wait`, `wait`

## Field Details

### COERCE_WRITER

    public static final int COERCE_WRITER

> A specialized writer which casts the value. Used by cast().

> Field Value:
>   2

> See Also:
>   `JavaBridge.cast(Object,Class)`

### VALUES_WRITER

    public static final int VALUES_WRITER

> A specialized writer which writes arrays as values. Used by getValues() and in php 4.

> Field Value:
>   1

> See Also:
>   `JavaBridge.getValues(Object)`

## Constructor Details

### Response

    public Response(JavaBridge bridge)

> Creates a new response object. The object is re-used for each packed.

> Parameters:
>   `bridge` - The bridge.

## Method Details

### flush

    public void flush()
                throws java.io.IOException

> Write the response.

> Throws:
>   `java.io.IOException` -

### selectWriter

    public php.java.bridge.Response.Writer selectWriter(int writerType)

> Selects a different writer.

> Parameters:
>   `writerType` - Must be Response#VALUES_WRITER or Response#COERCE_WRITER.

> Returns:
>   The seleted writer.

> See Also:
>   `VALUES_WRITER`, `COERCE_WRITER`

### setResult

    public void setResult(java.lang.Object value,
                          java.lang.Class type)

> Set the result packet.

> Parameters:
>   `value` - The result object.
>   `type` - The type of the result object.

### toString

    public java.lang.String toString()

> Overrides:
>   toString in interface java.lang.Object