Package org.takes.tk

Class TkCors

  • All Implemented Interfaces:
    Take

    public final class TkCors
    extends Object
    implements Take
    CORS take.

    This take checks if the request (Origin) is allowed to perform the desired action against the list of the given domains.

    The specification of CORS can be found on the W3C web site on the following link or even on the RFC-6454 specification.

    Since:
    0.20
    • Constructor Detail

      • TkCors

        public TkCors​(Take take,
                      String... domains)
        Ctor.
        Parameters:
        take - Original
        domains - Allow domains
    • Method Detail

      • act

        public Response act​(Request req)
                     throws Exception
        Description copied from interface: Take
        Convert request to response.
        Specified by:
        act in interface Take
        Parameters:
        req - Request to process
        Returns:
        Response
        Throws:
        Exception - If fails