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

Path
ttomcat-1778514358873.zip-extract/apache-tomcat-11.0.18-src/webapps/examples/WEB-INF/classes/trailers/ResponseTrailers.java
Status
scanned
Type
file
Name
ResponseTrailers.java
Extension
.java
Programming language
Java
Mime type
text/plain
File type
Perl5 module source, ASCII text, with CRLF line terminators
Tag

      
    
Rootfs path

      
    
Size
2359 (2.3 KB)
MD5
bd1bd5a74fef159369ad17050afebabe
SHA1
20069c26a676adaa17e4cd7971c42809ad916e3c
SHA256
381c0bf7dfb0496e882165ba0c263899392d505a782318c8c3a1fd0c6345c267
SHA512

      
    
SHA1_git
fcd5f48b5b55160d04933a2bf20a9eb3f16dabd1
Is binary

      
    
Is text
True
Is archive

      
    
Is media

      
    
Is legal

      
    
Is manifest

      
    
Is readme

      
    
Is top level

      
    
Is key file

      
    
ResponseTrailers.java | 2.3 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. */ package trailers; import java.io.IOException; import java.io.PrintWriter; import java.util.HashMap; import java.util.Map; import java.util.function.Supplier; import jakarta.servlet.ServletException; import jakarta.servlet.http.HttpServlet; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; /** * This example writes some trailer fields to the HTTP response. */ public class ResponseTrailers extends HttpServlet { private static final long serialVersionUID = 1L; private static final Supplier<Map<String,String>> TRAILER_FIELD_SUPPLIER = new TrailerFieldSupplier(); @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { resp.setTrailerFields(TRAILER_FIELD_SUPPLIER); resp.setContentType("text/plain"); resp.setCharacterEncoding("UTF-8"); PrintWriter pw = resp.getWriter(); pw.print("This response should include trailer fields."); } private static class TrailerFieldSupplier implements Supplier<Map<String,String>> { private static final Map<String,String> trailerFields = new HashMap<>(); static { trailerFields.put("x-trailer-1", "Trailer value one"); trailerFields.put("x-trailer-2", "Trailer value two"); } @Override public Map<String, String> get() { return trailerFields; } } }
Detected license expression
apache-2.0
Detected license expression (SPDX)
Apache-2.0
Percentage of license text
43.91
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