Example usage for javax.servlet ServletException printStackTrace

List of usage examples for javax.servlet ServletException printStackTrace

Introduction

In this page you can find the example usage for javax.servlet ServletException printStackTrace.

Prototype

public void printStackTrace() 

Source Link

Document

Prints this throwable and its backtrace to the standard error stream.

Usage

From source file:org.cyk.ui.web.api.servlet.AbstractFilter.java

protected static Boolean goTo(Boolean condition, String relativeUrl, HttpServletRequest request,
        HttpServletResponse response, RedirectType redirectType) throws IOException {
    relativeUrl = (relativeUrl.startsWith(Constant.CHARACTER_SLASH.toString()) ? relativeUrl
            : Constant.CHARACTER_SLASH + relativeUrl);
    if (Boolean.TRUE.equals(condition))
        if (redirectType == null || RedirectType.REDIRECT.equals(redirectType))
            response.sendRedirect(request.getContextPath() + relativeUrl);
        else if (RedirectType.FORWARD.equals(redirectType)) {
            try {
                request.getRequestDispatcher(relativeUrl).forward(request, response);
            } catch (ServletException e) {
                e.printStackTrace();
            }/*from   ww w  .jav  a  2s.co  m*/
        }
    return Boolean.TRUE.equals(condition);
}

From source file:org.rti.zcore.dar.servlet.DynasiteConfigServlet.java

/**
 * Iterates through the forms from the database and makes mods to XML files.
 * Once it is done, it loads these forms into DynaSiteObjects.
 *//* w  w w  .j  av a  2s  . co  m*/
public static void loadDynaSiteObjects() throws ServletException {
    org.rti.zcore.servlet.DynasiteConfigServlet.loadDynaSiteObjects();
    log.debug("Loading extras for DAR");
    Set formList = DynaSiteObjects.getForms().entrySet();
    for (Iterator iterator = formList.iterator(); iterator.hasNext();) {
        Map.Entry entry = (Map.Entry) iterator.next();
        Form form = (Form) entry.getValue();
        if (form.isEnabled() == true) {
            if (form.getRecordsPerEncounter() != null && form.getRecordsPerEncounter() > 0) {
                if (form.getResizedForPatientBridge() == null) {
                    try {
                        FormUtils.createBridgeTablePageItems(form);
                    } catch (IllegalAccessException e) {
                        log.debug(e);
                    } catch (InstantiationException e) {
                        log.debug(e);
                    } catch (InvocationTargetException e) {
                        log.debug(e);
                    } catch (NoSuchMethodException e) {
                        log.debug(e);
                    }
                }
            }
        }
    }
    Connection conn = null;
    try {
        conn = DatabaseUtils.getZEPRSConnection(Constants.DATABASE_ADMIN_USERNAME);
        try {
            HashMap<Long, StockReport> balanceMap = InventoryDAO.getBalanceMap(conn, null, null, null);
            DynaSiteObjects.getStatusMap().put("balanceMap", balanceMap);
            StockControlDAO.setExpiredStockItems(conn);
            StockControlDAO.setLowStockTasks(conn);
            StockControlDAO.setStockAlertList(conn, null);
        } catch (Exception e) {
            log.debug("Error loading DynaSiteObjects: " + e);
            e.printStackTrace();
        }
    } catch (ServletException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
    } finally {
        try {
            conn.close();
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

}

From source file:com.geodan.ngr.serviceintegration.TestCSWTransformer.java

private void go(HttpServletRequest request, HttpServletResponse response) {
    try {//from   w w  w .  j av  a  2 s  . com
        CSWTransformer cswTransformer = new CSWTransformer();
        cswTransformer.doGet(request, response);
    } catch (ServletException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }
}

From source file:org.hdiv.filter.ValidatorFilterTest.java

public void testFilterCreation() {
    ValidatorFilter filter = new ValidatorFilter();

    HttpServletRequest request = HDIVUtil.getHttpServletRequest();
    MockHttpServletResponse response = new MockHttpServletResponse();
    FilterConfig filterConfig = new MockFilterConfig(request.getSession().getServletContext(), "hdivFilter");
    FilterChain filterChain = new MockFilterChain();

    try {//from   w ww .  j a  va  2  s. com
        filter.init(filterConfig);

        filter.doFilter(request, response, filterChain);

        // Validation error because is not start page
        String redirectUrl = response.getRedirectedUrl();
        assertEquals(getConfig().getErrorPage(), redirectUrl);

    } catch (ServletException e) {
        e.printStackTrace();
        assertTrue(false);
    } catch (IOException e) {
        e.printStackTrace();
        assertTrue(false);
    }
}

From source file:org.wso2.carbon.identity.authorization.ui.internal.AuthorizationUIServiceComponent.java

protected void activate(ComponentContext context) {

    String url = "/carbon/identity-authorization/moduleManager";
    Servlet authoServlet = new ContextPathServletAdaptor(new ModuleManager(), url);
    try {//from  ww w.j a va 2 s  . c  o  m
        httpService.registerServlet(url, authoServlet, null, null);
        log.info("Successfully registered an instance of Base Servelet");
    } catch (ServletException e) {
        e.printStackTrace();
    } catch (NamespaceException e) {
        e.printStackTrace();
    }

}

From source file:com.gwos.server.services.AppsServiceImpl.java

@Override
public StatObject getMemoryStats() {
    StatObject stats = new StatObject();

    // The FS root dir
    File rootDir = new File(new ServiceUtils(getServletContext()).getFSPath());
    stats.fileSystemTotalSpace = FileUtils.sizeOfDirectory(rootDir);

    // Call the service
    SessionServiceImpl service = new SessionServiceImpl();
    try {//w  ww  .j a v  a  2  s .c  o  m
        service.init(this.config);
    } catch (ServletException e) {
        e.printStackTrace();
    }

    // Memory for each of app users
    Map<User, Long> memoryUsages = new HashMap<User, Long>();
    stats.memoryUsages = memoryUsages;
    for (User user : service.getAllUsers()) {
        File userDir = new File(rootDir.getAbsolutePath() + File.separator + user.getUsername());
        if (userDir.exists() == false) {
            continue;
        }
        memoryUsages.put(user, FileUtils.sizeOfDirectory(userDir));
    }

    return stats;
}

From source file:tech.oleks.pmtalk.PmTalkServlet.java

private void forward(String url, HttpServletRequest req, HttpServletResponse resp) {
    RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(url);
    try {/*from  ww w . ja va2s. com*/
        dispatcher.forward(req, resp);
    } catch (ServletException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }

}

From source file:net.jforum.core.tags.ImportFileTag.java

/**
 * @see javax.servlet.jsp.tagext.SimpleTagSupport#doTag()
 *//*from   ww  w. j a  v a 2s.  co m*/
@Override
public void doTag() throws JspException, IOException {
    // check the URL
    if (StringUtils.isEmpty(url))
        throw new NullAttributeException("import", "url");

    String jsp = this.getFile(url);

    ServletRequest request = this.request();
    ServletResponse respose = this.response();
    HttpSession session = ((HttpServletRequest) request).getSession();
    ServletContext servletContext = session.getServletContext();

    String jspPath = servletContext.getRealPath(jsp);
    File jspFile = new File(jspPath);
    if (!jspFile.exists())
        return;

    respose.flushBuffer();
    RequestDispatcher rd = this.pageContext().getRequest().getRequestDispatcher(jsp);
    try {
        // include the resource, using our custom wrapper
        ImportResponseWrapper irw = new ImportResponseWrapper((HttpServletResponse) respose);
        irw.setCharacterEncoding(charEncoding);
        rd.include(request, irw);
        // disallow inappropriate response codes per JSTL spec
        if (irw.getStatus() < 200 || irw.getStatus() > 299) {
            throw new JspTagException(irw.getStatus() + " " + jsp);
        }

        // recover the response String from our wrapper
        pageContext().getOut().print(irw.getString());
    } catch (ServletException e) {
        e.printStackTrace();
    }
}

From source file:org.energy_home.jemma.internal.ah.eh.esp.ESPServlet.java

public void setHttpService(HttpService httpService) {
    try {/*from   ww w. ja v a  2 s  . c o m*/
        httpService.registerServlet(servletUri, this, null, null);
    } catch (ServletException e) {
        e.printStackTrace();
    } catch (NamespaceException e) {
        e.printStackTrace();
    }

}

From source file:edu.duke.cabig.c3pr.web.study.AmendStudyController.java

@Override
protected boolean isFormSubmission(HttpServletRequest request) {
    boolean isFormSumission = super.isFormSubmission(request);
    if (isFormSumission && WebUtils.hasSubmitParameter(request, "refreshCommandObject")) {
        try {// ww  w.  j av a2  s .c om
            request.getSession().setAttribute(getFormSessionAttributeName(), formBackingObject(request));
        } catch (ServletException e) {
            e.printStackTrace();
        }
    }
    return isFormSumission;
}