Java Reference
In-Depth Information
443 for HTTPS. You can also specify a wildcard (
*
) with the port range to indicate all
ports.
The path portion of the URL is composed of a sequence of paths in the host server,
separated by the
/
character. The path is very similar to the
FilePermission
, but it
can be left blank to indicate permission for the root of the host resource. The path can
be used to specify access to a single resource by listing that resource at the end. For ex-
ample, for access to a single HTML file, you may specify
www.mydns.com/
specifies all resources in the same directory, whereas the
-
specifies all resources re-
cursively below the given path.
The second argument to
URLPermission
is an actions string. This string is a
concatenation of an actions list and a request headers list. The actions string contains
lists of permitted request methods and permitted request headers of the permission, re-
spectively. The request method options are the HTTP request methods PUT, GET, and
DELETE. The request headers are optional, but if present, they are separated from the
request methods via a colon (
:
). No whitespace is permitted in the actions string and it
is case-sensitive. You can also use a wildcard (
*
) to represent all request methods or
headers, respectively. Here are a few examples:
•
No request methods:
"PUT,GET,DELETE"
•
Request methods and request headers:
"PUT,GET:MyHeader1,MyHeader2"
•
All request methods:
"*"
The
URLPermission
class provides a more restrictive level of security than
SocketPermissions
, as it is targeted more toward URL and host access. For sand-
boxed Rich Internet Applications,
SocketPermissions
for the origin host is no
longer permitted in Java 8, which means that calls from JavaScript code to the applica-
tion are not granted
SocketPermissions
as of Java 8. The
Permissions
attrib-
ute is now required in the JAR file manifest for the main JAR of all Rich Internet Ap-
plications at all levels.
Summary