001/* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, 013 * software distributed under the License is distributed on an 014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 015 * KIND, either express or implied. See the License for the 016 * specific language governing permissions and limitations 017 * under the License. 018 */ 019package org.apache.shiro.web.session.mgt; 020 021import org.apache.shiro.session.mgt.SessionContext; 022import org.apache.shiro.web.util.RequestPairSource; 023 024import javax.servlet.ServletRequest; 025import javax.servlet.ServletResponse; 026 027/** 028 * A {@code WebSubjectContext} is a {@link SessionContext} that additionally provides for type-safe 029 * methods to set and retrieve a {@link ServletRequest} and {@link ServletResponse}, as the request/response pair will 030 * often need to be referenced during construction of web-initiated {@code Session} instances. 031 * 032 * @since 1.0 033 */ 034public interface WebSessionContext extends SessionContext, RequestPairSource { 035 036 /** 037 * Returns the {@code ServletRequest} received by the servlet container triggering the creation of the 038 * {@code Session} instance. 039 * 040 * @return the {@code ServletRequest} received by the servlet container triggering the creation of the 041 * {@code Session} instance. 042 */ 043 ServletRequest getServletRequest(); 044 045 /** 046 * Sets the {@code ServletRequest} received by the servlet container triggering the creation of the 047 * {@code Session} instance. 048 * 049 * @param request the {@code ServletRequest} received by the servlet container triggering the creation of the 050 * {@code Session} instance. 051 */ 052 void setServletRequest(ServletRequest request); 053 054 /** 055 * The paired {@code ServletResponse} corresponding to the associated {@link #getServletRequest servletRequest}. 056 * 057 * @return the paired {@code ServletResponse} corresponding to the associated 058 * {@link #getServletRequest servletRequest}. 059 */ 060 ServletResponse getServletResponse(); 061 062 /** 063 * Sets the paired {@code ServletResponse} corresponding to the associated {@link #getServletRequest servletRequest}. 064 * 065 * @param response The paired {@code ServletResponse} corresponding to the associated 066 * {@link #getServletRequest servletRequest}. 067 */ 068 void setServletResponse(ServletResponse response); 069}