Class DefaultCorsProcessor

    • Constructor Detail

      • DefaultCorsProcessor

        public DefaultCorsProcessor()
    • Method Detail

      • processActualRequest

        public void processActualRequest​(Translet translet)
                                  throws CorsException
        Description copied from interface: CorsProcessor
        Process a simple or actual CORS request.
        Parameters:
        translet - the Translet instance
        Throws:
        CorsException - if the request is invalid or denied
      • processPreflightRequest

        public void processPreflightRequest​(Translet translet)
                                     throws CorsException
        Description copied from interface: CorsProcessor
        Process a preflight CORS request.

        CORS specification: PreflightRequest

        Parameters:
        translet - the Translet instance
        Throws:
        CorsException - if the request is invalid or denied
      • sendError

        public void sendError​(Translet translet)
                       throws java.io.IOException
        Description copied from interface: CorsProcessor
        Sends an error response to the client using the specified status.
        Parameters:
        translet - the Translet instance
        Throws:
        java.io.IOException - in case of I/O errors
      • rejectRequest

        protected void rejectRequest​(Translet translet,
                                     CorsException ce)
                              throws CorsException
        Invoked when one of the CORS checks failed. The default implementation sets the response status to 403.
        Parameters:
        translet - the Translet instance
        ce - the CORS Exception
        Throws:
        CorsException - if the request is denied
      • checkProcessable

        protected boolean checkProcessable​(javax.servlet.http.HttpServletResponse res)