Пример #1
0
  public void onException(ErrorMessage msg) throws MuleException {
    Class eClass = null;
    ExceptionHandler eh = null;

    try {
      eClass = msg.getException().toException().getClass();
      eh = getHandler(eClass);
      eh.onException(msg);
    } catch (Exception e) {
      logger.error(e);

      if (eh instanceof DefaultHandler) {
        logger.error(LocaleMessage.defaultFatalHandling(FatalHandler.class));
        handleFatal(e);

      } else if (eh instanceof FatalHandler) {
        logger.fatal(LocaleMessage.fatalHandling(e));
        MuleServer.getMuleContext().dispose();
        System.exit(-1);
      } else {
        logger.error(LocaleMessage.defaultHandling(DefaultHandler.class, eh, e));
        handleDefault(msg, e);
      }
    }
  }
Пример #2
0
 private void handleFatal(Throwable t) {
   // If this method has been called, all other handlers failed
   // this is all we can do
   logger.fatal(LocaleMessage.fatalException(t), t);
   MuleServer.getMuleContext().dispose();
   System.exit(-1);
 }
Пример #3
0
 public Object process(Object object) {
   if (object instanceof ManagementContextAware) {
     if (context == null) {
       context = MuleServer.getManagementContext();
       if (context == null) {
         // todo
         throw new NullPointerException("manContext is null");
       }
     }
     ((ManagementContextAware) object).setManagementContext(context);
   }
   return object;
 }
Пример #4
0
    public HttpWorker(Socket socket) throws IOException {
      String encoding = endpoint.getEncoding();
      if (encoding == null) {
        encoding = MuleServer.getMuleContext().getConfiguration().getDefaultEncoding();
      }

      conn = new HttpServerConnection(socket, encoding, (HttpConnector) connector);

      cookieSpec =
          MapUtils.getString(
              endpoint.getProperties(),
              HttpConnector.HTTP_COOKIE_SPEC_PROPERTY,
              ((HttpConnector) connector).getCookieSpec());
      enableCookies =
          MapUtils.getBooleanValue(
              endpoint.getProperties(),
              HttpConnector.HTTP_ENABLE_COOKIES_PROPERTY,
              ((HttpConnector) connector).isEnableCookies());

      final SocketAddress clientAddress = socket.getRemoteSocketAddress();
      if (clientAddress != null) {
        remoteClientAddress = clientAddress.toString();
      }
    }