Examples of FilterException


Examples of org.asynchttpclient.filter.FilterException

            long startOfWait = System.currentTimeMillis();
            attemptConcurrencyPermitAcquistion(ctx);

            attemptRateLimitedPermitAcquistion(ctx, startOfWait);
        } catch (InterruptedException e) {
            throw new FilterException(String.format("Interrupted Request %s with AsyncHandler %s", ctx.getRequest(), ctx.getAsyncHandler()));
        }

        return new FilterContext.FilterContextBuilder<T>(ctx).asyncHandler(new AsyncHandlerWrapper<T>(ctx.getAsyncHandler(), available))
                .build();
    }
View Full Code Here

Examples of org.asynchttpclient.filter.FilterException

    private <T> void attemptRateLimitedPermitAcquistion(FilterContext<T> ctx, long startOfWait) throws FilterException {
        long wait = getMillisRemainingInMaxWait(startOfWait);

        if (!rateLimiter.tryAcquire(wait, TimeUnit.MILLISECONDS)) {
            throw new FilterException(String.format("Wait for rate limit exceeded during processing Request %s with AsyncHandler %s",
                    ctx.getRequest(), ctx.getAsyncHandler()));
        }
    }
View Full Code Here

Examples of org.asynchttpclient.filter.FilterException

        }
    }

    private <T> void attemptConcurrencyPermitAcquistion(FilterContext<T> ctx) throws InterruptedException, FilterException {
        if (!available.tryAcquire(maxWaitMs, TimeUnit.MILLISECONDS)) {
            throw new FilterException(String.format("No slot available for processing Request %s with AsyncHandler %s", ctx.getRequest(),
                    ctx.getAsyncHandler()));
        }
    }
View Full Code Here

Examples of org.asynchttpclient.filter.FilterException

        try {
            if (logger.isDebugEnabled()) {
                logger.debug("Current Throttling Status {}", available.availablePermits());
            }
            if (!available.tryAcquire(maxWait, TimeUnit.MILLISECONDS)) {
                throw new FilterException(String.format("No slot available for processing Request %s with AsyncHandler %s",
                        ctx.getRequest(), ctx.getAsyncHandler()));
            }
        } catch (InterruptedException e) {
            throw new FilterException(String.format("Interrupted Request %s with AsyncHandler %s", ctx.getRequest(), ctx.getAsyncHandler()));
        }

        return new FilterContext.FilterContextBuilder<T>(ctx).asyncHandler(new AsyncHandlerWrapper<T>(ctx.getAsyncHandler(), available))
                .build();
    }
View Full Code Here

Examples of org.openengsb.core.api.remote.FilterException

            byte[] sessionKeyData = CipherUtils.decrypt(encryptedKey, privateKeySource.getPrivateKey());
            sessionKey = CipherUtils.deserializeSecretKey(sessionKeyData, secretKeyAlgorithm);
            LOGGER.trace("decrypting message using session-key");
            decryptedMessage = CipherUtils.decrypt(input.getEncryptedContent(), sessionKey);
        } catch (DecryptionException e) {
            throw new FilterException(e);
        }
        LOGGER.debug("forwarding decrypted message to next filter {}", next);
        byte[] plainResult = (byte[]) next.filter(decryptedMessage, metaData);
        try {
            LOGGER.trace("encrypting result using previously decrypted session-key");
            return CipherUtils.encrypt(plainResult, sessionKey);
        } catch (EncryptionException e) {
            throw new FilterException(e);
        }
    }
View Full Code Here

Examples of org.openengsb.core.api.remote.FilterException

        MethodCallMessage request;
        try {
            LOGGER.trace("attempt to read SecureRequest from inputData");
            request = mapper.readValue(input, MethodCallMessage.class);
        } catch (IOException e) {
            throw new FilterException(e);
        }
        String callId = request.getCallId();
        LOGGER.info("extracted callId \"{}\" from message", callId);
        metaData.put("callId", callId);
        LOGGER.debug("converting arguments of inputmessage");
        JsonUtils.convertAllArgs(request);
        LOGGER.debug("invoking next filter: {}", next.getClass().getName());
        MethodResultMessage response = (MethodResultMessage) next.filter(request, metaData);
        LOGGER.debug("response received for callId {}: {}. serializing to json", callId, response);
        try {
            return mapper.writeValueAsBytes(response);
        } catch (IOException e) {
            throw new FilterException(e);
        }

    }
View Full Code Here

Examples of org.openengsb.core.api.remote.FilterException

        String className = input.getCredentials().getClassName();
        Class<? extends Credentials> credentialType;
        try {
            credentialType = loadCredentialsType(className);
        } catch (ClassNotFoundException e) {
            throw new FilterException(e);
        }
        try {
            authenticationContext.login(input.getPrincipal(), input.getCredentials().toObject(credentialType));
        } catch (AuthenticationException e) {
            throw new FilterException(e);
        }
        LOGGER.debug("authenticated");
        return (MethodResultMessage) next.filter(input, metaData);
    }
View Full Code Here

Examples of org.openengsb.core.api.remote.FilterException

        if (next instanceof String) {
            try {
                Class<?> class1 = Class.forName((String) next);
                return createFromClass(class1);
            } catch (ClassNotFoundException e) {
                throw new FilterException(e);
            }
        }
        if (next instanceof Class) {
            return createFromClass(next);
        }
View Full Code Here

Examples of org.openengsb.core.api.remote.FilterException

    public Document doFilter(Document input, Map<String, Object> metadata) throws FilterException {
        MethodCallMessage call;
        try {
            call = parseMethodCall(input);
        } catch (JAXBException e) {
            throw new FilterException(e);
        }
        MethodResultMessage result = (MethodResultMessage) next.filter(call, metadata);
        return serializeResult(result);
    }
View Full Code Here

Examples of org.openengsb.core.api.remote.FilterException

            Marshaller marshaller = jaxbContext.createMarshaller();
            marshaller.marshal(new JAXBElement<MethodResultMessage>(
                new QName(MethodResultMessage.class.getSimpleName()),
                MethodResultMessage.class, result), domResult);
        } catch (JAXBException e) {
            throw new FilterException(e);
        } catch (ClassNotFoundException e) {
            throw new FilterException(e);
        }
        return (Document) domResult.getNode();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.