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

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

      
    
Rootfs path

      
    
Size
3869 (3.8 KB)
MD5
e82bab34fc15bef68a03360fb761154b
SHA1
42dafed7a223089594ce4cd8b80a3407be84f617
SHA256
55c6ca0fe31929b9a22c347f0ab4ee1de0c1888f974aab7f16d9ea002edc10b3
SHA512

      
    
SHA1_git
14827da513c10465bb189be10e2821dac4b72412
Is binary

      
    
Is text
True
Is archive

      
    
Is media

      
    
Is legal

      
    
Is manifest

      
    
Is readme

      
    
Is top level

      
    
Is key file

      
    
RequestParamExample.java | 3.8 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 headers */ public class RequestParamExample 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("requestparams.title"); out.println("<title>" + title + "</title>"); out.println("</head>"); out.println("<body bgcolor=\"white\">"); out.println("<a href=\"../reqparams.html\">"); out.println( "<img src=\"../images/code.gif\" height=24 " + "width=24 align=right border=0 alt=\"view code\"></a>"); out.println("<a href=\"../index.html\">"); out.println( "<img src=\"../images/return.gif\" height=24 " + "width=24 align=right border=0 alt=\"return\"></a>"); out.println("<h3>" + title + "</h3>"); String firstName = request.getParameter("firstname"); String lastName = request.getParameter("lastname"); out.println(rb.getString("requestparams.params-in-req") + "<br>"); if (firstName != null || lastName != null) { out.println(rb.getString("requestparams.firstname")); out.println(" = " + HTMLFilter.filter(firstName) + "<br>"); out.println(rb.getString("requestparams.lastname")); out.println(" = " + HTMLFilter.filter(lastName)); } else { out.println(rb.getString("requestparams.no-params")); } out.println("<P>"); out.print("<form action=\""); out.print("RequestParamExample\" "); out.println("method=POST>"); out.println(rb.getString("requestparams.firstname")); out.println("<input type=text size=20 name=firstname>"); out.println("<br>"); out.println(rb.getString("requestparams.lastname")); out.println("<input type=text size=20 name=lastname>"); out.println("<br>"); out.println("<input type=submit>"); out.println("</form>"); out.println("</body>"); out.println("</html>"); } @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
30.43
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