Search in sources :

Example 11 with FatalException

use of com.dexels.navajo.script.api.FatalException in project navajo by Dexels.

the class TmlContinuationRunner method abort.

@Override
public void abort(String reason) {
    super.abort(reason);
    try {
        logger.warn("Aborting: {}. Generating outdoc and resuming", reason);
        setResponseNavajo(getLocalClient().generateAbortMessage(reason));
    } catch (FatalException e) {
        logger.error("Error: ", e);
    }
    continuation.complete();
    getRequest().fail(new ServletException(reason));
}
Also used : ServletException(javax.servlet.ServletException) FatalException(com.dexels.navajo.script.api.FatalException)

Example 12 with FatalException

use of com.dexels.navajo.script.api.FatalException in project navajo by Dexels.

the class TmlContinuationRunner method execute.

/**
 * Handle a request.
 *
 * @param request
 * @param response
 * @throws IOException
 * @throws ServletException
 */
private final void execute() throws IOException, ServletException {
    startedAt = System.currentTimeMillis();
    setCommitted(true);
    // BufferedReader r = null;
    try {
        Navajo in = getInputNavajo();
        in.getHeader().setHeaderAttribute("useComet", "true");
        boolean continuationFound = false;
        try {
            int queueSize = getRequestQueue().getQueueSize();
            String queueId = getRequestQueue().getId();
            ClientInfo clientInfo = getRequest().createClientInfo(scheduledAt, startedAt, queueSize, queueId);
            setResponseNavajo(getLocalClient().handleInternal(getNavajoInstance(), in, getRequest().getCert(), clientInfo));
        } finally {
            if (!continuationFound) {
                // resumeContinuation();
                // continuation.complete();
                endTransaction();
            }
        }
    // }
    } catch (Throwable e) {
        // e.printStackTrace(System.err);
        if (e instanceof FatalException) {
            FatalException fe = (FatalException) e;
            if (fe.getMessage().equals("500.13")) {
                // Server too busy.
                continuation.undispatch();
                throw new ServletException("500.13");
            }
        }
        throw new ServletException(e);
    } finally {
        MDC.clear();
    }
}
Also used : ServletException(javax.servlet.ServletException) FatalException(com.dexels.navajo.script.api.FatalException) Navajo(com.dexels.navajo.document.Navajo) ClientInfo(com.dexels.navajo.script.api.ClientInfo)

Aggregations

FatalException (com.dexels.navajo.script.api.FatalException)12 Navajo (com.dexels.navajo.document.Navajo)11 NavajoException (com.dexels.navajo.document.NavajoException)6 Header (com.dexels.navajo.document.Header)5 AuthorizationException (com.dexels.navajo.script.api.AuthorizationException)5 UserException (com.dexels.navajo.script.api.UserException)5 IOException (java.io.IOException)5 SystemException (com.dexels.navajo.script.api.SystemException)4 TriggerException (com.dexels.navajo.server.enterprise.scheduler.TriggerException)4 ServletException (javax.servlet.ServletException)4 ClientInfo (com.dexels.navajo.script.api.ClientInfo)3 Message (com.dexels.navajo.document.Message)2 Property (com.dexels.navajo.document.Property)2 LocalClient (com.dexels.navajo.script.api.LocalClient)2 PrintWriter (java.io.PrintWriter)2 APIException (com.dexels.navajo.article.APIException)1 AuthenticationMethod (com.dexels.navajo.authentication.api.AuthenticationMethod)1 ClientException (com.dexels.navajo.client.ClientException)1 NavajoRequestEvent (com.dexels.navajo.events.types.NavajoRequestEvent)1 Access (com.dexels.navajo.script.api.Access)1