public class OpenPolicyResourceHandler extends java.lang.Object implements HttpServer.Handler
| Modifier and Type | Field and Description |
|---|---|
private OriginAuthorizer |
authorizer_ |
private java.lang.String |
policyPath_ |
private ServerResource |
policyResource_ |
private HttpServer.Response |
response405_ |
| Constructor and Description |
|---|
OpenPolicyResourceHandler(java.lang.String policyPath,
ServerResource policyResource,
OriginAuthorizer authorizer)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
private static ServerResource |
createCachedResource(java.net.URL dataUrl,
java.lang.String contentType)
Returns a ServerResource which caches the contents of a given
(presumably smallish and unchanging) external resource.
|
static HttpServer.Handler |
createFlashPolicyHandler(OriginAuthorizer oAuth)
Returns a handler which can serve the /crossdomain.xml file
used by Adobe Flash.
|
static HttpServer.Handler |
createPolicyHandler(java.lang.String path,
java.net.URL contentUrl,
java.lang.String contentType,
OriginAuthorizer oAuth)
Creates a handler suitable for serving static cross-origin policy files.
|
static HttpServer.Handler |
createSilverlightPolicyHandler(OriginAuthorizer oAuth)
Returns a handler which can serve the /clientaccesspolicy.xml file
used by Microsoft Silverlight.
|
HttpServer.Response |
serveRequest(HttpServer.Request request)
Provides a response to an HTTP request.
|
private final java.lang.String policyPath_
private final ServerResource policyResource_
private final OriginAuthorizer authorizer_
private final HttpServer.Response response405_
public OpenPolicyResourceHandler(java.lang.String policyPath,
ServerResource policyResource,
OriginAuthorizer authorizer)
policyPath - path at which the policy file will reside on
this handler's serverpolicyResource - content of policy fileauthorizer - controls who is permitted to view the policy filepublic HttpServer.Response serveRequest(HttpServer.Request request)
HttpServer.HandlerserveRequest in interface HttpServer.Handlerrequest - HTTP requestpublic static HttpServer.Handler createPolicyHandler(java.lang.String path, java.net.URL contentUrl, java.lang.String contentType, OriginAuthorizer oAuth) throws java.io.IOException
path - path at which the policy file will reside on the
handler's HTTP servercontentUrl - external URL at which the resource contents
can be found; this will be retrieved once and
cachedoAuth - controls who is permitted to retrieve the policy filejava.io.IOExceptionpublic static HttpServer.Handler createFlashPolicyHandler(OriginAuthorizer oAuth) throws java.io.IOException
oAuth - controls who is permitted to retrieve the policy filejava.io.IOExceptionpublic static HttpServer.Handler createSilverlightPolicyHandler(OriginAuthorizer oAuth) throws java.io.IOException
oAuth - controls who is permitted to retrieve the policy filejava.io.IOExceptionprivate static ServerResource createCachedResource(java.net.URL dataUrl, java.lang.String contentType) throws java.io.IOException
dataUrl - location of external resourcecontentType - MIME type for content of dataUrldataUrljava.io.IOException