List of usage examples for javax.servlet.http HttpServletRequest getScheme
public String getScheme();
From source file:org.hoteia.qalingo.core.web.util.RequestUtil.java
public String getCustomerAvatar(final HttpServletRequest request, final Customer customer) throws Exception { String customerAvatar = null; if (customer != null) { if (StringUtils.isNotEmpty(customer.getAvatarImg())) { customerAvatar = customer.getAvatarImg(); } else {//from ww w.j av a 2 s. c om if (StringUtils.isNotEmpty(customer.getEmail())) { String email = customer.getEmail().toLowerCase().trim(); MessageDigest md = MessageDigest.getInstance("MD5"); byte[] array = md.digest(email.getBytes("CP1252")); StringBuffer sb = new StringBuffer(); for (byte anArray : array) { sb.append(Integer.toHexString((anArray & 0xFF) | 0x100).substring(1, 3)); } String gravatarId = sb.toString(); if ("https".equals(request.getScheme())) { customerAvatar = "https://secure.gravatar.com/avatar/" + gravatarId; } else { customerAvatar = "http://www.gravatar.com/avatar/" + gravatarId; } } } } return customerAvatar; }
From source file:Controller.ProviderController.java
@RequestMapping(value = "/SendEmailInviteFriend", method = RequestMethod.POST) public String SendEmailInviteFriend(HttpServletRequest request, HttpSession session) { try {//w w w .j a v a 2 s . c o m AccountSession account = (AccountSession) session.getAttribute("account"); int providerID = account.getId(); String contextPath = request.getContextPath(); String baseUrl; if (contextPath != null || contextPath.isEmpty() || !contextPath.equals("")) { baseUrl = String.format("%s://%s:%d" + contextPath, request.getScheme(), request.getServerName(), request.getServerPort()); } else { baseUrl = String.format("%s://%s:%d", request.getScheme(), request.getServerName(), request.getServerPort()); } providerService.sendMail(request, account.getName(), providerID, baseUrl); request.setAttribute("emailSent", "Email Sent!"); return "forward:/Provider/InviteFriend"; } catch (Exception e) { String content = "Function: ProviderController - send email invite friend\n" + "****Error****\n" + e.getMessage() + "\n" + "**********"; return "forward:/Common/Error"; } }
From source file:Controller.ProviderController.java
@RequestMapping(value = "/SendEmailReferral", method = RequestMethod.POST) public @ResponseBody String SendEmailReferral(@RequestBody final String data, HttpServletRequest request, HttpSession session) {//from w ww . ja v a 2 s. c om try { AccountSession account = (AccountSession) session.getAttribute("account"); int providerID = account.getId(); String contextPath = request.getContextPath(); String baseUrl; if (contextPath != null || contextPath.isEmpty() || !contextPath.equals("")) { baseUrl = String.format("%s://%s:%d" + contextPath, request.getScheme(), request.getServerName(), request.getServerPort()); } else { baseUrl = String.format("%s://%s:%d", request.getScheme(), request.getServerName(), request.getServerPort()); } providerService.sendEmailReferral(data, providerID, baseUrl); request.setAttribute("emailSent", "Email Sent!"); return "{\"result\": \"success\"}"; } catch (Exception e) { String content = "Function: ProviderController - send email invite friend\n" + "****Error****\n" + e.getMessage() + "\n" + "**********"; return "forward:/Common/Error"; } }
From source file:org.exoplatform.outlook.OutlookServiceImpl.java
/** * Inits the document link.// www.j a v a 2 s . co m * * @param siteType the site type * @param driveName the drive name * @param portalName the portal name * @param nodeURI the node URI * @param node the node * @throws OutlookException the outlook exception */ protected void initDocumentLink(SiteType siteType, String driveName, String portalName, String nodeURI, HierarchyNode node) throws OutlookException { // WebDAV URL initWebDAVLink(node); // Portal URL // Code adapted from ECMS's PermlinkActionComponent.getPermlink() String npath = node.getPath().replaceAll("/+", "/"); String path = new StringBuilder().append(driveName).append(npath).toString(); PortalRequestContext portalRequest = Util.getPortalRequestContext(); if (portalRequest != null) { NodeURL nodeURL = portalRequest.createURL(NodeURL.TYPE); NavigationResource resource = new NavigationResource(siteType, portalName, nodeURI); nodeURL.setResource(resource); nodeURL.setQueryParameterValue("path", path); HttpServletRequest request = portalRequest.getRequest(); try { URI requestUri = new URI(request.getScheme(), null, request.getServerName(), request.getServerPort(), null, null, null); StringBuilder url = new StringBuilder(); url.append(requestUri.toASCIIString()); url.append(nodeURL.toString()); node.setUrl(url.toString()); } catch (URISyntaxException e) { throw new OutlookException("Error creating server URL " + request.getRequestURI().toString(), e); } } else { LOG.warn("Portal request not found. Node URL will be its WebDAV link. Node: " + node.getPath()); node.setUrl(node.getWebdavUrl()); } }
From source file:org.apache.hadoop.hdfs.server.datanode.DatanodeJspHelper.java
static void generateFileDetails(JspWriter out, HttpServletRequest req, Configuration conf) throws IOException, InterruptedException { long startOffset = 0; int datanodePort; final Long blockId = JspHelper.validateLong(req.getParameter("blockId")); if (blockId == null) { out.print("Invalid input (blockId absent)"); return;/* w ww .ja v a 2 s . c o m*/ } String tokenString = req.getParameter(JspHelper.DELEGATION_PARAMETER_NAME); UserGroupInformation ugi = JspHelper.getUGI(req, conf); String datanodePortStr = req.getParameter("datanodePort"); if (datanodePortStr == null) { out.print("Invalid input (datanodePort absent)"); return; } datanodePort = Integer.parseInt(datanodePortStr); final Long genStamp = JspHelper.validateLong(req.getParameter("genstamp")); if (genStamp == null) { out.print("Invalid input (genstamp absent)"); return; } String namenodeInfoPortStr = req.getParameter("namenodeInfoPort"); int namenodeInfoPort = -1; if (namenodeInfoPortStr != null) namenodeInfoPort = Integer.parseInt(namenodeInfoPortStr); final String nnAddr = StringEscapeUtils.escapeHtml(req.getParameter(JspHelper.NAMENODE_ADDRESS)); if (nnAddr == null) { out.print(JspHelper.NAMENODE_ADDRESS + " url param is null"); return; } final int chunkSizeToView = JspHelper.string2ChunkSizeToView(req.getParameter("chunkSizeToView"), getDefaultChunkSize(conf)); String startOffsetStr = req.getParameter("startOffset"); if (startOffsetStr == null || Long.parseLong(startOffsetStr) < 0) startOffset = 0; else startOffset = Long.parseLong(startOffsetStr); String path = StringEscapeUtils.unescapeHtml(req.getParameter("filename")); if (path == null) { path = req.getPathInfo() == null ? "/" : req.getPathInfo(); } final String filename = JspHelper.validatePath(path); if (filename == null) { out.print("Invalid input"); return; } final String blockSizeStr = req.getParameter("blockSize"); if (blockSizeStr == null || blockSizeStr.length() == 0) { out.print("Invalid input"); return; } long blockSize = Long.parseLong(blockSizeStr); final DFSClient dfs = getDFSClient(ugi, nnAddr, conf); List<LocatedBlock> blocks = dfs.getNamenode().getBlockLocations(filename, 0, Long.MAX_VALUE) .getLocatedBlocks(); // Add the various links for looking at the file contents // URL for downloading the full file String downloadUrl = "/streamFile" + ServletUtil.encodePath(filename) + JspHelper.getUrlParam(JspHelper.NAMENODE_ADDRESS, nnAddr, true) + JspHelper.getDelegationTokenUrlParam(tokenString); out.print("<a name=\"viewOptions\"></a>"); out.print("<a href=\"" + downloadUrl + "\">Download this file</a><br>"); DatanodeInfo chosenNode; // URL for TAIL LocatedBlock lastBlk = blocks.get(blocks.size() - 1); try { chosenNode = JspHelper.bestNode(lastBlk, conf); } catch (IOException e) { out.print(e.toString()); dfs.close(); return; } String tailUrl = "///" + JspHelper.Url.authority(req.getScheme(), chosenNode) + "/tail.jsp?filename=" + URLEncoder.encode(filename, "UTF-8") + "&namenodeInfoPort=" + namenodeInfoPort + "&chunkSizeToView=" + chunkSizeToView + JspHelper.getDelegationTokenUrlParam(tokenString) + JspHelper.getUrlParam(JspHelper.NAMENODE_ADDRESS, nnAddr) + "&referrer=" + URLEncoder.encode(req.getRequestURL() + "?" + req.getQueryString(), "UTF-8"); out.print("<a href=\"" + tailUrl + "\">Tail this file</a><br>"); out.print("<form action=\"/browseBlock.jsp\" method=GET>"); out.print("<b>Chunk size to view (in bytes, up to file's DFS block size): </b>"); out.print("<input type=\"hidden\" name=\"blockId\" value=\"" + blockId + "\">"); out.print("<input type=\"hidden\" name=\"blockSize\" value=\"" + blockSize + "\">"); out.print("<input type=\"hidden\" name=\"startOffset\" value=\"" + startOffset + "\">"); out.print("<input type=\"hidden\" name=\"filename\" value=\"" + filename + "\">"); out.print("<input type=\"hidden\" name=\"genstamp\" value=\"" + genStamp + "\">"); out.print("<input type=\"hidden\" name=\"datanodePort\" value=\"" + datanodePort + "\">"); out.print("<input type=\"hidden\" name=\"namenodeInfoPort\" value=\"" + namenodeInfoPort + "\">"); out.print("<input type=\"hidden\" name=\"" + JspHelper.NAMENODE_ADDRESS + "\" value=\"" + nnAddr + "\">"); out.print("<input type=\"text\" name=\"chunkSizeToView\" value=" + chunkSizeToView + " size=10 maxlength=10>"); out.print(" <input type=\"submit\" name=\"submit\" value=\"Refresh\">"); out.print("</form>"); out.print("<hr>"); out.print("<a name=\"blockDetails\"></a>"); out.print("<B>Total number of blocks: " + blocks.size() + "</B><br>"); // generate a table and dump the info out.println("\n<table>"); String nnCanonicalName = JspHelper.canonicalize(nnAddr); for (LocatedBlock cur : blocks) { out.print("<tr>"); final String blockidstring = Long.toString(cur.getBlock().getBlockId()); blockSize = cur.getBlock().getNumBytes(); out.print("<td>" + blockidstring + ":</td>"); DatanodeInfo[] locs = cur.getLocations(); for (int j = 0; j < locs.length; j++) { String datanodeAddr = locs[j].getXferAddr(); datanodePort = locs[j].getXferPort(); String blockUrl = "///" + JspHelper.Url.authority(req.getScheme(), locs[j]) + "/browseBlock.jsp?blockId=" + blockidstring + "&blockSize=" + blockSize + "&filename=" + URLEncoder.encode(filename, "UTF-8") + "&datanodePort=" + datanodePort + "&genstamp=" + cur.getBlock().getGenerationStamp() + "&namenodeInfoPort=" + namenodeInfoPort + "&chunkSizeToView=" + chunkSizeToView + JspHelper.getDelegationTokenUrlParam(tokenString) + JspHelper.getUrlParam(JspHelper.NAMENODE_ADDRESS, nnAddr); String blockInfoUrl = "///" + nnCanonicalName + ":" + namenodeInfoPort + "/block_info_xml.jsp?blockId=" + blockidstring; out.print("<td> </td><td><a href=\"" + blockUrl + "\">" + datanodeAddr + "</a></td><td>" + "<a href=\"" + blockInfoUrl + "\">View Block Info</a></td>"); } out.println("</tr>"); } out.println("</table>"); out.print("<hr>"); out.print("<br><a href=\"///" + nnCanonicalName + ":" + namenodeInfoPort + "/dfshealth.jsp\">Go back to DFS home</a>"); dfs.close(); }
From source file:br.mdarte.exemplo.academico.accessControl.Login.java
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { loadUseCaseInfo();// w w w. ja v a 2s . c o m org.apache.commons.beanutils.BeanUtils.populate(form, request.getParameterMap()); ActionForward forward = null; if (request.getSession().getAttribute(Constantes.TROCA_SENHA_OBRIGATORIA) != null && request.getParameter(Constantes.BUTTON_TROCA_SENHA) == null) { forward = _verificaTrocaSenhaObrigatoria(mapping, form, request, response); } else { forward = _validarSessao(mapping, form, request, response); } try { request.getSession().setAttribute("mapping", mapping); request.getSession().setAttribute("form", form); } catch (java.lang.Exception exception) { Object formObj = org.andromda.presentation.bpm4struts.PageSessionObjectUtil.getPageForm(request, "${action.useCase.name}"); if (formObj != null) { try { formObj.getClass() .getMethod("resetCheckBoxes", new Class[] { org.apache.struts.action.ActionMapping.class, javax.servlet.http.HttpServletRequest.class }) .invoke(formObj, new Object[] { null, null }); } catch (Exception e2) { // ignoring } final java.util.Map parameters = new java.util.HashMap(); for (final java.util.Enumeration names = request.getParameterNames(); names.hasMoreElements();) { final String name = String.valueOf(names.nextElement()); parameters.put(name, request.getParameterValues(name)); } try { org.apache.commons.beanutils.BeanUtils.populate(formObj, parameters); } catch (java.lang.Exception populateException) { // ignore if we have an exception here (we just don't populate). } } throw exception; } request.getSession().setAttribute("form", form); Boolean aplicacaoGerenciaTrocaDePortas = (Boolean) request.getSession().getServletContext() .getAttribute("aplicacaoGerenciaTrocaDePortas"); if (aplicacaoGerenciaTrocaDePortas) { if (forward != null && !(forward.getPath().contains("ForwardAction"))) { if (forward != null && forward.getPath().startsWith("/secure")) { forward = new ActionForward("https://" + (request.getServerName() + ":" + request.getSession().getServletContext().getAttribute("httpsPort") + "//sistemaacademico" + forward.getPath()).replaceAll("//", "/"), true); } else { if (forward != null && request.getScheme().equals("https")) { if (!forward.getPath().startsWith("http")) { forward = new ActionForward( "http://" + (request.getServerName() + ":" + request.getSession().getServletContext().getAttribute("httpPort") + request.getContextPath() + forward.getPath()).replaceAll("//", "/"), true); } if (forward.getPath().startsWith("https")) { String httpPort = (String) request.getSession().getServletContext() .getAttribute("httpPort"); String httpsPort = (String) request.getSession().getServletContext() .getAttribute("httpsPort"); forward = new ActionForward( forward.getPath().replaceAll("https", "http").replaceAll(httpsPort, httpPort), true); } } } } } // invalida sessao https ao trocar para http (passa a ter somente uma sessao para ambos) if (request.getScheme().equals("https") && forward != null && forward.getPath().startsWith("http://")) request.getSession().invalidate(); return forward; }
From source file:org.sakaiproject.entitybroker.util.http.EntityHttpServletRequest.java
/** * Set all the values from a request on this request object and set this request * as the one which the values were copied from * @param req any request//from w ww . j a v a 2 s . c o m */ public void setRequestValues(HttpServletRequest req) { if (req == null) { throw new IllegalArgumentException("request cannot be null"); } // get the collections of values out Enumeration<String> attribNames = req.getAttributeNames(); while (attribNames.hasMoreElements()) { String name = (String) attribNames.nextElement(); Object obj = req.getAttribute(name); if (obj != null) { attributes.put(name, obj); } } Cookie[] ck = req.getCookies(); if (ck != null) { for (int i = 0; i < ck.length; i++) { cookies.add(ck[i]); } } Enumeration<String> headerNames = req.getHeaderNames(); while (headerNames.hasMoreElements()) { String name = headerNames.nextElement(); Enumeration<String> henum = req.getHeaders(name); Vector<String> v = new Vector<String>(1); while (henum.hasMoreElements()) { String h = henum.nextElement(); v.add(h); } } for (Entry<String, String[]> entry : (Set<Entry<String, String[]>>) req.getParameterMap().entrySet()) { parameters.put(entry.getKey(), entry.getValue()); } // get the basic values out this.locale = req.getLocale(); this.method = req.getMethod(); this.contentType = req.getContentType(); this.characterEncoding = req.getCharacterEncoding() == null ? "UTF-8" : req.getCharacterEncoding(); this.contentLength = req.getContentLength(); this.contextPath = req.getContextPath(); this.pathInfo = req.getPathInfo(); this.queryString = req.getQueryString(); this.requestURI = req.getRequestURI(); this.servletPath = req.getServletPath(); this.scheme = req.getScheme(); this.protocol = req.getProtocol(); this.serverName = req.getServerName(); this.serverPort = req.getServerPort(); this.remoteAddr = req.getRemoteAddr(); this.remoteHost = req.getRemoteHost(); this.realDispatcher = true; }
From source file:org.apache.catalina.valves.ExtendedAccessLogValve.java
/** * Get app specific data./* w w w . j a v a 2 s.c om*/ * @param fieldInfo The field to decode * @param request Where we will pull the data from. * @return The appropriate value */ private String getAppSpecific(FieldInfo fieldInfo, Request request) { ServletRequest sr = request.getRequest(); HttpServletRequest hsr = null; if (sr instanceof HttpServletRequest) hsr = (HttpServletRequest) sr; switch (fieldInfo.xType) { case FieldInfo.X_PARAMETER: return wrap(urlEncode(sr.getParameter(fieldInfo.value))); case FieldInfo.X_REQUEST: return wrap(sr.getAttribute(fieldInfo.value)); case FieldInfo.X_SESSION: HttpSession session = null; if (hsr != null) { session = hsr.getSession(false); if (session != null) return wrap(session.getAttribute(fieldInfo.value)); } break; case FieldInfo.X_COOKIE: Cookie[] c = hsr.getCookies(); for (int i = 0; c != null && i < c.length; i++) { if (fieldInfo.value.equals(c[i].getName())) { return wrap(c[i].getValue()); } } case FieldInfo.X_APP: return wrap(request.getContext().getServletContext().getAttribute(fieldInfo.value)); case FieldInfo.X_SERVLET_REQUEST: if (fieldInfo.location == FieldInfo.X_LOC_AUTHTYPE) { return wrap(hsr.getAuthType()); } else if (fieldInfo.location == FieldInfo.X_LOC_REMOTEUSER) { return wrap(hsr.getRemoteUser()); } else if (fieldInfo.location == FieldInfo.X_LOC_REQUESTEDSESSIONID) { return wrap(hsr.getRequestedSessionId()); } else if (fieldInfo.location == FieldInfo.X_LOC_REQUESTEDSESSIONIDFROMCOOKIE) { return wrap("" + hsr.isRequestedSessionIdFromCookie()); } else if (fieldInfo.location == FieldInfo.X_LOC_REQUESTEDSESSIONIDVALID) { return wrap("" + hsr.isRequestedSessionIdValid()); } else if (fieldInfo.location == FieldInfo.X_LOC_CONTENTLENGTH) { return wrap("" + hsr.getContentLength()); } else if (fieldInfo.location == FieldInfo.X_LOC_CHARACTERENCODING) { return wrap(hsr.getCharacterEncoding()); } else if (fieldInfo.location == FieldInfo.X_LOC_LOCALE) { return wrap(hsr.getLocale()); } else if (fieldInfo.location == FieldInfo.X_LOC_PROTOCOL) { return wrap(hsr.getProtocol()); } else if (fieldInfo.location == FieldInfo.X_LOC_SCHEME) { return wrap(hsr.getScheme()); } else if (fieldInfo.location == FieldInfo.X_LOC_SECURE) { return wrap("" + hsr.isSecure()); } break; default: ; } return "-"; }
From source file:com.juicioenlinea.application.servlets.particular.DemandaServlet.java
private void create(HttpServletRequest request, HttpServletResponse response) throws IOException { HttpSession session = request.getSession(false); Particular demandante = (Particular) session.getAttribute("usuario"); StringBuilder sb = new StringBuilder(); sb.append("<response>"); if (request.getContentLengthLong() > 104857600) { response.setStatus(HttpServletResponse.SC_REQUEST_ENTITY_TOO_LARGE); sb.append("<message>"); sb.append(new Messages().getClientMessage("error", 7)); sb.append("</message>"); } else {/*from w w w . j a v a 2 s . c om*/ // Campos formulario UploadFile uf = new UploadFile(request); String numeroDemanda = ToolBox.createNumeroDemanda(); String nombre = uf.getFormField("nombre"); String descripcion = uf.getFormField("descripcion"); int estado = 1; System.out.println("Archivos: " + uf.getFiles().size()); // Validamos datos if (numeroDemanda == null || numeroDemanda.equals("") || nombre == null || nombre.equals("") || descripcion == null || descripcion.equals("") || uf.getFiles().size() < 1) { response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); sb.append("<message>"); sb.append(new Messages().getClientMessage("error", 1)); sb.append("</message>"); } else { // Tiempo Date fechaCreacion = ToolBox.dateFormat(new Date()); // Obtenemos 3 magistrados con menos demandas asignadas MagistradoDAO madao = new MagistradoDAO(); Set<Magistrado> magistrados = madao.get3Magistrado(); if (magistrados == null || magistrados.size() < 3) { magistrados = madao.readAll3(); } // Objetos de TIEMPO Tiempo tiempo = new Tiempo(); tiempo.setFechaCreacion(fechaCreacion); TiempoDAO tidao = new TiempoDAO(); // Objeto de DEMANDA Demanda demanda = new Demanda(); demanda.setParticularByIdParticularDemandante(demandante); demanda.setTiempo(tiempo); demanda.setNumeroDemanda(numeroDemanda); demanda.setNombreDemanda(nombre); demanda.setDescripcion(descripcion); demanda.setEstado(estado); demanda.setMagistrados(magistrados); DemandaDAO dedao = new DemandaDAO(); if (!tidao.create(tiempo) || !dedao.create(demanda)) { response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); sb.append("<message>"); sb.append(new Messages().getClientMessage("error", 4)); sb.append("</message>"); } else { // Guardamos los documentos String sala = "s1"; String uri = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + "/" + this.getServletContext().getContextPath(); for (FileItem fi : uf.getFiles()) { // Documentos Documento documento = new Documento(); documento.setDemanda(demanda); documento.setParticular(demandante); documento.setFechaCarga(ToolBox.dateFormat(new Date())); documento.setRuta( uf.saveFile(fi, this.getServletContext().getRealPath(""), sala, numeroDemanda)); documento.setEstado(1); documento.setNombre(fi.getName()); DocumentoDAO dodao = new DocumentoDAO(); if (!dodao.create(documento)) { response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); sb.append("<message>"); sb.append(new Messages().getClientMessage("error", 7)); sb.append("</message>"); break; } } //Mail mail = new Mail(demandante.getCatalogousuarios().getCorreo(), "Demanda creada", "Nmero de demanda: " + numeroDemanda); Mail mail = new Mail("eddy_wallace@hotmail.com", "Demanda creada", "Nmero de demanda: " + numeroDemanda); if (!mail.sendMail()) { response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); sb.append("<message>"); sb.append(new Messages().getClientMessage("error", 8)); sb.append("</message>"); sb.append("<redirect>"); sb.append(uri).append("/aplicacion/particular/Demanda?action=demandasHechas"); sb.append("</redirect>"); } else { sb.append("<message>"); sb.append(new Messages().getClientMessage("ok", 5)); sb.append("</message>"); sb.append("<redirect>"); sb.append(uri).append("/aplicacion/particular/Demanda?action=demandasHechas"); sb.append("</redirect>"); } } } } sb.append("</response>"); PrintWriter pw = response.getWriter(); pw.write(sb.toString()); }
From source file:ro.raisercostin.web.DebuggingFilter.java
public String debug(ServletContext servletContext, HttpServletRequest request, HttpServletResponse response, DebuggingPrinter debuggingPrinter, boolean debugAll, boolean debugRequest) { final JspFactory jspFactory = JspFactory.getDefaultFactory(); HttpSession session = request.getSession(); debuggingPrinter.addHeader();// w w w .ja va 2 s.c o m debuggingPrinter.addSection("Request Parameters"); for (Iterator iterator = request.getParameterMap().entrySet().iterator(); iterator.hasNext();) { Map.Entry<String, Object> parameter = (Map.Entry<String, Object>) iterator.next(); addRow(debuggingPrinter, parameter.getKey(), StringUtils.arrayToCommaDelimitedString((Object[]) parameter.getValue())); } debuggingPrinter.endSection(); if (debugRequest) { debuggingPrinter.addSection("Request Header"); for (Enumeration e = request.getHeaderNames(); e.hasMoreElements();) { String parameterName = (String) e.nextElement(); addRow(debuggingPrinter, parameterName, debuggingPrinter.transform(request.getHeader(parameterName))); } debuggingPrinter.endSection(); debuggingPrinter.addSection("Request Attributes"); java.util.Enumeration en = request.getAttributeNames(); while (en.hasMoreElements()) { String attrName = (String) en.nextElement(); try { addRow(debuggingPrinter, split(attrName, 50), toString2(request.getAttribute(attrName), 120)); } catch (Exception e) { addRow(debuggingPrinter, split(attrName, 50), toString(e, 120)); } } debuggingPrinter.endSection(); debuggingPrinter.addSection("Session Attributes"); en = session.getAttributeNames(); while (en.hasMoreElements()) { String attrName = (String) en.nextElement(); try { addRow(debuggingPrinter, split(attrName, 50), toString2(session.getAttribute(attrName), 120)); } catch (Exception e) { addRow(debuggingPrinter, split(attrName, 50), toString(e, 120)); } } debuggingPrinter.endSection(); debuggingPrinter.addSection("Request Info"); addRow(debuggingPrinter, "AuthType", request.getAuthType()); addRow(debuggingPrinter, "ContextPath", request.getContextPath()); addRow(debuggingPrinter, "Method", request.getMethod()); addRow(debuggingPrinter, "PathInfo", request.getPathInfo()); addRow(debuggingPrinter, "PathTranslated", request.getPathTranslated()); addRow(debuggingPrinter, "Protocol", request.getProtocol()); addRow(debuggingPrinter, "QueryString", request.getQueryString()); addRow(debuggingPrinter, "RemoteAddr", request.getRemoteAddr()); addRow(debuggingPrinter, "RemoteUser", request.getRemoteUser()); addRow(debuggingPrinter, "RequestedSessionId", request.getRequestedSessionId()); addRow(debuggingPrinter, "RequestURI", request.getRequestURI()); addRow(debuggingPrinter, "RequestURL", request.getRequestURL().toString()); addRow(debuggingPrinter, "ServletPath", request.getServletPath()); addRow(debuggingPrinter, "Scheme", request.getScheme()); addRow(debuggingPrinter, "ServletPath", request.getServletPath()); } if (debugAll) { debuggingPrinter.addSection("Server"); addRow(debuggingPrinter, "Server Info", servletContext.getServerInfo()); addRow(debuggingPrinter, "Servlet Engine Version", servletContext.getMajorVersion() + "." + servletContext.getMinorVersion()); addRow(debuggingPrinter, "JSP Version", jspFactory.getEngineInfo().getSpecificationVersion()); debuggingPrinter.endSection(); debuggingPrinter.addSection("JVM Properties"); for (Enumeration e = System.getProperties().propertyNames(); e.hasMoreElements();) { String parameterName = (String) e.nextElement(); addRow(debuggingPrinter, parameterName, debuggingPrinter.transform(System.getProperty(parameterName))); } debuggingPrinter.endSection(); debuggingPrinter.addSection("Environment"); for (Map.Entry<String, String> property : System.getenv().entrySet()) { addRow(debuggingPrinter, property.getKey(), debuggingPrinter.transform(property.getValue())); } debuggingPrinter.endSection(); debuggingPrinter.addSection("Debugger Provided by"); addRow(debuggingPrinter, "provided by", "raisercostin"); debuggingPrinter.addRow("source", "<a target='_blank' href='http://code.google.com/p/raisercostin/wiki/DebuggingFilter'>http://code.google.com/p/raisercostin/wiki/DebuggingFilter</a>"); addRow(debuggingPrinter, "version", "1.0"); addRow(debuggingPrinter, "timestamp", "2008.June.14"); addRow(debuggingPrinter, "license", "<a target='_blank' href='http://www.apache.org/licenses/LICENSE-2.0.html'>Apache License 2.0</a>"); debuggingPrinter.endSection(); } debuggingPrinter.addFooter(); return debuggingPrinter.getString(); }