List of usage examples for javax.servlet ServletException printStackTrace
public void printStackTrace()
From source file:de.unirostock.sems.caroweb.Converter.java
/** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse * response)/*ww w . jav a2s . c o m*/ */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { runGet(request, response); } catch (ServletException e) { e.printStackTrace(); LOGGER.error(e, "invalid request"); error(request, response, "invalid request"); } }
From source file:org.squale.welcom.taglib.canvas.PageTag.java
/** * @see javax.servlet.jsp.tagext.TagSupport#doStartTag() *//*from w w w . j a v a2s . co m*/ public int doStartTag() throws JspException { final String access = computeMode(); // Si la page n'est pas accessible alors redirige vers la page d'erreur if (access.equals(Access.NONE) || access.equals(Access.NO)) { try { final ActionErrors errors = new ActionErrors(); errors.add("error", new ActionError("welcom.internal.page.non.access")); pageContext.getRequest().setAttribute(Globals.ERROR_KEY, errors); pageContext.getRequest().getRequestDispatcher("/error.do").include(pageContext.getRequest(), pageContext.getResponse()); } catch (final ServletException e) { e.printStackTrace(); } catch (final IOException e) { e.printStackTrace(); } ; return SKIP_PAGE; } return EVAL_PAGE; }
From source file:de.tsystems.mms.apm.performancesignature.PerfSigBuildActionResultsDisplay.java
private void serveFile(final String type, final StaplerRequest request, final StaplerResponse response) throws IOException, InterruptedException { String testCase = request.getParameter("testCase"); String numberString = request.getParameter("number"); int number = 0; FilePath filePath = new FilePath(PerfSigUtils.getReportDirectory(getBuild())); if (StringUtils.isBlank(testCase)) testCase = ""; String extension = StringUtils.isBlank(type) ? ".dts" : ".pdf"; List<FilePath> files = filePath.list(new RegexFileFilter(type + ".*" + testCase + ".*" + extension)); if (files.isEmpty()) { response.sendError(404, "requested resource not found"); return;//from w ww . j a v a 2s. co m } try { number = Integer.parseInt(numberString); } catch (NumberFormatException ignored) { } FilePath requestedFile = number > 0 ? files.get(number) : files.get(0); if (requestedFile == null) { response.sendError(404, "requested resource not found"); return; } InputStream inStream = requestedFile.read(); // gets MIME type of the file String mimeType = requestedFile.getName().contains("pdf") ? "application/pdf" : "application/octet-stream";// set to binary type if MIME mapping not found try { // forces download String headerKey = "Content-Disposition"; String headerValue = String.format("attachment; filename=\"%s\"", requestedFile.getName()); response.setHeader(headerKey, headerValue); response.serveFile(request, inStream, requestedFile.lastModified(), requestedFile.length(), "mime-type:" + mimeType); } catch (ServletException e) { e.printStackTrace(); } finally { IOUtils.closeQuietly(inStream); } }
From source file:org.apache.struts.tiles.TestTilesPlugin.java
/** * Fake call to init module plugins/*www. j a v a2 s . c o m*/ * @param moduleConfig */ public void initModulePlugIns(ModuleConfig moduleConfig) { PlugInConfig plugInConfigs[] = moduleConfig.findPlugInConfigs(); PlugIn plugIns[] = new PlugIn[plugInConfigs.length]; context.setAttribute(Globals.PLUG_INS_KEY + moduleConfig.getPrefix(), plugIns); for (int i = 0; i < plugIns.length; i++) { try { plugIns[i] = (PlugIn) RequestUtils.applicationInstance(plugInConfigs[i].getClassName()); BeanUtils.populate(plugIns[i], plugInConfigs[i].getProperties()); // Pass the current plugIn config object to the PlugIn. // The property is set only if the plugin declares it. // This plugin config object is needed by Tiles BeanUtils.copyProperty(plugIns[i], "currentPlugInConfigObject", plugInConfigs[i]); plugIns[i].init(actionServlet, moduleConfig); } catch (ServletException e) { // Lets propagate e.printStackTrace(); //throw e; } catch (Exception e) { e.printStackTrace(); //throw e; } } }
From source file:com.persistent.cloudninja.controller.CloudNinjaAuthFilter.java
public void forwardToVerificationPage(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, String guid, String acsToken) { try {/*from w w w .j av a2s . co m*/ httpServletRequest.setAttribute("guid", guid); httpServletRequest.setAttribute("acsToken", acsToken); httpServletRequest.getRequestDispatcher("/codeVerification.htm").forward(httpServletRequest, httpServletResponse); } catch (ServletException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } }
From source file:com.persistent.cloudninja.controller.CloudNinjaAuthFilter.java
private void forwardToNextPage(ServletRequest request, ServletResponse response, FilterChain filterChain) { try {/*from w w w . j ava2 s . co m*/ HttpServletRequest httpServletRequest = (HttpServletRequest) request; HttpServletResponse httpServletResponse = (HttpServletResponse) response; if (httpServletRequest.getRequestURI().contains("/logout")) { removeCookie(httpServletRequest, httpServletResponse, CloudNinjaConstants.AUTH_COOKIE_NAME); request.getRequestDispatcher("/logout.htm").forward(httpServletRequest, httpServletResponse); } else { filterChain.doFilter(request, response); } } catch (ServletException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } }
From source file:be.ff.gui.web.struts.action.ActionPlugInTilesRequestProcessor.java
/** * General-purpose preprocessing hook that can be overridden as required by subclasses. Return <code>true</code> * if you want standard processing to continue, or <code>false</code> if the response has already been completed. * The default implementation does nothing. * /*from ww w .j a va 2 s.c om*/ * @param request The servlet request we are processing * @param response The servlet response we are creating * @param path DOCUMENTAR! * @return DOCUMENTAR! */ public ActionMapping processMapping(HttpServletRequest request, HttpServletResponse response, String path) throws IOException { if (log.isDebugEnabled()) { log.debug("Entrada no metodo"); } // Seta qual a ao que est sendo executada request.getSession().setAttribute("CHULTACAVE", ActionPluginUtil.getActionPath(request)); // Chamar o processamento normal do RequestProcessor ActionMapping mapping = super.processMapping(request, response, path); // Em caso de no ter encontrado uma referencia para o mapeamento, finalizar // que quando mapping == null if (mapping != null) { try { // tigger the action plug-in chain ActionPlugInChain actionFilterChain = new ActionPlugInChain(); if (log.isDebugEnabled()) { log.debug("mapping=" + mapping + " - actionFilterChain=" + actionFilterChain); } ForwardConfig actionForward = actionFilterChain.execute(mapping, null, request, response); if (log.isDebugEnabled()) { log.debug("actionForward=" + actionForward); } if (actionForward != null) { // Para que o request processor aborte o restante do processamento. mapping = null; /* * The chain has decided that a forward should occur; the target action will not execute. */ if (log.isDebugEnabled()) { log.debug( "The chain has decided that a forward should occur; the target action will not execute."); } // Process the returned ActionForward instance try { if (log.isInfoEnabled()) { log.info("O ActionPlugIn decidiu que deve ocorrer um forward para " + actionForward.getPath()); } this.processForwardConfig(request, response, actionForward); } catch (ServletException se) { if (log.isErrorEnabled()) { log.error("Ocorreu um erro processando o ActionForward '" + actionForward.getPath() + "'"); se.printStackTrace(); } } } } catch (ActionPlugInException e) { StringBuffer errorMsg = new StringBuffer(); errorMsg.append("An exception occurred in the action plug-in chain"); if (e.getMessage() != null) { errorMsg.append(": "); errorMsg.append(e.getMessage()); } else { errorMsg.append("."); } Throwable cause = (e.getRootCause() != null) ? e.getRootCause() : e; log.error(errorMsg.toString(), cause); throw new IOException(errorMsg.toString()); } } return (mapping); }
From source file:com.persistent.cloudninja.controller.CloudNinjaAuthFilter.java
private void forwardToLandingPage(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, FilterChain chain, CloudNinjaUser cloudNinjaUser) { UserActivityQueue userActivityQueue = UserActivityQueue.getUserActivityQueue(); String tenantId = null;//from w w w. j av a2 s. c o m synchronized (userActivityQueue) { try { Calendar calendar = Calendar.getInstance(); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S z"); dateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); String date = dateFormat.format(calendar.getTime()); UserActivityQueueMessage message; String cookie = httpServletRequest.getAttribute("cookieNameAttr").toString(); tenantId = AuthFilterUtils.getFieldValueFromCookieString(CloudNinjaConstants.COOKIE_TENANTID_PREFIX, cookie); message = new UserActivityQueueMessage(tenantId, cloudNinjaUser.getMemberId(), dateFormat.parse(date)); userActivityQueue.add(message); } catch (ParseException e) { e.printStackTrace(); } } try { rsBundle = ResourceBundle.getBundle("acs"); String landingPageURL = "/" + tenantId; landingPageURL = landingPageURL + rsBundle.getString("tenant.dashboard.landing.page.url").trim(); httpServletRequest.getRequestDispatcher(landingPageURL).forward(httpServletRequest, httpServletResponse); } catch (ServletException exception) { logger.error(exception.getMessage()); exception.printStackTrace(); } catch (IOException exception) { logger.error(exception.getMessage()); exception.printStackTrace(); } }
From source file:org.energy_home.jemma.hac.adapter.http.AhHttpAdapter.java
public synchronized void setHttpService(HttpService s) { httpService = s;//from www. ja v a 2 s. co m if (contextType.equals("SecureBasicHttpContext")) { httpContext = new SecureBasicHttpContext(null, null, null); } else if (contextType.equals("UserAdminBasicHttpContext")) { httpContext = new UserAdminBasicHttpContext(null, null, null); } else { httpContext = new HacHttpContext(s.createDefaultHttpContext()); } try { jsonRpcServlet = new JsonRPC(this, jsonRpcUrl); customJSONServlet = new CustomJsonServlet(this, jsonServletUrl); httpService.registerServlet(jsonServletUrl, customJSONServlet, null, httpContext); httpService.registerServlet(jsonRpcUrl, jsonRpcServlet, null, httpContext); } catch (ServletException e) { e.printStackTrace(); } catch (NamespaceException e) { e.printStackTrace(); } log.debug("registered http resources"); }
From source file:fr.gael.dhus.server.http.TomcatServer.java
private Wrapper addServlet(Context ctx, String servlet_name, String url_mapping, Servlet servlet, boolean load_on_startup) { Wrapper wrapper = Tomcat.addServlet(ctx, servlet_name, servlet); ctx.addServletMapping(url_mapping, servlet_name); if (load_on_startup) { try {//w w w . j ava2 s . c o m wrapper.load(); } catch (ServletException e) { e.printStackTrace(); } } return wrapper; }