Examples of ErrorHandler


Examples of org.mojavemvc.exception.ErrorHandler

    }
   
    @Test
    public void handleError_NullException() throws Exception {

        ErrorHandler errorHandler = new DefaultErrorHandler();
        View view = errorHandler.handleError(null, properties);

        assertTrue(view instanceof PlainText);
        PlainText stackTrace = (PlainText) view;
        assertEquals("", stackTrace.toString());
    }
View Full Code Here

Examples of org.mojavemvc.exception.ErrorHandler

    @Test
    public void handleError_WithException() throws Exception {

        Exception e = new Exception("testing");
       
        ErrorHandler errorHandler = new DefaultErrorHandler();
        View view = errorHandler.handleError(e, properties);

        assertTrue(view instanceof PlainText);
        PlainText stackTrace = (PlainText) view;
        assertTrue(stackTrace.toString().startsWith("java.lang.Exception: testing"));
    }
View Full Code Here

Examples of org.mojavemvc.exception.ErrorHandler

   
    @Test
    public void createErrorHandler() throws Exception {

        DefaultErrorHandlerFactory factory = new DefaultErrorHandlerFactory();
        ErrorHandler errorHandler = factory.createErrorHandler();

        assertTrue(errorHandler instanceof DefaultErrorHandler);
    }
View Full Code Here

Examples of org.mojavemvc.exception.ErrorHandler

            throws ServletException, IOException {
       
        ControllerDatabase controllerDb = (ControllerDatabase) ctx.getAttribute(ControllerDatabase.KEY);

        ErrorHandlerFactory errorHandlerFactory = (ErrorHandlerFactory) ctx.getAttribute(ErrorHandlerFactory.KEY);
        ErrorHandler errorHandler = errorHandlerFactory.createErrorHandler();

        Injector injector = (Injector) ctx.getAttribute(GuiceInitializer.KEY);
        AppProperties properties = (AppProperties) ctx.getAttribute(AppProperties.KEY);

        ServletResourceModule.set(req, res);

        View view;
        try {
           
            RequestRouter router = new HttpRequestRouter(path,
                    new HttpParameterMapSource(req), controllerDb.getRouter());
           
            RoutedRequest routed = router.route();
           
            ActionResolver resolver = new HttpActionResolver(ctx, req, httpMethod, controllerDb, injector);
   
            ActionInvoker invoker = new HttpActionInvoker(req, res, controllerDb, routed, injector);
   
            RequestProcessor requestProcessor = new RequestProcessor(resolver, invoker, errorHandler);
           
            view = requestProcessor.process(routed.getController(), routed.getAction(), properties);
   
            logger.debug("processed request for " + requestProcessor.getControllerClassName() + "; rendering...");

            view.render(req, res, properties);

        } catch (Throwable e) {

            logger.error("error processing request: ", e);
            view = errorHandler.handleError(e, properties);
            if (view != null) {
                /*
                 * we're not catching any exceptions thrown from rendering the
                 * error view
                 */
 
View Full Code Here

Examples of org.mortbay.jetty.handler.ErrorHandler

            code!=SC_PARTIAL_CONTENT &&
            code>=SC_OK)
        {
            Request request = _connection.getRequest();

            ErrorHandler error_handler = null;
            ContextHandler.SContext context = request.getContext();
            if (context!=null)
                error_handler=context.getContextHandler().getErrorHandler();
            if (error_handler!=null)
            {
                // TODO - probably should reset these after the request?
                request.setAttribute(ServletHandler.__J_S_ERROR_STATUS_CODE,new Integer(code));
                request.setAttribute(ServletHandler.__J_S_ERROR_MESSAGE, message);
                request.setAttribute(ServletHandler.__J_S_ERROR_REQUEST_URI, request.getRequestURI());
                request.setAttribute(ServletHandler.__J_S_ERROR_SERVLET_NAME,request.getServletName());
               
                error_handler.handle(null,_connection.getRequest(),this, Handler.ERROR);
            }
            else
            {
                setHeader(HttpHeaders.CACHE_CONTROL, "must-revalidate,no-cache,no-store");
                setContentType(MimeTypes.TEXT_HTML_8859_1);
View Full Code Here

Examples of org.openjena.riot.ErrorHandler

           
        in = new FileInputStream("data.trig") ;
        LangRIOT parser = RiotReader.createParserQuads(in, Lang.TRIG, "http://example/base", noWhere) ;
       
        // Parser to first error or warning.
        ErrorHandler errHandler = ErrorHandlerFactory.errorHandlerStrict ;

        // Now enable stricter checking, even N-TRIPLES must have absolute URIs.
        ParserProfile profile = RiotLib.profile(baseURI, true, true, errHandler) ;

        // Just set the error handler.
View Full Code Here

Examples of org.openjena.riot.ErrorHandler

    static ParserProfile profile()
    {
        // TODO
        // Don't do anything with IRIs.
        Prologue prologue = new Prologue(new PrefixMap(), IRIResolver.createNoResolve()) ;
        ErrorHandler handler = ErrorHandlerFactory.getDefaultErrorHandler() ;
        ParserProfile profile = new ParserProfileBase(prologue, handler) ;
        profile.setLabelToNode(LabelToNode.createUseLabelAsGiven()) ;
        // Include safe bNode labels.
        return profile ;
    }
View Full Code Here

Examples of org.qi4j.library.rest.client.api.ErrorHandler

        ContextResourceClientFactory contextResourceClientFactory = module.newObject( ContextResourceClientFactory.class, client );
        contextResourceClientFactory.setAcceptedMediaTypes( MediaType.APPLICATION_JSON );
        //END SNIPPET: client-create1

        //START SNIPPET: client-create2
        contextResourceClientFactory.setErrorHandler( new ErrorHandler().onError( ErrorHandler.AUTHENTICATION_REQUIRED, new ResponseHandler()
        {
            boolean tried = false;

            @Override
            public HandlerCommand handleResponse( Response response, ContextResourceClient client )
View Full Code Here

Examples of org.springframework.util.ErrorHandler

        }

        if (errorHandler != null) {
            container.setErrorHandler(errorHandler);
        } else {
            ErrorHandler handler = new DefaultSpringErrorHandler(EndpointMessageListener.class, getErrorHandlerLoggingLevel(), isErrorHandlerLogStackTrace());
            container.setErrorHandler(handler);
        }

        container.setAcceptMessagesWhileStopping(acceptMessagesWhileStopping);
        container.setExposeListenerSession(exposeListenerSession);
View Full Code Here

Examples of org.springframework.util.ErrorHandler

        }

        if (errorHandler != null) {
            container.setErrorHandler(errorHandler);
        } else {
            ErrorHandler handler = new DefaultSpringErrorHandler(EndpointMessageListener.class, getErrorHandlerLoggingLevel(), isErrorHandlerLogStackTrace());
            container.setErrorHandler(handler);
        }

        container.setAcceptMessagesWhileStopping(acceptMessagesWhileStopping);
        container.setExposeListenerSession(exposeListenerSession);
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.