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


Java RemoteServer.getClientHost方法代码示例

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


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

示例1: if

import java.rmi.server.RemoteServer; //导入方法依赖的package包/类
public void addDistributee
        (JournalMirroringClient distributee, TransactionDigest synchronizationBase)
        throws NegotiationException {
    try {
        String distributeeHost = RemoteServer.getClientHost();
        if (!authenticate(InetAddress.getByName(distributeeHost))) {
            logMessage("unauthorized access, " + distributeeHost);
            throw new NegotiationException("authentication failed.");
        }

        ClientAgent agent
                = new ClientAgent(JournalDistributor.this, distributee, synchronizationBase);
        agent.logMessage(distributeeHost);
    } catch (NegotiationException ne) {
        throw ne;
    } catch (Exception e) {
        tefService_.logError("", e);
        throw new NegotiationException(e);
    }
}
 
开发者ID:openNaEF,项目名称:openNaEF,代码行数:21,代码来源:JournalDistributor.java

示例2: checkAccessPrivilegies

import java.rmi.server.RemoteServer; //导入方法依赖的package包/类
/**
 * Checks if the current client has privilegies to modify the contents of
 * the registry. All non-local clients should be rejected.
 * 
 * @throws AccessException
 *             if registry denies the caller access to perform this
 *             operation
 */
private final void checkAccessPrivilegies() throws AccessException {
    String hostName;
    try {
        hostName = RemoteServer.getClientHost();
    } catch (ServerNotActiveException e) {
        // if no remote host is currently executing this method,
        // then is localhost, and the access should be granted.
        return;
    }
    if (hostName == null) {
        throw new AccessException("Can not get remote host address.");
    }
    if (!localIPs.contains(hostName)) {
        throw new AccessException(
                "Registry can not be modified by this host.");
    }
}
 
开发者ID:freeVM,项目名称:freeVM,代码行数:26,代码来源:RegistryImpl.java

示例3: makeConnectionId

import java.rmi.server.RemoteServer; //导入方法依赖的package包/类
private static synchronized String makeConnectionId(String protocol,
                                                    Subject subject) {
    connectionIdNumber++;

    String clientHost = "";
    try {
        clientHost = RemoteServer.getClientHost();
        /*
         * According to the rules specified in the javax.management.remote
         * package description, a numeric IPv6 address (detected by the
         * presence of otherwise forbidden ":" character) forming a part
         * of the connection id must be enclosed in square brackets.
         */
        if (clientHost.contains(":")) {
            clientHost = "[" + clientHost + "]";
        }
    } catch (ServerNotActiveException e) {
        logger.trace("makeConnectionId", "getClientHost", e);
    }

    final StringBuilder buf = new StringBuilder();
    buf.append(protocol).append(":");
    if (clientHost.length() > 0)
        buf.append("//").append(clientHost);
    buf.append(" ");
    if (subject != null) {
        Set<Principal> principals = subject.getPrincipals();
        String sep = "";
        for (Iterator<Principal> it = principals.iterator(); it.hasNext(); ) {
            Principal p = it.next();
            String name = p.getName().replace(' ', '_').replace(';', ':');
            buf.append(sep).append(name);
            sep = ";";
        }
    }
    buf.append(" ").append(connectionIdNumber);
    if (logger.traceOn())
        logger.trace("newConnectionId","connectionId="+buf);
    return buf.toString();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:41,代码来源:RMIServerImpl.java

示例4: makeConnectionId

import java.rmi.server.RemoteServer; //导入方法依赖的package包/类
private static synchronized String makeConnectionId(String protocol,
                                                    Subject subject) {
    connectionIdNumber++;

    String clientHost = "";
    try {
        clientHost = RemoteServer.getClientHost();
    } catch (ServerNotActiveException e) {
        logger.trace("makeConnectionId", "getClientHost", e);
    }

    final StringBuilder buf = new StringBuilder();
    buf.append(protocol).append(":");
    if (clientHost.length() > 0)
        buf.append("//").append(clientHost);
    buf.append(" ");
    if (subject != null) {
        Set<Principal> principals = subject.getPrincipals();
        String sep = "";
        for (Iterator<Principal> it = principals.iterator(); it.hasNext(); ) {
            Principal p = it.next();
            String name = p.getName().replace(' ', '_').replace(';', ':');
            buf.append(sep).append(name);
            sep = ";";
        }
    }
    buf.append(" ").append(connectionIdNumber);
    if (logger.traceOn())
        logger.trace("newConnectionId","connectionId="+buf);
    return buf.toString();
}
 
开发者ID:openjdk,项目名称:jdk7-jdk,代码行数:32,代码来源:RMIServerImpl.java

示例5: getClientHost

import java.rmi.server.RemoteServer; //导入方法依赖的package包/类
String getClientHost(){
	String clienthost=null;
	try{
		clienthost = RemoteServer.getClientHost();
	}catch(ServerNotActiveException ex){
		LogUtil.fine("[MementoService]", "[getClientHost]", ex);
	}
	//System.out.println("clienthost:"+clienthost);
	return clienthost;
}
 
开发者ID:muzi666boy,项目名称:fourinone,代码行数:11,代码来源:MementoService.java

示例6: testGetClientHost

import java.rmi.server.RemoteServer; //导入方法依赖的package包/类
public void testGetClientHost() {
    try {
        RemoteServer.getClientHost();
        fail();
    } catch (ServerNotActiveException e) {
    	// expected
    }
}
 
开发者ID:freeVM,项目名称:freeVM,代码行数:9,代码来源:RemoteServerTest.java

示例7: getClientHost

import java.rmi.server.RemoteServer; //导入方法依赖的package包/类
public String getClientHost() throws ServerNotActiveException
{
  return RemoteServer.getClientHost();
}
 
开发者ID:vilie,项目名称:javify,代码行数:5,代码来源:UnicastServerRef.java


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