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.
    `java.io.ObjectInputStream` | `decodeClientData​(java.lang.String clientData)` | Decodes data previously obtained from `ClientDataSink.getClientData()`.
    `java.io.ObjectInputStream` | `decodeEncodedClientData​(java.lang.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

          java.io.ObjectInputStream decodeClientData​(java.lang.String clientData)
                                              throws java.io.IOException

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

    - #### decodeEncodedClientData

          java.io.ObjectInputStream decodeEncodedClientData​(java.lang.String clientData)
                                                     throws java.io.IOException

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