Package org.astrogrid.samp.web
Class OpenPolicyResourceHandler
java.lang.Object
org.astrogrid.samp.web.OpenPolicyResourceHandler
- All Implemented Interfaces:
HttpServer.Handler
HTTP resource handler suitable for serving static cross-origin policy files.
- Since:
- 2 Feb 2011
- Author:
- Mark Taylor
-
Constructor Summary
ConstructorsConstructorDescriptionOpenPolicyResourceHandler
(String policyPath, ServerResource policyResource, OriginAuthorizer authorizer) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionstatic HttpServer.Handler
Returns a handler which can serve the /crossdomain.xml file used by Adobe Flash.static HttpServer.Handler
createPolicyHandler
(String path, URL contentUrl, String contentType, OriginAuthorizer oAuth) Creates a handler suitable for serving static cross-origin policy files.static HttpServer.Handler
Returns a handler which can serve the /clientaccesspolicy.xml file used by Microsoft Silverlight.serveRequest
(HttpServer.Request request) Provides a response to an HTTP request.
-
Constructor Details
-
OpenPolicyResourceHandler
public OpenPolicyResourceHandler(String policyPath, ServerResource policyResource, OriginAuthorizer authorizer) Constructor.- Parameters:
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 file
-
-
Method Details
-
serveRequest
Description copied from interface:HttpServer.Handler
Provides a response to an HTTP request. A handler which does not recognise the URL should simply return null; in this case there may be another handler which is able to serve the request. If the URL appears to be in this handler's domain but the request cannot be served for some reason, an error response should be returned.- Specified by:
serveRequest
in interfaceHttpServer.Handler
- Parameters:
request
- HTTP request- Returns:
- response response to request, or null
-
createPolicyHandler
public static HttpServer.Handler createPolicyHandler(String path, URL contentUrl, String contentType, OriginAuthorizer oAuth) throws IOException Creates a handler suitable for serving static cross-origin policy files.- Parameters:
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 file- Throws:
IOException
-
createFlashPolicyHandler
public static HttpServer.Handler createFlashPolicyHandler(OriginAuthorizer oAuth) throws IOException Returns a handler which can serve the /crossdomain.xml file used by Adobe Flash. The policy file permits access from anywhere.- Parameters:
oAuth
- controls who is permitted to retrieve the policy file- Returns:
- policy file handler
- Throws:
IOException
- See Also:
-
createSilverlightPolicyHandler
public static HttpServer.Handler createSilverlightPolicyHandler(OriginAuthorizer oAuth) throws IOException Returns a handler which can serve the /clientaccesspolicy.xml file used by Microsoft Silverlight. The policy file permits access from anywhere.- Parameters:
oAuth
- controls who is permitted to retrieve the policy file- Returns:
- policy file handler
- Throws:
IOException
- See Also:
-