(add-context command options)
add context to specific command options is a collection include several keys like [ [:requre-context true] [:params-check ...] [... ...] ]
the meaning of option: :require-context (true or false default false) whether this command must have context :params-check check parameters of the method be invoked statisfy the sepcific requirements example : {0 [:username]} --> the first parameter must equals (get-in context [:username]) :params-inject inject parameters from request into the function example : [ [:remote-addr] [:server-name] ] --> client-ip and server-name as the first and second parameter of the function if client invoke (fun param1 param2) then the acutally invoke will be like (fun client-ip server-name param1 param2)
add context to specific command options is a collection include several keys like [ [:requre-context true] [:params-check ...] [... ...] ] the meaning of option: :require-context (true or false default false) whether this command must have context :params-check check parameters of the method be invoked statisfy the sepcific requirements example : {0 [:username]} --> the first parameter must equals (get-in context [:username]) :params-inject inject parameters from request into the function example : [ [:remote-addr] [:server-name] ] --> client-ip and server-name as the first and second parameter of the function if client invoke (fun param1 param2) then the acutally invoke will be like (fun client-ip server-name param1 param2)
(add-context-to-command-map command-map options)
add context options to all the command in the command-map options : same as add-context
add context options to all the command in the command-map options : same as add-context
(adjust-method-request cmd request method-request)
return new method-request (possible with error message)
return new method-request (possible with error message)
(adjust-response cmd request response)
enable every option has opportunity to adjust response or do some side-effects according response, return new response, handle reverse order of the options
enable every option has opportunity to adjust response or do some side-effects according response, return new response, handle reverse order of the options
(error-method-request? method-request)
return true if method-reqeust error else false
return true if method-reqeust error else false
adjust method request by option return new method-request
adjust method request by option return new method-request
adjust method response or do some side-effects by option return new response
adjust method response or do some side-effects by option return new response
(wrap-body handler)
convert the body of the request from InputStream to String
convert the body of the request from InputStream to String
(wrap-client-ip handler)
let :remote-addr represents the real client ip even though the client connects through a proxy server
let :remote-addr represents the real client ip even though the client connects through a proxy server
(wrap-context handler fn-get-context cookie-attrs cookie-key)
accoding to the token (come from cookie in the http request or the token parameters) to get the context data , insert into the request
accoding to the token (come from cookie in the http request or the token parameters) to get the context data , insert into the request
(wrap-cost handler)
log the time of invoke that is bigger than warning-cost-ms
log the time of invoke that is bigger than warning-cost-ms
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close