@SuppressWarnings("unchecked")
    @Override
    protected void afterHandle(final Request request, final Response response)
    {
        super.afterHandle(request, response);
        
        final ConcurrentMap<String, Object> responseAttributes = response.getAttributes();
        
        Series<Header> responseHeaders = (Series<Header>)responseAttributes.get(HeaderConstants.ATTRIBUTE_HEADERS);
        
        if(responseHeaders == null)
        {
            responseHeaders = new Series<Header>(Header.class);
            final Series<Header> putIfAbsent =
                    (Series<Header>)responseAttributes.putIfAbsent(HeaderConstants.ATTRIBUTE_HEADERS, responseHeaders);
            
            if(putIfAbsent != null)
            {
                responseHeaders = putIfAbsent;
            }
        }
        
        // Allow all origins
        responseHeaders.add("Access-Control-Allow-Origin", "*");
    }
@ SuppressWarnings ( "unchecked" ) @ Override protected void afterHandle ( final Request request , final Response response ) { super . afterHandle ( request , response ) ; final ConcurrentMap < String , Object > responseAttributes = response . getAttributes ( ) ; Series < Header > responseHeaders = ( Series < Header > ) responseAttributes . get ( HeaderConstants . ATTRIBUTE_HEADERS ) ; if ( responseHeaders == null ) { responseHeaders = new Series < Header > ( Header . class ) ; final Series < Header > putIfAbsent = ( Series < Header > ) responseAttributes . putIfAbsent ( HeaderConstants . ATTRIBUTE_HEADERS , responseHeaders ) ; if ( putIfAbsent != null ) { responseHeaders = putIfAbsent ; } } responseHeaders . add ( "Access-Control-Allow-Origin" , "*" ) ; }
/*
(non-Javadoc)

@see org.restlet.routing.Filter#afterHandle(org.restlet.Request, org.restlet.Response)