public static RegisteredService getRegisteredService(final HttpServletRequest request) {
        return Optional.ofNullable(request)
            .map(requestContext -> (RegisteredService) request.getAttribute(CasWebflowConstants.ATTRIBUTE_REGISTERED_SERVICE)).orElse(null);
    }
Gets registered service.

@param request the request
@return the registered service
core/cas-server-core-web-api/src/main/java/org/apereo/cas/web/support/WebUtils.java