class Marten::Handlers::Redirect
- Marten::Handlers::Redirect
- Marten::Handlers::Base
- Reference
- Object
Overview
Handler allowing to conveniently return redirect responses.
Defined in:
marten/handlers/redirect.crClass Method Summary
- 
        .forward_query_string(forward_query_string : Bool)
        
          Allows to configure whether query strings should be copied into the redirect URL. 
- 
        .forward_query_string : Bool
        
          Indicates whether query strings should be copied into the redirect URL or not. 
- 
        .permanent(permanent : Bool)
        
          Allows to configure whether the redirection is permanent or not. 
- 
        .permanent : Bool
        
          Indicates whether the redirection is permanent or not. 
- 
        .route_name(route_name : String | Nil)
        
          Allows to configure the route name that should be resolved to produce the URL to redirect to. 
- 
        .route_name : String | Nil
        
          Returns the configured route name that should be resolved to produce the URL to redirect to. 
- 
        .url(url : String | Nil)
        
          Allows to configure a raw URL to redirect to. 
- 
        .url : String | Nil
        
          Returns the configured raw URL to redirect to. 
Instance Method Summary
- 
        #delete
        
          Handles a DELETEHTTP request and returns aMarten::HTTP::Responseobject.
- 
        #get
        
          Handles a GETHTTP request and returns aMarten::HTTP::Responseobject.
- 
        #head
        
          Handles a HEADHTTP request and returns aMarten::HTTP::Responseobject.
- 
        #options
        
          Handles an OPTIONSHTTP request and returns aMarten::HTTP::Responseobject.
- 
        #patch
        
          Handles a PATCHHTTP request and returns aMarten::HTTP::Responseobject.
- 
        #post
        
          Handles a POSTHTTP request and returns aMarten::HTTP::Responseobject.
- 
        #put
        
          Handles a PUTHTTP request and returns aMarten::HTTP::Responseobject.
- 
        #redirect_url
        
          Returns the URL to redirect to. 
Instance methods inherited from class Marten::Handlers::Base
  
  
    
      delete
    delete, 
    
  
    
      dispatch : Marten::HTTP::Response
    dispatch, 
    
  
    
      get
    get, 
    
  
    
      head(status : Int32) : HTTP::Responsehead head, json(raw_json : String, status = 200)
json(serializable, status = 200) json, options options, params : Hash(String, Int16 | Int32 | Int64 | Int8 | String | UInt16 | UInt32 | UInt64 | UInt8 | UUID) params, patch patch, post post, put put, redirect(url : String, permanent = false) redirect, render(template_name : String, context : Hash | NamedTuple | Nil | Marten::Template::Context = nil, content_type = HTTP::Response::DEFAULT_CONTENT_TYPE, status = 200) render, request : Marten::HTTP::Request request, respond(content = "", content_type = HTTP::Response::DEFAULT_CONTENT_TYPE, status = 200) respond, response : Marten::HTTP::Response? response, response! response!, reverse(*args, **options)
reverse(*args, **options, &) reverse, trace trace
Constructor methods inherited from class Marten::Handlers::Base
  
  
    
      new(request : HTTP::Request, params : Hash(String, Routing::Parameter::Types))new(request : HTTP::Request) new
Class methods inherited from class Marten::Handlers::Base
  
  
    
      http_method_nameshttp_method_names(*method_names : String | Symbol) http_method_names
Instance methods inherited from module Marten::Handlers::Session
  
  
    
      session(*args, **options)session(*args, **options, &) session
Instance methods inherited from module Marten::Handlers::RequestForgeryProtection
  
  
    
      get_csrf_token
    get_csrf_token, 
    
  
    
      referer_trusted?
    referer_trusted?
    
  
    
    
  
    
  Instance methods inherited from module Marten::Handlers::Flash
  
  
    
      flash(*args, **options)flash(*args, **options, &) flash
Instance methods inherited from module Marten::Handlers::Cookies
  
  
    
      cookies(*args, **options)cookies(*args, **options, &) cookies
Class Method Detail
Allows to configure whether query strings should be copied into the redirect URL.
Indicates whether query strings should be copied into the redirect URL or not.
Defaults to false.
Allows to configure whether the redirection is permanent or not.
Indicates whether the redirection is permanent or not.
Defaults to false.
Allows to configure the route name that should be resolved to produce the URL to redirect to.
Returns the configured route name that should be resolved to produce the URL to redirect to.
Defaults to nil.
Instance Method Detail
Handles a DELETE HTTP request and returns a Marten::HTTP::Response object.
The default implementation will return a 405 (not allowed) response.
Handles a GET HTTP request and returns a Marten::HTTP::Response object.
The default implementation will return a 405 (not allowed) response.
Handles a HEAD HTTP request and returns a Marten::HTTP::Response object.
The default implementation is to return whatever is returned by the #get method.
Handles an OPTIONS HTTP request and returns a Marten::HTTP::Response object.
The default implementation will return an HTTP response that includes an Allow header populated from the
configured allowed HTTP methods.
Handles a PATCH HTTP request and returns a Marten::HTTP::Response object.
The default implementation will return a 405 (not allowed) response.
Handles a POST HTTP request and returns a Marten::HTTP::Response object.
The default implementation will return a 405 (not allowed) response.
Handles a PUT HTTP request and returns a Marten::HTTP::Response object.
The default implementation will return a 405 (not allowed) response.
Returns the URL to redirect to.
By default, the URL will be determined from the configured #url and #route_name values. This method can be
overridden on subclasses in order to define any arbitrary logics that might be necessary in order to determine
the final redirection URL.