Interface SelfResponseFactory

All Superinterfaces:
Response
All Known Implementing Classes:
PathArgumentParseException

public interface SelfResponseFactory extends Response
Implementations of this interface can be returned as a response without using a specialized factory, but instead of implementing the Response interface manually, they just produce another Response instance. This simplifies re-using a standard response implementation for specific cases without registering a custom factory.
  • Method Summary

    Modifier and Type
    Method
    Description
    Creates the response.
    default void
    transmit(ResponseTransmitter responseTransmitter)
    Transmits this response using the specified response transmitter.
  • Method Details

    • createResponse

      Response createResponse()
      Creates the response.
      Returns:
      the response
    • transmit

      default void transmit(ResponseTransmitter responseTransmitter) throws IOException
      Description copied from interface: Response
      Transmits this response using the specified response transmitter.

      Note: This method only takes the response transmitter. If the implementation has to access other things from the RequestCycle to transmit itself, e.g. access request parameters on-the-fly, then these things have to be passed to the implementation by another mechanism. This interface tries to keep the dependency between the two minimal.

      Specified by:
      transmit in interface Response
      Parameters:
      responseTransmitter - the response transmitter that is used to actually send data to the client
      Throws:
      IOException - on I/O errors