Package org.dspace.service.impl
Class ClientInfoServiceImpl
- java.lang.Object
-
- org.dspace.service.impl.ClientInfoServiceImpl
-
- All Implemented Interfaces:
ClientInfoService
public class ClientInfoServiceImpl extends Object implements ClientInfoService
Implementation ofClientInfoServicethat can provide information on DSpace client requests- Author:
- tom dot desair at gmail dot com
-
-
Constructor Summary
Constructors Constructor Description ClientInfoServiceImpl(ConfigurationService configurationService)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetClientIp(String remoteIp, String xForwardedForHeaderValue)Get the client IP of this request taking into account the X-Forwarded-For header and the "useProxies" settingStringgetClientIp(javax.servlet.http.HttpServletRequest request)Get the client IP of this request taking into account the X-Forwarded-For header and the "useProxies" settingbooleanisRequestFromTrustedProxy(String ipAddress)Whether a request is from a trusted proxy or not.booleanisUseProxiesEnabled()Does DSpace take into account HTTP proxy headers or not
-
-
-
Constructor Detail
-
ClientInfoServiceImpl
@Autowired(required=true) public ClientInfoServiceImpl(ConfigurationService configurationService)
-
-
Method Detail
-
getClientIp
public String getClientIp(javax.servlet.http.HttpServletRequest request)
Description copied from interface:ClientInfoServiceGet the client IP of this request taking into account the X-Forwarded-For header and the "useProxies" setting- Specified by:
getClientIpin interfaceClientInfoService- Parameters:
request- The client HTTP request- Returns:
- The IP address of the originating client
-
getClientIp
public String getClientIp(String remoteIp, String xForwardedForHeaderValue)
Description copied from interface:ClientInfoServiceGet the client IP of this request taking into account the X-Forwarded-For header and the "useProxies" setting- Specified by:
getClientIpin interfaceClientInfoService- Parameters:
remoteIp- the remote address of the current requestxForwardedForHeaderValue- The value of the X-Forwarded-For header- Returns:
- The IP address of the originating client
-
isUseProxiesEnabled
public boolean isUseProxiesEnabled()
Description copied from interface:ClientInfoServiceDoes DSpace take into account HTTP proxy headers or not- Specified by:
isUseProxiesEnabledin interfaceClientInfoService- Returns:
- true if this is the case, false otherwise
-
isRequestFromTrustedProxy
public boolean isRequestFromTrustedProxy(String ipAddress)
Whether a request is from a trusted proxy or not. Only returns true if trusted proxies are specified and the ipAddress is contained in those proxies. False in all other cases- Specified by:
isRequestFromTrustedProxyin interfaceClientInfoService- Parameters:
ipAddress- IP address to check for- Returns:
- true if trusted, false otherwise
-
-