Package com.betfair.cougar.core.api.ev

Examples of com.betfair.cougar.core.api.ev.InterceptorResult


    @Override
    public InterceptorResult invoke(ExecutionContext ctx, OperationKey key, Object[] args) {
        if (key.getType() == OperationKey.Type.Request) {
            GeoLocationDetails geoDetails = ctx.getLocation();
            if (geoDetails == null) {
                return new InterceptorResult(InterceptorState.FORCE_ON_EXCEPTION,
                        new CougarServiceException(ServerFaultCode.SecurityException, "Geo location details were not provided"));
            } else if (banList.contains(geoDetails.getResolvedAddresses().get(0))) {
                return new InterceptorResult(InterceptorState.FORCE_ON_EXCEPTION,
                        new CougarServiceException(ServerFaultCode.SecurityException, "The IP Address [" + geoDetails.getRemoteAddr() + "] is not permitted to access to this service"));
            }
        }
        return new InterceptorResult(InterceptorState.CONTINUE);
    }
View Full Code Here


    @Override
    public InterceptorResult invoke(ExecutionContext ctx, OperationKey key, Object[] args) {
        if (key.getType() == OperationKey.Type.Request) {
            GeoLocationDetails geoDetails = ctx.getLocation();
            if (geoDetails == null) {
                return new InterceptorResult(InterceptorState.FORCE_ON_EXCEPTION,
                        new CougarServiceException(ServerFaultCode.SecurityException, "Geo location details were not provided"));
            } else if (banList.contains(geoDetails.getResolvedAddresses().get(0))) {
                return new InterceptorResult(InterceptorState.FORCE_ON_EXCEPTION,
                        new CougarServiceException(ServerFaultCode.SecurityException, "The IP Address [" + geoDetails.getRemoteAddr() + "] is not permitted to access to this service"));
            }
        }
        return new InterceptorResult(InterceptorState.CONTINUE);
    }
View Full Code Here

* it will throw a SimpleException ...
*/
public class CheckedExceptionPreProcInterceptor implements ExecutionPreProcessor {
    @Override
    public InterceptorResult invoke(ExecutionContext ctx, OperationKey key, Object[] args) {
        InterceptorResult result;

        if (key.getOperationName().equals("interceptorCheckedExceptionOperation") &&
            ((PreOrPostInterceptorException)args[0]) == PreOrPostInterceptorException.PRE) {

            result = new InterceptorResult(InterceptorState.FORCE_ON_EXCEPTION,
                    new SimpleException(ResponseCode.BadRequest,
                            SimpleExceptionErrorCodeEnum.GENERIC,
                            "An anticipated pre-execution BSIDL defined checked exception"));
        } else {
            result = new InterceptorResult(InterceptorState.CONTINUE);
        }
        return result;
    }
View Full Code Here

TOP

Related Classes of com.betfair.cougar.core.api.ev.InterceptorResult

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.