Skip to content

class Athena::Routing::RequestContext
inherits Reference #

Represents data from a request in an agnostic manner, primarily used to augment URL matching and generation with additional context.

Constructors#

.from_uri(uri : String, host : String = "localhost", scheme : String = "http", http_port : Int32 = 80, https_port : Int32 = 443) : self#

Creates a new instance of self from the provided uri. The host, scheme, http_port, and https_port optionally act as fallbacks if they are not contained within the uri.

.from_uri(uri : URI, host : String = "localhost", scheme : String = "http", http_port : Int32 = 80, https_port : Int32 = 443) : self#

Creates a new instance of self from the provided uri. The host, scheme, http_port, and https_port optionally act as fallbacks if they are not contained within the uri.

.new(base_url : String = "", method : String = "GET", host : String = "localhost", scheme : String = "http", http_port : Int32 = 80, https_port : Int32 = 443, path : String = "/", query_string : String = "")#

Methods#

#apply(request : ART::Request) : self#

Updates the properties within self based on the provided request.

#base_url : String#

Represents the path of the URL before #path. E.g. a path that should be prefixed to all other #paths.

#base_url=(base_url : String) : self#

#has_parameter?(name : String) : Bool#

#host : String#

#host=(host : String) : self#

#http_port : Int32#

#https_port : Int32#

#method : String#

#method=(method : String) : self#

#parameters : Hash(String, String | ::Nil)#

Returns the global parameters that should be used as part of the URL generation logic.

#path : String#

#path=(path : String) : self#

#query_string : String#

Returns the query string of the current request.

#query_string=(query_string : String | Nil) : self#

#scheme : String#

#scheme=(scheme : String) : self#

#set_parameter(name : String, value : String | Nil) : self#