Authlete
ResponseUtility Class Reference

Utility to generate HttpResponseMessage instances. More...

Static Public Member Functions

static HttpResponseMessage OkJson (string content)
 Create a response of "200 OK" with a content in "application/json;charset=UTF-8" format. More...
 
static HttpResponseMessage OkJavaScript (string content)
 Create a response of "200 OK" with a content in "application/javascript;charset=UTF-8" format. More...
 
static HttpResponseMessage OkJwt (string content)
 Create a response of "200 OK" with a content in "application/jwt" format. More...
 
static HttpResponseMessage OkHtml (string content)
 Create a response of "200 OK" with a content in "text/html;charset=UTF-8" format. More...
 
static HttpResponseMessage NoContent ()
 Create a response of "204 No Content". More...
 
static HttpResponseMessage Location (Uri location)
 Create a response of "302 Found" with a Location header. More...
 
static HttpResponseMessage Location (string location)
 Create a response of "302 Found" with a Location header. More...
 
static HttpResponseMessage BadRequest (string content)
 Create a response of "400 Bad Request" with a content in "application/json;charset=UTF-8" format. More...
 
static HttpResponseMessage Unauthorized (AuthenticationHeaderValue challenge, string content)
 Create a response of "401 Unauthorized" with a WWW-Authenticate header. More...
 
static HttpResponseMessage Unauthorized (string challenge)
 Create a response of "401 Unauthorized" with a WWW-Authenticate header. More...
 
static HttpResponseMessage Forbidden (string content)
 Create a response of "403 Forbidden" with a content in "application/json;charset=UTF-8" format. More...
 
static HttpResponseMessage NotFound (string content)
 Create a response of "404 Not Found" with a content in "application/json;charset=UTF-8" format. More...
 
static HttpResponseMessage InternalServerError (string content)
 Create a response of "500 Internal Server Error" with a content in "application/json;charset=UTF-8" format. More...
 
static HttpResponseMessage WwwAuthenticate (HttpStatusCode statusCode, AuthenticationHeaderValue challenge)
 Create a response with a WWW-Authenticate header. More...
 
static HttpResponseMessage WwwAuthenticate (HttpStatusCode statusCode, string challenge)
 Create a response with a WWW-Authenticate header. More...
 

Detailed Description

Utility to generate HttpResponseMessage instances.

Member Function Documentation

◆ BadRequest()

static HttpResponseMessage BadRequest ( string  content)
inlinestatic

Create a response of "400 Bad Request" with a content in "application/json;charset=UTF-8" format.

Parameters
contentResponse body in JSON format.

◆ Forbidden()

static HttpResponseMessage Forbidden ( string  content)
inlinestatic

Create a response of "403 Forbidden" with a content in "application/json;charset=UTF-8" format.

Parameters
contentResponse body in JSON format.

◆ InternalServerError()

static HttpResponseMessage InternalServerError ( string  content)
inlinestatic

Create a response of "500 Internal Server Error" with a content in "application/json;charset=UTF-8" format.

Parameters
contentResponse body in JSON format.

◆ Location() [1/2]

static HttpResponseMessage Location ( string  location)
inlinestatic

Create a response of "302 Found" with a Location header.

Parameters
locationA value of Location header.

◆ Location() [2/2]

static HttpResponseMessage Location ( Uri  location)
inlinestatic

Create a response of "302 Found" with a Location header.

Parameters
locationA value of Location header.

◆ NoContent()

static HttpResponseMessage NoContent ( )
inlinestatic

Create a response of "204 No Content".

◆ NotFound()

static HttpResponseMessage NotFound ( string  content)
inlinestatic

Create a response of "404 Not Found" with a content in "application/json;charset=UTF-8" format.

Parameters
contentResponse body in JSON format.

◆ OkHtml()

static HttpResponseMessage OkHtml ( string  content)
inlinestatic

Create a response of "200 OK" with a content in "text/html;charset=UTF-8" format.

Parameters
contentResponse body in HTML format.

◆ OkJavaScript()

static HttpResponseMessage OkJavaScript ( string  content)
inlinestatic

Create a response of "200 OK" with a content in "application/javascript;charset=UTF-8" format.

Parameters
contentJavaScript

◆ OkJson()

static HttpResponseMessage OkJson ( string  content)
inlinestatic

Create a response of "200 OK" with a content in "application/json;charset=UTF-8" format.

Parameters
contentResponse body in JSON format.

◆ OkJwt()

static HttpResponseMessage OkJwt ( string  content)
inlinestatic

Create a response of "200 OK" with a content in "application/jwt" format.

Parameters
contentResponse body in JSON format.

◆ Unauthorized() [1/2]

static HttpResponseMessage Unauthorized ( AuthenticationHeaderValue  challenge,
string  content 
)
inlinestatic

Create a response of "401 Unauthorized" with a WWW-Authenticate header.

Parameters
challengeA value of WWW-Authenticate header.
Parameters
contentResponse body in JSON format, or null.

◆ Unauthorized() [2/2]

static HttpResponseMessage Unauthorized ( string  challenge)
inlinestatic

Create a response of "401 Unauthorized" with a WWW-Authenticate header.

Parameters
challengeA value of WWW-Authenticate header.

◆ WwwAuthenticate() [1/2]

static HttpResponseMessage WwwAuthenticate ( HttpStatusCode  statusCode,
AuthenticationHeaderValue  challenge 
)
inlinestatic

Create a response with a WWW-Authenticate header.

Parameters
statusCodeHTTP status code of the response.
Parameters
challengeThe value of the WWW-Authenticate header.

◆ WwwAuthenticate() [2/2]

static HttpResponseMessage WwwAuthenticate ( HttpStatusCode  statusCode,
string  challenge 
)
inlinestatic

Create a response with a WWW-Authenticate header.

Parameters
statusCodeAn HTTP status code.
Parameters
challengeA value of the WWW-Authenticate header.

The documentation for this class was generated from the following file: