001/* 002 * Copyright 2002-2019 the original author or authors. 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 * https://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 org.springframework.http.server; 018 019import java.net.InetSocketAddress; 020import java.security.Principal; 021 022import org.springframework.http.HttpInputMessage; 023import org.springframework.http.HttpRequest; 024import org.springframework.lang.Nullable; 025 026/** 027 * Represents a server-side HTTP request. 028 * 029 * @author Arjen Poutsma 030 * @author Rossen Stoyanchev 031 * @since 3.0 032 */ 033public interface ServerHttpRequest extends HttpRequest, HttpInputMessage { 034 035 /** 036 * Return a {@link java.security.Principal} instance containing the name of the 037 * authenticated user. 038 * <p>If the user has not been authenticated, the method returns <code>null</code>. 039 */ 040 @Nullable 041 Principal getPrincipal(); 042 043 /** 044 * Return the address on which the request was received. 045 */ 046 InetSocketAddress getLocalAddress(); 047 048 /** 049 * Return the address of the remote client. 050 */ 051 InetSocketAddress getRemoteAddress(); 052 053 /** 054 * Return a control that allows putting the request in asynchronous mode so the 055 * response remains open until closed explicitly from the current or another thread. 056 */ 057 ServerHttpAsyncRequestControl getAsyncRequestControl(ServerHttpResponse response); 058 059}