protected synchronized OutboundEndpoint getEndpoint(MuleEvent event, String endpointUri) throws MuleException { try { return endpointCache.get(endpointUri); } catch (Exception e) { throw new DefaultMuleException(e); } }
@Override public void discardMessageOnThrottlingExceeded() throws MuleException { try { sendFailureResponseToClient(MESSAGE_DISCARD_STATUS_CODE, MESSAGE_THROTTLED_REASON_PHRASE); } catch (IOException e) { throw new DefaultMuleException(e); } }
@Override public MessageProcessor getMessageProcessor(final String url, final OperationOptions operationOptions, final MessageExchangePattern exchangePattern) throws MuleException { try { return cachedMessageProcessors.get(new HttpRequestCacheKey(url, operationOptions, exchangePattern)); } catch (ExecutionException e) { throw new DefaultMuleException(e); } }
private int toInt(MuleEvent event, Object source) throws MuleException { try { return (Integer) this.evaluateAndTransform(muleContext, event, Integer.class, null, source); } catch (Exception e) { throw new DefaultMuleException("Error evaluating paging expressions " + source, e); } }
@Override public void start() throws MuleException { try { super.onStart(); } catch (Exception e0) { throw new DefaultMuleException(e0); } }
@Override public MuleEvent beforeRouteEvent(MuleEvent muleEvent) throws MuleException { try { sendExpect100(request); return muleEvent; } catch (IOException e) { throw new DefaultMuleException(e); } }
/** * @return the authentication configuration */ public HttpAuthentication build() throws MuleException { try { basicAuthentication.initialise(); } catch (InitialisationException e) { throw new DefaultMuleException(e); } return basicAuthentication; }
/** * Create an SimpleCallableJavaComponent instance using an object class. This * class should implement {@link Callable}. * * @param callable * @throws DefaultMuleException if the Class specified does not implement * {@link Callable} */ public SimpleCallableJavaComponent(Class callable) throws DefaultMuleException { if (!(Callable.class.isAssignableFrom(callable))) { throw new DefaultMuleException(CoreMessages.objectNotOfCorrectType(callable, Callable.class)); } objectFactory = new SingletonObjectFactory(callable); }
private Connector createConnector() throws MuleException { if (connector!= null) { return this.connector; } MuleRegistry muleRegistry = muleContext.getRegistry(); Connector httpConnector = muleRegistry.lookupConnector("connector.http.mule.default"); if (httpConnector!= null) { return httpConnector; } else { LOGGER.error("Could not find connector with name 'connector.http.mule.default'"); throw new DefaultMuleException("Could not find connector with name 'connector.http.mule.default'"); } }
@Override public void discardMessageOnThrottlingExceeded() throws MuleException { try { servletResponseWriter.writeNonHtmlErrorResponse(servletResponse, 429, "API calls exceeded", httpThrottlingHeadersMapBuilder.build()); } catch (Exception e) { throw new DefaultMuleException(e); } }
private Connector lookupDefaultHttpTransport() throws MuleException { Connector httpConnector = muleContext.getRegistry().lookupConnector("connector.http.mule.default"); if (httpConnector != null) { return httpConnector; } else { throw new DefaultMuleException("Could not find connector with name 'connector.http.mule.default'"); } }
@Override public void stop() throws MuleException { try { quartzScheduler.pauseAll(); } catch (SchedulerException e) { throw new DefaultMuleException(couldNotPauseSchedulers(), e); } }
public boolean isStarted() throws MuleException { try { return quartzScheduler.isStarted(); } catch (SchedulerException e) { throw new DefaultMuleException(couldNotGetSchedulerStatus(), e); } }
@Override public byte[] getMessageAsBytes() throws DefaultMuleException { try { return message.getPayloadAsBytes(); } catch (Exception e) { throw new DefaultMuleException(CoreMessages.cannotReadPayloadAsBytes(message.getPayload() .getClass() .getName()), e); } }
public SimpleCallableJavaComponent(ObjectFactory objectFactory) throws DefaultMuleException { if (!(Callable.class.isAssignableFrom(objectFactory.getObjectClass()))) { throw new DefaultMuleException(CoreMessages.objectNotOfCorrectType(objectFactory.getObjectClass(), Callable.class)); } this.objectFactory = objectFactory; }
@Override public void discardInvalidMessage() throws MuleException { if (badRequest) { try { httpServerConnection.writeResponse(doBad(requestLine)); } catch (IOException e) { throw new DefaultMuleException(e); } } }
private void setStatus(HttpResponse response, MuleMessage message) throws MuleException { if(status != null) { try { response.setStatusLine(HttpVersion.parse(version), Integer.valueOf(parse(status, message))); } catch(ProtocolException e) { throw new DefaultMuleException(e); } } }
/** * The method will be called, when file transferring was canceled */ @Override public void cancelled() { super.cancelled(); close(); responseStatusCallback.responseSendFailure(new DefaultMuleException(createStaticMessage("HTTP response sending task was cancelled"))); resume(); }
public HttpListenerConfig build() throws MuleException { try { this.muleContext.getRegistry().registerObject(this.config.getName(), this.config); this.config.initialise(); this.config.start(); return this.config; } catch (Exception e) { throw new DefaultMuleException(e); } } }
@Override public void sendFailureResponseToClient(MessagingException messagingException) throws MuleException { try { int statusCode = retrieveStatusCode(messagingException); servletResponseWriter.writeErrorResponse(servletResponse, messagingException.getEvent().getMessage(), statusCode, messagingException.getMessage(), httpThrottlingHeadersMapBuilder.build()); } catch (Exception e) { throw new DefaultMuleException(e); } failureResponseSentToClient = true; }