Class HandlerHelper
Static Helper class for HTTP Handlers
Inheritance
Namespace: VDS.RDF.Web
Assembly: dotNetRdf.AspNet.dll
Syntax
public static class HandlerHelper : object
Methods
| Improve this Doc View SourceAddCachingHeaders(IHttpContext, String, Nullable<DateTime>)
Adds ETag and/or Last-Modified headers as appropriate to a response
Declaration
public static void AddCachingHeaders(IHttpContext context, String etag, DateTime? lastModified)
Parameters
Type | Name | Description |
---|---|---|
IHttpContext | context | HTTP Context |
String | etag | ETag |
System.Nullable<DateTime> | lastModified | Last Modified |
AddCorsHeaders(IHttpContext)
Adds CORS headers which are needed to allow JS clients to access RDF/SPARQL endpoints powered by dotNetRDF
Declaration
public static void AddCorsHeaders(IHttpContext context)
Parameters
Type | Name | Description |
---|---|---|
IHttpContext | context | HTTP Context |
AddStandardHeaders(IHttpContext, BaseHandlerConfiguration)
Adds the Standard Custom Headers that dotNetRDF attaches to all responses from it's Handlers
Declaration
public static void AddStandardHeaders(IHttpContext context, BaseHandlerConfiguration config)
Parameters
Type | Name | Description |
---|---|---|
IHttpContext | context | HTTP Context |
BaseHandlerConfiguration | config | Handler Configuration |
ApplyWriterOptions(Object, BaseHandlerConfiguration)
Applies the Writer Options from a Handler Configuration to a Writer
Declaration
public static void ApplyWriterOptions(Object writer, BaseHandlerConfiguration config)
Parameters
Type | Name | Description |
---|---|---|
Object | writer | Writer |
BaseHandlerConfiguration | config | Handler Configuration |
CheckCachingHeaders(IHttpContext, String, Nullable<DateTime>)
Checks whether the HTTP Request contains caching headers that means a 304 Modified response can be sent
Declaration
public static bool CheckCachingHeaders(IHttpContext context, String etag, DateTime? lastModified)
Parameters
Type | Name | Description |
---|---|---|
IHttpContext | context | HTTP Context |
String | etag | ETag |
System.Nullable<DateTime> | lastModified | Last Modified |
Returns
Type | Description |
---|---|
System.Boolean | True if a 304 Not Modified can be sent |
HandleQueryErrors(IHttpContext, BaseHandlerConfiguration, String, String, Exception)
Handles errors in processing SPARQL Query Requests
Declaration
public static void HandleQueryErrors(IHttpContext context, BaseHandlerConfiguration config, String title, String query, Exception ex)
Parameters
Type | Name | Description |
---|---|---|
IHttpContext | context | Context of the HTTP Request |
BaseHandlerConfiguration | config | Handler Configuration |
String | title | Error title |
String | query | Sparql Query |
Exception | ex | Error |
HandleQueryErrors(IHttpContext, BaseHandlerConfiguration, String, String, Exception, Int32)
Handles errors in processing SPARQL Query Requests
Declaration
public static void HandleQueryErrors(IHttpContext context, BaseHandlerConfiguration config, String title, String query, Exception ex, int statusCode)
Parameters
Type | Name | Description |
---|---|---|
IHttpContext | context | Context of the HTTP Request |
BaseHandlerConfiguration | config | Handler Configuration |
String | title | Error title |
String | query | Sparql Query |
Exception | ex | Error |
System.Int32 | statusCode | HTTP Status Code to return |
HandleUpdateErrors(IHttpContext, BaseHandlerConfiguration, String, String, Exception)
Handles errors in processing SPARQL Update Requests
Declaration
public static void HandleUpdateErrors(IHttpContext context, BaseHandlerConfiguration config, String title, String update, Exception ex)
Parameters
Type | Name | Description |
---|---|---|
IHttpContext | context | Context of the HTTP Request |
BaseHandlerConfiguration | config | Handler Configuration |
String | title | Error title |
String | update | SPARQL Update |
Exception | ex | Error |
HandleUpdateErrors(IHttpContext, BaseHandlerConfiguration, String, String, Exception, Int32)
Handles errors in processing SPARQL Update Requests
Declaration
public static void HandleUpdateErrors(IHttpContext context, BaseHandlerConfiguration config, String title, String update, Exception ex, int statusCode)
Parameters
Type | Name | Description |
---|---|---|
IHttpContext | context | Context of the HTTP Request |
BaseHandlerConfiguration | config | Handler Configuration |
String | title | Error title |
String | update | SPARQL Update |
Exception | ex | Error |
System.Int32 | statusCode | HTTP Status Code to return |
IsAuthenticated(IHttpContext, IEnumerable<UserGroup>)
Checks whether a User is authenticated (or guests are permitted)
Declaration
public static bool IsAuthenticated(IHttpContext context, IEnumerable<UserGroup> groups)
Parameters
Type | Name | Description |
---|---|---|
IHttpContext | context | HTTP Context |
IEnumerable<UserGroup> | groups | User Groups to test against |
Returns
Type | Description |
---|---|
System.Boolean |
IsAuthenticated(IHttpContext, IEnumerable<UserGroup>, String)
Checks whether a User is authenticated (or guests are permitted) and the given action is allowed
Declaration
public static bool IsAuthenticated(IHttpContext context, IEnumerable<UserGroup> groups, String action)
Parameters
Type | Name | Description |
---|---|---|
IHttpContext | context | HTTP Context |
IEnumerable<UserGroup> | groups | User Groups to test against |
String | action | Action to check for permission for |
Returns
Type | Description |
---|---|
System.Boolean |
SendToClient(IHttpContext, Object)
Helper function which returns the Results (Graph/Triple Store/SPARQL Results) back to the Client in one of their accepted formats
Declaration
public static void SendToClient(IHttpContext context, Object result)
Parameters
Type | Name | Description |
---|---|---|
IHttpContext | context | Context of the HTTP Request |
Object | result | Results of the Sparql Query |
SendToClient(IHttpContext, Object, BaseHandlerConfiguration)
Helper function which returns the Results (Graph/Triple Store/SPARQL Results) back to the Client in one of their accepted formats
Declaration
public static void SendToClient(IHttpContext context, Object result, BaseHandlerConfiguration config)
Parameters
Type | Name | Description |
---|---|---|
IHttpContext | context | Context of the HTTP Request |
Object | result | Results of the Sparql Query |
BaseHandlerConfiguration | config | Handler Configuration |