Package org.apache.tapestry5.services

## Interface ClientDataEncoder

- All Known Implementing Classes:
    `ClientDataEncoderImpl`

      public interface ClientDataEncoder

  A service used when a component or service needs to encode some amount of data on the client as a string. The string may be a query parameter, hidden form field, or a portion of a URL. The default implementation converts the object output stream into a Base64 string. Starting in release 5.3.6, the encoded data incorporates an HMAC (hash based message authentication code) signature, as a prefix. HMAC requires a secret key, configured using the `SymbolConstants.HMAC_PASSPHRASE` symbol.
  Since:
    5.1.0.1

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `ClientDataSink` | `createSink()` | Creates a sink for client data.
    `ObjectInputStream` | `decodeClientData​(String clientData)` | Decodes data previously obtained from `ClientDataSink.getClientData()`.
    `ObjectInputStream` | `decodeEncodedClientData​(String clientData)` | Decodes client data obtained via `ClientDataSink.getEncodedClientData()`.

- - ### Method Detail

    - #### createSink

          ClientDataSink createSink()

      Creates a sink for client data. The sink provides an output stream and ultimately, a string representation of the data sent to the stream.
      Returns:
        a new sink

    - #### decodeClientData

          ObjectInputStream decodeClientData​(String clientData)
                                      throws IOException

      Decodes data previously obtained from `ClientDataSink.getClientData()`.
      Parameters:
        `clientData` - encoded client data
      Returns:
        stream of decoded data
      Throws:
        `IOException` - if the client data has been corrupted (verified via the HMAC)

    - #### decodeEncodedClientData

          ObjectInputStream decodeEncodedClientData​(String clientData)
                                             throws IOException

      Decodes client data obtained via `ClientDataSink.getEncodedClientData()`.
      Parameters:
        `clientData` - URLEncoded client data
      Returns:
        stream of objects
      Throws:
        `IOException` - if the client data has been corrupted (verified via the HMAC)
      Since:
        5.1.0.4