java.lang.Object | ||
↳ | java.security.Permission | |
↳ | java.net.SocketPermission |
Regulates the access to network operations available through sockets through
permissions. A permission consists of a target (a host), and an associated
action list. The target should identify the host by either indicating the
(possibly wildcarded (eg. .company.com
)) DNS style name of the host
or its IP address in standard nn.nn.nn.nn
("dot") notation. The
action list can be made up of one or more of the following actions separated
by a comma:
resolve
is implied when any (or none) of the others are
present.
Access to a particular port can be requested by appending a colon and a
single digit to the name (eg. .company.com:7000
). A range of port
numbers can also be specified, by appending a pattern of the form
LOW-HIGH where LOW and HIGH are valid port numbers. If
either LOW or HIGH is omitted it is equivalent to entering the
lowest or highest possible value respectively. For example:
SocketPermission("www.company.com:7000-", "connect,accept")
represents the permission to connect to and accept connections from www.company.com
on ports in the range 7000
to 65535
.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Constructs a new
SocketPermission instance. |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Compares the argument
o to this instance and returns true
if they represent the same permission using a class specific comparison. | |||||||||||
Gets a comma-separated list of all actions allowed by this permission.
| |||||||||||
Returns the hash value for this
SocketPermission instance. | |||||||||||
Checks whether this
SocketPermission instance allows all actions
which are allowed by the given permission object p . | |||||||||||
Creates a new
PermissionCollection to store SocketPermission objects. |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class java.security.Permission
| |||||||||||
From class java.lang.Object
| |||||||||||
From interface java.security.Guard
|
Constructs a new SocketPermission
instance. The hostname can be a
DNS name, an individual hostname, an IP address or the empty string which
implies localhost
. The port or port range is optional.
The action list is a comma-separated list which can consists of the
possible operations "connect"
, "listen"
, "accept"
, and "resolve"
. They are case-insensitive and can be put
together in any order. "resolve"
is implied per default.
host | the hostname this permission is valid for. |
---|---|
action | the action string of this permission. |
Compares the argument o
to this instance and returns true
if they represent the same permission using a class specific comparison.
o | the object to compare with this SocketPermission
instance. |
---|
true
if they represent the same permission, false
otherwise.Gets a comma-separated list of all actions allowed by this permission. If
more than one action is returned they follow this order: connect
,
listen
, accept
, resolve
.
Returns the hash value for this SocketPermission
instance. Any
two objects which returns true
when passed to equals()
must return the same value as a result of this method.
Checks whether this SocketPermission
instance allows all actions
which are allowed by the given permission object p
. All argument
permission actions, hosts and ports must be implied by this permission
instance in order to return true
. This permission may imply
additional actions not present in the argument permission.
p | the socket permission which has to be implied by this instance. |
---|
true
if this permission instance implies all permissions
represented by p
, false
otherwise.Creates a new PermissionCollection
to store SocketPermission
objects.