Module webmachine_request

Webmachine HTTP Request Abstraction.

Copyright © 2007-2014 Basho Technologies Based on mochiweb_request.erl, which is Copyright 2007 Mochi Media, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Authors: Justin Sheehy (justin@basho.com), Andy Gross (andy@basho.com).

Description

Webmachine HTTP Request Abstraction. The functions in this module can be invoked using either parameterized module syntax or regular invocation syntax. Since the Ericsson OTP team is removing the parameterized module syntax in version R16, we encourage you to write your applications using regular function syntax.

To use parameterized module syntax, you create an instance and then invoke functions on that instance, like this:


    Req = webmachine_request:new(ReqState),
    Result = Req:some_fun(Args),
  

where ReqState is an instance of a #wm_reqstate record. The runtime then ensures the ReqState variable is implicitly passed to each function invoked through the Req instance.

To call functions using regular syntax, simply explicitly pass the ReqState variable yourself; note there's no need to call webmachine_request:new/1 to perform regular invocations.

Data Types

t()

t() = {webmachine_request, #wm_reqstate{}}

Function Index

add_response_header/3
add_response_headers/2
append_to_response_body/2
call/2
disp_path/1
do_redirect/1
get_app_root/1
get_cookie_value/2
get_header_value/2
get_metadata/2
get_out_header/2
get_path_info/1
get_path_info/2
get_path_tokens/1
get_peer/1
get_qs_value/2
get_qs_value/3
get_req_header/2
get_reqdata/1
get_sock/1
has_out_header/2
has_response_body/1
headers/1
load_dispatch_data/7
log_data/1
merge_response_headers/2
method/1
new/1
out_headers/1
parse_cookie/1
parse_qs/1
path/1
peer/1
range/1
raw_path/1
remove_response_header/2
req_body/2
req_headers/1
resp_headers/1
resp_redirect/1
response_body/1
response_code/1
send_response/2
set_metadata/3
set_reqdata/2
set_resp_body/2
set_response_code/2
socket/1
stream_req_body/2
trim_state/1
version/1

Function Details

add_response_header/3

add_response_header(K, V, Wm_reqstate) -> any()

add_response_headers/2

add_response_headers(Hdrs, Wm_reqstate) -> any()

append_to_response_body/2

append_to_response_body(Data, Wm_reqstate) -> any()

call/2

call(Arg, Req) -> any()

disp_path/1

disp_path(Wm_reqstate) -> any()

do_redirect/1

do_redirect(Wm_reqstate) -> any()

get_app_root/1

get_app_root(Req) -> any()

get_cookie_value/2

get_cookie_value(Key, Wm_reqstate) -> any()

get_header_value/2

get_header_value(K, ReqState) -> any()

get_metadata/2

get_metadata(Key, Wm_reqstate) -> any()

get_out_header/2

get_out_header(HeaderName, Wm_reqstate) -> any()

get_path_info/1

get_path_info(Wm_reqstate) -> any()

get_path_info/2

get_path_info(Key, Wm_reqstate) -> any()

get_path_tokens/1

get_path_tokens(Req) -> any()

get_peer/1

get_peer(Req) -> any()

get_qs_value/2

get_qs_value(Key, Wm_reqstate) -> any()

get_qs_value/3

get_qs_value(Key, Default, Wm_reqstate) -> any()

get_req_header/2

get_req_header(K, Wm_reqstate) -> any()

get_reqdata/1

get_reqdata(Wm_reqstate) -> any()

get_sock/1

get_sock(Req) -> any()

has_out_header/2

has_out_header(HeaderName, Wm_reqstate) -> any()

has_response_body/1

has_response_body(Req) -> any()

headers/1

headers(Req) -> any()

load_dispatch_data/7

load_dispatch_data(Bindings, HostTokens, Port, PathTokens, AppRoot, DispPath, Wm_reqstate) -> any()

log_data/1

log_data(Wm_reqstate) -> any()

merge_response_headers/2

merge_response_headers(Hdrs, Wm_reqstate) -> any()

method/1

method(Wm_reqstate) -> any()

new/1

new(Wm_reqstate) -> any()

out_headers/1

out_headers(Req) -> any()

parse_cookie/1

parse_cookie(Req) -> any()

parse_qs/1

parse_qs(Req) -> any()

path/1

path(Wm_reqstate) -> any()

peer/1

peer(Wm_reqstate) -> any()

range/1

range(Wm_reqstate) -> any()

raw_path/1

raw_path(Wm_reqstate) -> any()

remove_response_header/2

remove_response_header(K, Wm_reqstate) -> any()

req_body/2

req_body(MaxRevBody, Wm_reqstate) -> any()

req_headers/1

req_headers(Wm_reqstate) -> any()

resp_headers/1

resp_headers(Wm_reqstate) -> any()

resp_redirect/1

resp_redirect(Wm_reqstate) -> any()

response_body/1

response_body(Req) -> any()

response_code/1

response_code(Wm_reqstate) -> any()

send_response/2

send_response(Code, Wm_reqstate) -> any()

set_metadata/3

set_metadata(Key, Value, Wm_reqstate) -> any()

set_reqdata/2

set_reqdata(RD, Wm_reqstate) -> any()

set_resp_body/2

set_resp_body(Body, Wm_reqstate) -> any()

set_response_code/2

set_response_code(Code, Req) -> any()

socket/1

socket(Wm_reqstate) -> any()

stream_req_body/2

stream_req_body(MaxHunk, Wm_reqstate) -> any()

trim_state/1

trim_state(ReqState) -> any()

version/1

version(Wm_reqstate) -> any()


Generated by EDoc