ttomcat-1778514358873.zip-extract/apache-tomcat-11.0.18-src/java/org/apache/jasper/compiler/NewlineReductionServletWriter.java

Path
ttomcat-1778514358873.zip-extract/apache-tomcat-11.0.18-src/java/org/apache/jasper/compiler/NewlineReductionServletWriter.java
Status
scanned
Type
file
Name
NewlineReductionServletWriter.java
Extension
.java
Programming language
Java
Mime type
text/plain
File type
ASCII text, with CRLF line terminators
Tag

      
    
Rootfs path

      
    
Size
1974 (1.9 KB)
MD5
2b1f4bbf169c7cadc2be82bc0739b9fa
SHA1
7e9b003447fdbb1a76a35f345a85eb73e841c364
SHA256
6dd78fcf198b3dcde40be2aaf24161c71e413498f947efa28cea808352679c8c
SHA512

      
    
SHA1_git
0733420ef28042c8a74491dea8fc1450383a67fe
Is binary

      
    
Is text
True
Is archive

      
    
Is media

      
    
Is legal

      
    
Is manifest

      
    
Is readme

      
    
Is top level

      
    
Is key file

      
    
NewlineReductionServletWriter.java | 1.9 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 org.apache.jasper.compiler; import java.io.PrintWriter; /** * This class filters duplicate newlines instructions from the compiler output, and therefore from the runtime JSP. The * duplicates typically happen because the compiler has multiple branches that write them, but they operate * independently and don't realize that the previous output was identical. Removing these lines makes the JSP more * efficient by executing fewer operations during runtime. */ public class NewlineReductionServletWriter extends ServletWriter { private static final String NEWLINE_WRITE_TEXT = "out.write('\ ');"; private boolean lastWriteWasNewline; public NewlineReductionServletWriter(PrintWriter writer) { super(writer); } @Override public void printil(String s) { if (s.equals(NEWLINE_WRITE_TEXT)) { if (lastWriteWasNewline) { // do nothing return; } else { lastWriteWasNewline = true; } } else { lastWriteWasNewline = false; } super.printil(s); } }
Detected license expression
apache-2.0
Detected license expression (SPDX)
Apache-2.0
Percentage of license text
51.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