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.subject; 020 021import org.apache.shiro.subject.SubjectContext; 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 SubjectContext} that additionally provides for type-safe 029 * methods to set and retrieve a {@link ServletRequest} and {@link ServletResponse}. 030 * 031 * @since 1.0 032 */ 033public interface WebSubjectContext extends SubjectContext, RequestPairSource { 034 035 /** 036 * Returns the {@code ServletRequest} received by the servlet container triggering the creation of the 037 * {@code Subject} instance. 038 * 039 * @return the {@code ServletRequest} received by the servlet container triggering the creation of the 040 * {@code Subject} instance. 041 */ 042 ServletRequest getServletRequest(); 043 044 /** 045 * Sets the {@code ServletRequest} received by the servlet container triggering the creation of the 046 * {@code Subject} instance. 047 * 048 * @param request the {@code ServletRequest} received by the servlet container triggering the creation of the 049 * {@code Subject} instance. 050 */ 051 void setServletRequest(ServletRequest request); 052 053 ServletRequest resolveServletRequest(); 054 055 /** 056 * The paired {@code ServletResponse} corresponding to the associated {@link #getServletRequest servletRequest}. 057 * 058 * @return the paired {@code ServletResponse} corresponding to the associated 059 * {@link #getServletRequest servletRequest}. 060 */ 061 ServletResponse getServletResponse(); 062 063 /** 064 * Sets the paired {@code ServletResponse} corresponding to the associated {@link #getServletRequest servletRequest}. 065 * 066 * @param response The paired {@code ServletResponse} corresponding to the associated 067 * {@link #getServletRequest servletRequest}. 068 */ 069 void setServletResponse(ServletResponse response); 070 071 ServletResponse resolveServletResponse(); 072}