Package wt.security
Class NetAccess
java.lang.Object
wt.security.Access
wt.security.NetAccess
public class NetAccess
extends wt.security.Access
Class that provides wrappers to priviledged network methods using
the wt.security package. This allows applets to perform network
operations that are typically restricted by the sandbox.
Supported API: true
Supported API: true
-
Method Summary
Modifier and TypeMethodDescriptionfinal voidconnect(URLConnection connection) Wrapper forURLConnection.connect()method.final byte[]getAddress(InetAddress inetAddress) final StringgetCanonicalHostName(InetAddress inetAddress) final StringgetHostAddress(InetAddress inetAddress) final StringgetHostName(InetAddress inetAddress) final InputStreamgetInputStream(URLConnection connection) Wrapper forURLConnection.getInputStream()method.final StringWrapper for ManagementFactory.getRuntimeMXBean().getName(), which internally invokes getLocalHost().final InetAddressstatic NetAccessGet instance ofNetAccess.static NetAccessgetNetAccess(Frame parentFrame) Get instance ofNetAccess.final intgetResponseCode(HttpURLConnection httpUrlConnection) Wrapper forHttpURLConnection.getResponseCode()method.
-
Method Details
-
getNetAccess
Get instance ofNetAccess. This instance can then be used to perform network operations that are typically restricted by the sandbox.
Supported API: true- Parameters:
parentFrame- the parent frame for security dialog boxes that may be presented
-
getNetAccess
Get instance ofNetAccess. This instance can then be used to perform network operations that are typically restricted by the sandbox.
Supported API: true -
connect
- Parameters:
connection- the URLConnection object to be connected- Throws:
WTSecurityExceptionIOException
-
getInputStream
public final InputStream getInputStream(URLConnection connection) throws WTSecurityException, IOException Wrapper forURLConnection.getInputStream()method. This can be necessary if the connection is an HttpURLConnection where getInstanceFollowRedirects() returns true and the request is redirected to a host other than that which the security manager allows (e.g. a host other than that which an applet came from).
Supported API: true- Parameters:
connection- the URLConnection to get the input stream from- Returns:
- InputStream resulting from connection.getInputStream()
- Throws:
WTSecurityExceptionIOException
-
getResponseCode
public final int getResponseCode(HttpURLConnection httpUrlConnection) throws WTSecurityException, IOException Wrapper forHttpURLConnection.getResponseCode()method. This can be necessary when HttpURLConnection.getInstanceFollowRedirects() returns true and the request is redirected to a host other than that which the security manager allows (e.g. a host other than that which an applet came from).
Supported API: true- Parameters:
httpUrlConnection- the HttpURLConnection to get the response code from- Returns:
- response code resulting from httpUrlConnection.getResponseCode()
- Throws:
WTSecurityExceptionIOException
-
getLocalHost
-
getAddress
- Parameters:
inetAddress- the InetAddress object to retrieve address for- Throws:
WTSecurityException
-
getHostAddress
- Parameters:
inetAddress- the InetAddress object to retrieve address for- Throws:
WTSecurityException
-
getHostName
- Parameters:
inetAddress- the InetAddress object to retrieve address for- Throws:
WTSecurityException
-
getCanonicalHostName
- Parameters:
inetAddress- the InetAddress object to retrieve canonical hostname for- Throws:
WTSecurityException
-
getJvmName
Wrapper for ManagementFactory.getRuntimeMXBean().getName(), which internally invokes getLocalHost().
Supported API: true- Throws:
WTSecurityException
-