public ResponseBuilder initialize(final Resource resource) {

        if (MISSING_RESOURCE.equals(resource)) {
            throw new NotFoundException();
        } else if (DELETED_RESOURCE.equals(resource)) {
            throw new ClientErrorException(GONE);
        }

        LOGGER.debug("Acceptable media types: {}", getRequest().getAcceptableMediaTypes());

        this.syntax = getSyntax(getServices().getIOService(),
            getRequest().getAcceptableMediaTypes(), resource.getBinaryMetadata()
                .filter(b -> !DESCRIPTION.equals(getRequest().getExt()))
                .map(b -> b.getMimeType().orElse(APPLICATION_OCTET_STREAM)).orElse(null));

        if (ACL.equals(getRequest().getExt()) && !resource.hasAcl()) {
            throw new NotFoundException();
        }

        setResource(resource);
        return ok();
    }
public ResponseBuilder initialize ( final Resource resource ) { if ( MISSING_RESOURCE . equals ( resource ) ) { throw new NotFoundException ( ) ; } else if ( DELETED_RESOURCE . equals ( resource ) ) { throw new ClientErrorException ( GONE ) ; } LOGGER . debug ( "Acceptable media types: {}" , getRequest ( ) . getAcceptableMediaTypes ( ) ) ; this . syntax = getSyntax ( getServices ( ) . getIOService ( ) , getRequest ( ) . getAcceptableMediaTypes ( ) , resource . getBinaryMetadata ( ) . filter ( b -> ! DESCRIPTION . equals ( getRequest ( ) . getExt ( ) ) ) . map ( b -> b . getMimeType ( ) . orElse ( APPLICATION_OCTET_STREAM ) ) . orElse ( null ) ) ; if ( ACL . equals ( getRequest ( ) . getExt ( ) ) && ! resource . hasAcl ( ) ) { throw new NotFoundException ( ) ; } setResource ( resource ) ; return ok ( ) ; }
Initialize the get handler.
@param resource the Trellis resource
@return the response builder