Examples of SendErrorResponse


Examples of org.jboss.dashboard.ui.controller.responses.SendErrorResponse

        log.debug("Retrieving resource " + name);
        Resource res = UIServices.lookup().getResourceManager().getResource(name);
        if (res != null)
            return res.getResourceAsResponse();
        log.warn("Not found resource " + name + " (" + new String(Base64.decode(name)) + ") ");
        return new SendErrorResponse(404);
    }
View Full Code Here

Examples of org.jboss.dashboard.ui.controller.responses.SendErrorResponse

    }

    public CommandResponse getResourceAsResponse() {
        if (file == null || !file.exists()) {
            log.debug("Resource does not exist: " + file);
            return new SendErrorResponse(HttpServletResponse.SC_NOT_FOUND);
        }
        try {
            return new SendStreamResponse(file);
        } catch (Exception e) {
            log.error("Failed to return resource named " + resName, e);
            return new SendErrorResponse(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
        }
    }
View Full Code Here

Examples of org.jboss.dashboard.ui.controller.responses.SendErrorResponse

            if (cmdResponse != null) {
                // Set successful response
                requestContext.setResponse(cmdResponse);
            } else {
                // Response parameters missing or wrong action
                requestContext.setResponse(new SendErrorResponse(HttpServletResponse.SC_NOT_FOUND));
            }
        } catch (Exception e) {
            // Handler response error
            ErrorManager.lookup().notifyError(e, true);
            requestContext.setResponse(new SendErrorResponse(HttpServletResponse.SC_INTERNAL_SERVER_ERROR));
        }
        return true;
    }
View Full Code Here

Examples of org.jboss.dashboard.ui.controller.responses.SendErrorResponse

            PanelPermission panelPerm = PanelPermission.newInstance(currentPanel, PanelPermission.ACTION_VIEW);
            SectionPermission sectionPerm = SectionPermission.newInstance(currentPanel, SectionPermission.ACTION_VIEW);
            WorkspacePermission workspacePermission = WorkspacePermission.newInstance(currentPanel, WorkspacePermission.ACTION_LOGIN);
            if (!userStatus.hasPermission(panelPerm) || !userStatus.hasPermission(sectionPerm) || !userStatus.hasPermission(workspacePermission)) {
                // Forbidden access response
                setResponse(new SendErrorResponse(HttpServletResponse.SC_FORBIDDEN));
            }

            // Make sure the chart displays no filtered data.
            DashboardHandler.lookup().getCurrentDashboard().unfilter();
View Full Code Here

Examples of org.jboss.dashboard.ui.controller.responses.SendErrorResponse

        if (memoryProfiler.isLowMemory()) {
            log.warn("Memory is running low ...");
            memoryProfiler.freeMemory();
            if (memoryProfiler.isLowMemory()) {
                RequestContext requestContext = RequestContext.lookup();
                requestContext.setResponse(new SendErrorResponse(503));
                requestContext.consumeURIPart(requestContext.getURIToBeConsumed());
                log.error("Memory is so low that the request had to be canceled - 503 sent. Consider increasing the JVM memory.");
                return false;
            }
        }
View Full Code Here

Examples of org.jboss.dashboard.ui.controller.responses.SendErrorResponse

        log.debug("Retrieving resource " + name);
        Resource res = UIServices.lookup().getResourceManager().getResource(name);
        if (res != null)
            return res.getResourceAsResponse();
        log.warn("Not found resource " + name + " (" + new String(Base64.decode(name)) + ") ");
        return new SendErrorResponse(404);
    }
View Full Code Here

Examples of org.jboss.dashboard.ui.controller.responses.SendErrorResponse

            log.warn("Memory is running low ...");
            freeSomeMemory(freeMemory, totalMemory);
            freeMemory = Runtime.getRuntime().freeMemory();
            totalMemory = Runtime.getRuntime().totalMemory();
            if (isLowMemory(freeMemory, totalMemory)) {
                getControllerStatus().setResponse(new SendErrorResponse(503));
                getControllerStatus().consumeURIPart(getControllerStatus().getURIToBeConsumed());
                log.error("Memory is so low that a user request had to be canceled - 503 sent. Consider increasing memory for current running application.");
                return false;
            }
        }
View Full Code Here

Examples of org.jboss.dashboard.ui.controller.responses.SendErrorResponse

        MemoryProfiler memoryProfiler = MemoryProfiler.lookup();
        if (memoryProfiler.isLowMemory()) {
            log.warn("Memory is running low ...");
            memoryProfiler.freeMemory();
            if (memoryProfiler.isLowMemory()) {
                getControllerStatus().setResponse(new SendErrorResponse(503));
                getControllerStatus().consumeURIPart(getControllerStatus().getURIToBeConsumed());
                log.error("Memory is so low that the request had to be canceled - 503 sent. Consider increasing the JVM memory.");
                return false;
            }
        }
View Full Code Here

Examples of org.jboss.dashboard.ui.controller.responses.SendErrorResponse

        if (memoryProfiler.isLowMemory()) {
            log.warn("Memory is running low ...");
            memoryProfiler.freeMemory();
            if (memoryProfiler.isLowMemory()) {
                ControllerStatus controllerStatus = ControllerStatus.lookup();
                controllerStatus.setResponse(new SendErrorResponse(503));
                controllerStatus.consumeURIPart(controllerStatus.getURIToBeConsumed());
                log.error("Memory is so low that the request had to be canceled - 503 sent. Consider increasing the JVM memory.");
                return false;
            }
        }
View Full Code Here

Examples of org.jboss.dashboard.ui.controller.responses.SendErrorResponse

        log.debug("Retrieving resource " + name);
        Resource res = UIServices.lookup().getResourceManager().getResource(name);
        if (res != null)
            return res.getResourceAsResponse();
        log.warn("Not found resource " + name + " (" + new String(Base64.decode(name)) + ") ");
        return new SendErrorResponse(404);
    }
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.