当前位置: 首页>>代码示例>>Java>>正文


Java ServletRequest.getRemoteHost方法代码示例

本文整理汇总了Java中javax.servlet.ServletRequest.getRemoteHost方法的典型用法代码示例。如果您正苦于以下问题:Java ServletRequest.getRemoteHost方法的具体用法?Java ServletRequest.getRemoteHost怎么用?Java ServletRequest.getRemoteHost使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.servlet.ServletRequest的用法示例。


在下文中一共展示了ServletRequest.getRemoteHost方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: resolveHost

import javax.servlet.ServletRequest; //导入方法依赖的package包/类
public String resolveHost() {
    String host = getHost();

    if (host == null) {
        //check to see if there is an AuthenticationToken from which to retrieve it:

        /*
        AuthenticationToken token = getAuthenticationToken();
        if (token instanceof HostAuthenticationToken) {
            host = ((HostAuthenticationToken) token).getHost();
        }
        */
    }

    if (host == null) {
        Session session = resolveSession();
        if (session != null) {
            host = session.getHost();
        }
    }

    if (host == null) {
        ServletRequest request = resolveServletRequest();
        if (request != null) {
            host = request.getRemoteHost();
        }
    }
    return host;
}
 
开发者ID:atbashEE,项目名称:atbash-octopus,代码行数:30,代码来源:WebSubjectContext.java

示例2: getHost

import javax.servlet.ServletRequest; //导入方法依赖的package包/类
/**
 * Returns the host name or IP associated with the current subject.  This method is primarily provided for use
 * during construction of an <code>AuthenticationToken</code>.
 * <p/>
 * The default implementation merely returns {@link ServletRequest#getRemoteHost()}.
 *
 * @param request the incoming ServletRequest
 * @return the <code>InetAddress</code> to associate with the login attempt.
 */
protected String getHost(ServletRequest request) {
    return request.getRemoteHost();
}
 
开发者ID:atbashEE,项目名称:atbash-octopus,代码行数:13,代码来源:AuthenticatingFilter.java


注:本文中的javax.servlet.ServletRequest.getRemoteHost方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。