Interface CorsResponseAdapter<T>

Type Parameters:
T - the type of the response wrapped by the adapter

@Deprecated(forRemoval=true, since="4.4.0") public interface CorsResponseAdapter<T>
Deprecated, for removal: This API element is subject to removal in a future version.
this module will be removed, CORS configuration is centralized to module helidon-webserver-cors with io.helidon.webserver.cors.CorsFeature either from ServiceRegistry, or through one of the feature's static factory or builder methods; paths configured in config are registered first, before paths configured through service registry; this class will be removed in a future version of Helidon
Not for use by developers. Minimal abstraction of an HTTP response.

Note to implementers: In some use cases, the CORS support code will invoke the header methods but not ok or forbidden. See to it that header values set on the adapter via the header methods are propagated to the actual response.

  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    Deprecated, for removal: This API element is subject to removal in a future version.
    Clear CORS headers from the response.
    forbidden(String message)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Returns a response with the forbidden status and the specified error message, without any headers assigned using the header methods.
    header(HeaderName key, Object value)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Arranges to add the specified header and value to the eventual response.
    header(HeaderName key, String value)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Arranges to add the specified header and value to the eventual response.
    ok()
    Deprecated, for removal: This API element is subject to removal in a future version.
    Returns a response with only the headers that were set on this adapter and the status set to OK.
    int
    Deprecated, for removal: This API element is subject to removal in a future version.
    Returns the status of the response.
  • Method Details

    • header

      CorsResponseAdapter<T> header(HeaderName key, String value)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Arranges to add the specified header and value to the eventual response.
      Parameters:
      key - header name to add
      value - header value to add
      Returns:
      the adapter
    • header

      CorsResponseAdapter<T> header(HeaderName key, Object value)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Arranges to add the specified header and value to the eventual response.
      Parameters:
      key - header name to add
      value - header value to add
      Returns:
      the adapter
    • forbidden

      T forbidden(String message)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Returns a response with the forbidden status and the specified error message, without any headers assigned using the header methods.
      Parameters:
      message - error message to use in setting the response status
      Returns:
      the factory
    • ok

      T ok()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Returns a response with only the headers that were set on this adapter and the status set to OK.
      Returns:
      response instance
    • status

      int status()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Returns the status of the response.
      Returns:
      HTTP status code.
    • clearCorsHeaders

      default void clearCorsHeaders()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Clear CORS headers from the response.