ttomcat-1778514358873.zip-extract/apache-tomcat-11.0.18-src/java/org/apache/catalina/session/StandardSessionAccessor.java

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

      
    
Rootfs path

      
    
Size
2918 (2.8 KB)
MD5
bc46b8263f1a8e9fef6397e7bf9381bf
SHA1
2a72e76081c81a12a1f326c30758ab2d4311adc5
SHA256
bb0ce4ba108c805c47fa224e391773037c30482f97fb1bd968acb00575df029b
SHA512

      
    
SHA1_git
cabeb5c63b3b5bc2b39e15b20a68446517b9068f
Is binary

      
    
Is text
True
Is archive

      
    
Is media

      
    
Is legal

      
    
Is manifest

      
    
Is readme

      
    
Is top level

      
    
Is key file

      
    
StandardSessionAccessor.java | 2.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. */ package org.apache.catalina.session; import java.io.IOException; import java.util.function.Consumer; import jakarta.servlet.http.HttpSession; import org.apache.catalina.Manager; import org.apache.catalina.Session; import org.apache.juli.logging.Log; import org.apache.juli.logging.LogFactory; import org.apache.tomcat.util.ExceptionUtils; import org.apache.tomcat.util.res.StringManager; public class StandardSessionAccessor implements HttpSession.Accessor { private static final Log log = LogFactory.getLog(StandardSessionAccessor.class); private static final StringManager sm = StringManager.getManager(StandardSessionAccessor.class); private final Manager manager; private final String id; public StandardSessionAccessor(Manager manager, String id) { if (manager == null) { throw new IllegalStateException(sm.getString("standardSessionAccessor.nullManager")); } if (id == null) { throw new IllegalStateException(sm.getString("standardSessionAccessor.nullId")); } this.manager = manager; this.id = id; } @Override public void access(Consumer<HttpSession> sessionConsumer) { Session session; try { session = manager.findSession(id); } catch (IOException ioe) { throw new IllegalStateException(sm.getString("standardSessionAccessor.access.ioe", id)); } if (session == null || !session.isValid()) { // Should never be null but include it here just in case throw new IllegalStateException(sm.getString("standardSessionAccessor.access.invalid", id)); } session.access(); try { sessionConsumer.accept(session.getSession()); } finally { try { session.endAccess(); } catch (Throwable t) { ExceptionUtils.handleThrowable(t); log.warn(sm.getString("standardSessionAccessor.access.end"), t); } } } }
Detected license expression
apache-2.0
Detected license expression (SPDX)
Apache-2.0
Percentage of license text
38.39
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