Package java.net

Examples of java.net.SocketPermission$EphemeralRange


    public void checkConnect(String host, int port) {
        if (host == null) {
            throw new NullPointerException();
        }
        if (port > 0) {
            checkPermission(new SocketPermission(host + ':' + port, "connect")); //$NON-NLS-1$
        } else {
            checkPermission(new SocketPermission(host, "resolve")); //$NON-NLS-1$
        }
    }
View Full Code Here


     *             if {@code context} is not allowed to connect to {@code host}
     *             through {@code port}.
     */
    public void checkConnect(String host, int port, Object context) {
        if (port > 0) {
            checkPermission(new SocketPermission(host + ':' + port, "connect"), //$NON-NLS-1$
                    context);
        } else {
            checkPermission(new SocketPermission(host, "resolve"), context); //$NON-NLS-1$
        }
    }
View Full Code Here

     * @throws SecurityException
     *             if the calling thread is not allowed listen on {@code port}.
     */
    public void checkListen(int port) {
        if (port == 0) {
            checkPermission(new SocketPermission("localhost:1024-", "listen")); //$NON-NLS-1$ //$NON-NLS-2$
        } else {
            checkPermission(new SocketPermission("localhost:" + port, "listen")); //$NON-NLS-1$//$NON-NLS-2$
        }
    }
View Full Code Here

     *            the internet group address to use.
     * @throws SecurityException
     *             if the calling thread is not allowed to use {@code maddr}.
     */
    public void checkMulticast(InetAddress maddr) {
        checkPermission(new SocketPermission(maddr.getHostAddress(),
                "accept,connect")); //$NON-NLS-1$
    }
View Full Code Here

        // Check the security mananger
        SecurityManager manager = System.getSecurityManager();

        if (manager != null) {
            try {
                manager.checkPermission(new SocketPermission(addressToBind +
                        ":" + String.valueOf(portToBind), "accept,listen"));
            } catch (SecurityException e) {
                throw new ForwardingConfigurationException(
                    "The security manager has denied listen permision on " +
                    addressToBind + ":" + String.valueOf(portToBind));
View Full Code Here

        // Check the security mananger
        SecurityManager manager = System.getSecurityManager();

        if (manager != null) {
            try {
                manager.checkPermission(new SocketPermission(hostToConnect +
                        ":" + String.valueOf(portToConnect), "connect"));
            } catch (SecurityException e) {
                throw new ForwardingConfigurationException(
                    "The security manager has denied connect permision on " +
                    hostToConnect + ":" + String.valueOf(portToConnect));
View Full Code Here

        // Check the security mananger
        SecurityManager manager = System.getSecurityManager();

        if (manager != null) {
            try {
                manager.checkPermission(new SocketPermission(fwd.getHostToConnect() +
                        ":" + String.valueOf(fwd.getPortToConnect()), "connect"));
            } catch (SecurityException e) {
                throw new ForwardingConfigurationException(
                    "The security manager has denied connect permision on " +
                    fwd.getHostToConnect() + ":" +
View Full Code Here

        // Check the security mananger
        SecurityManager manager = System.getSecurityManager();

        if (manager != null) {
            try {
                manager.checkPermission(new SocketPermission(addressToBind +
                        ":" + String.valueOf(portToBind), "accept,listen"));
            } catch (SecurityException e) {
                throw new ForwardingConfigurationException(
                    "The security manager has denied listen permision on " +
                    addressToBind + ":" + String.valueOf(portToBind));
View Full Code Here

            } else if (!thisHost.equals(thatHost)) {
                if (thatHost == null) {
                    return false;
                }
                if (this.sp == null) {
                    this.sp = new SocketPermission(thisHost, "resolve");
                }
                if (that.sp == null) {
                    that.sp = new SocketPermission(thatHost, "resolve");
                }
                if (!this.sp.implies(that.sp)) {
                    return false;
                }
            }
View Full Code Here

        }
        if (!host.startsWith("[") && host.indexOf(':') != -1) {
            host = "[" + host + "]";
        }
        if (port == -1) {
            checkPermission(new SocketPermission(host,
                SecurityConstants.SOCKET_RESOLVE_ACTION));
        } else {
            checkPermission(new SocketPermission(host+":"+port,
                SecurityConstants.SOCKET_CONNECT_ACTION));
        }
    }
View Full Code Here

TOP

Related Classes of java.net.SocketPermission$EphemeralRange

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.