ttomcat-1778514358873.zip-extract/apache-tomcat-11.0.18-src/webapps/examples/WEB-INF/classes/RequestInfoExample.java

Path
ttomcat-1778514358873.zip-extract/apache-tomcat-11.0.18-src/webapps/examples/WEB-INF/classes/RequestInfoExample.java
Status
scanned
Type
file
Name
RequestInfoExample.java
Extension
.java
Programming language
Java
Mime type
text/html
File type
HTML document, ASCII text, with CRLF line terminators
Tag

      
    
Rootfs path

      
    
Size
4510 (4.4 KB)
MD5
0031f753bb73dbede64f4e6c8aa24153
SHA1
ef463d90a1619fe9dc7503a18cc41d0802330445
SHA256
97d5a86bf4443ee6e8c3a13fda8c3b3a3fe76761c10eaa8b536ee0144c4e0328
SHA512

      
    
SHA1_git
3acdf70949a029637013ff97fc1d686826d14318
Is binary

      
    
Is text
True
Is archive

      
    
Is media

      
    
Is legal

      
    
Is manifest

      
    
Is readme

      
    
Is top level

      
    
Is key file

      
    
RequestInfoExample.java | 4.4 KB |

/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import java.io.IOException; import java.io.PrintWriter; import java.util.ResourceBundle; import jakarta.servlet.ServletException; import jakarta.servlet.http.HttpServlet; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; import util.HTMLFilter; /** * Example servlet showing request information. */ public class RequestInfoExample extends HttpServlet { private static final long serialVersionUID = 1L; @Override public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { ResourceBundle rb = ResourceBundle.getBundle("LocalStrings", request.getLocale()); response.setContentType("text/html"); response.setCharacterEncoding("UTF-8"); PrintWriter out = response.getWriter(); out.println("<!DOCTYPE html><html>"); out.println("<head>"); out.println("<meta charset=\"UTF-8\" />"); String title = rb.getString("requestinfo.title"); out.println("<title>" + title + "</title>"); out.println("</head>"); out.println("<body bgcolor=\"white\">"); /* * Can't use relative paths since this servlet might have pathInfo. Allows for deployment to a different context * path but otherwise assumes that the web application structure is not changed. */ String baseURI = request.getServletContext().getContextPath() + "/servlets"; out.println("<a href=\"" + baseURI + "/reqinfo.html\">"); out.println("<img src=\"" + baseURI + "/images/code.gif\" height=24 " + "width=24 align=right border=0 alt=\"view code\"></a>"); out.println("<a href=\"" + baseURI + "/index.html\">"); out.println("<img src=\"" + baseURI + "/images/return.gif\" height=24 " + "width=24 align=right border=0 alt=\"return\"></a>"); out.println("<h3>" + title + "</h3>"); out.println("<table border=0><tr><td>"); out.println(rb.getString("requestinfo.label.method")); out.println("</td><td>"); out.println(HTMLFilter.filter(request.getMethod())); out.println("</td></tr><tr><td>"); out.println(rb.getString("requestinfo.label.requesturi")); out.println("</td><td>"); out.println(HTMLFilter.filter(request.getRequestURI())); out.println("</td></tr><tr><td>"); out.println(rb.getString("requestinfo.label.protocol")); out.println("</td><td>"); out.println(HTMLFilter.filter(request.getProtocol())); out.println("</td></tr><tr><td>"); out.println(rb.getString("requestinfo.label.pathinfo")); out.println("</td><td>"); out.println(HTMLFilter.filter(request.getPathInfo())); out.println("</td></tr><tr><td>"); out.println(rb.getString("requestinfo.label.remoteaddr")); out.println("</td><td>"); out.println(HTMLFilter.filter(request.getRemoteAddr())); out.println("</td></tr>"); String cipherSuite = (String) request.getAttribute("jakarta.servlet.request.cipher_suite"); if (cipherSuite != null) { out.println("<tr><td>"); out.println("SSLCipherSuite:"); out.println("</td><td>"); out.println(HTMLFilter.filter(cipherSuite)); out.println("</td></tr>"); } out.println("</table>"); } @Override public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { doGet(request, response); } }
Detected license expression
apache-2.0
Detected license expression (SPDX)
Apache-2.0
Percentage of license text
27.29
Copyrights

      
    
Holders

      
    
Authors

      
    
License detections License expression License expression SPDX
apache_2_0-4bde3f57-78aa-4201-96bf-531cba09e7de apache-2.0 Apache-2.0
URL Start line End line
http://www.apache.org/licenses/LICENSE-2.0 9 9