001/*
002 * Copyright 2024-2026 Revetware LLC.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017package com.soklet.servlet.javax;
018
019import org.jspecify.annotations.NonNull;
020import org.jspecify.annotations.Nullable;
021
022import javax.annotation.concurrent.Immutable;
023import javax.servlet.http.HttpSession;
024import javax.servlet.http.HttpSessionContext;
025import java.util.Collections;
026import java.util.Enumeration;
027
028/**
029 * Soklet integration implementation of {@link HttpSessionContext}.
030 * <p>
031 * <strong>Note that {@link HttpSessionContext} is deprecated, so this implementation is as well.</strong>
032 *
033 * @author <a href="https://www.revetkn.com">Mark Allen</a>
034 */
035@Immutable
036@Deprecated
037public final class SokletHttpSessionContext implements HttpSessionContext {
038        @NonNull
039        public static SokletHttpSessionContext fromDefaults() {
040                return new SokletHttpSessionContext();
041        }
042
043        private SokletHttpSessionContext() {
044                // Nothing to do
045        }
046
047        // Implementation of HttpSessionContext methods below:
048
049        @Override
050        @Nullable
051        @Deprecated
052        public HttpSession getSession(@Nullable String sessionId) {
053                // Per spec
054                return null;
055        }
056
057        @Override
058        @NonNull
059        @Deprecated
060        public Enumeration<@NonNull String> getIds() {
061                // Per spec
062                return Collections.emptyEnumeration();
063        }
064}