0
Fork 0
mirror of https://github.com/ninenines/cowboy.git synced 2025-07-14 12:20:24 +00:00

Rename cowboy_http_static to cowboy_static

This commit is contained in:
Loïc Hoguin 2012-08-27 13:53:27 +02:00
parent 6d84afd16d
commit f39c001c03
3 changed files with 18 additions and 18 deletions

View file

@ -13,7 +13,7 @@
start(_Type, _Args) -> start(_Type, _Args) ->
Dispatch = [ Dispatch = [
{'_', [ {'_', [
{['...'], cowboy_http_static, [ {['...'], cowboy_static, [
{directory, {priv_dir, static, []}} {directory, {priv_dir, static, []}}
]} ]}
]} ]}

View file

@ -44,15 +44,15 @@
%% ==== Examples ==== %% ==== Examples ====
%% ``` %% ```
%% %% Serve files from /var/www/ under http://example.com/static/ %% %% Serve files from /var/www/ under http://example.com/static/
%% {[<<"static">>, '...'], cowboy_http_static, %% {[<<"static">>, '...'], cowboy_static,
%% [{directory, "/var/www"}]} %% [{directory, "/var/www"}]}
%% %%
%% %% Serve files from the current working directory under http://example.com/static/ %% %% Serve files from the current working directory under http://example.com/static/
%% {[<<"static">>, '...'], cowboy_http_static, %% {[<<"static">>, '...'], cowboy_static,
%% [{directory, <<"./">>}]} %% [{directory, <<"./">>}]}
%% %%
%% %% Serve files from cowboy/priv/www under http://example.com/ %% %% Serve files from cowboy/priv/www under http://example.com/
%% {['...'], cowboy_http_static, %% {['...'], cowboy_static,
%% [{directory, {priv_dir, cowboy, [<<"www">>]}}]} %% [{directory, {priv_dir, cowboy, [<<"www">>]}}]}
%% ''' %% '''
%% %%
@ -74,14 +74,14 @@
%% ==== Example ==== %% ==== Example ====
%% ``` %% ```
%% %% Use a static list of content types. %% %% Use a static list of content types.
%% {[<<"static">>, '...'], cowboy_http_static, %% {[<<"static">>, '...'], cowboy_static,
%% [{directory, {priv_dir, cowboy, []}}, %% [{directory, {priv_dir, cowboy, []}},
%% {mimetypes, [ %% {mimetypes, [
%% {<<".css">>, [<<"text/css">>]}, %% {<<".css">>, [<<"text/css">>]},
%% {<<".js">>, [<<"application/javascript">>]}]}]} %% {<<".js">>, [<<"application/javascript">>]}]}]}
%% %%
%% %% Use the default database in the mimetypes application. %% %% Use the default database in the mimetypes application.
%% {[<<"static">>, '...', cowboy_http_static, %% {[<<"static">>, '...', cowboy_static,
%% [{directory, {priv_dir, cowboy, []}}, %% [{directory, {priv_dir, cowboy, []}},
%% {mimetypes, {fun mimetypes:path_to_mimes/2, default}}]]} %% {mimetypes, {fun mimetypes:path_to_mimes/2, default}}]]}
%% ''' %% '''
@ -110,17 +110,17 @@
%% ==== Examples ==== %% ==== Examples ====
%% ``` %% ```
%% %% A value of default is equal to not specifying the option. %% %% A value of default is equal to not specifying the option.
%% {[<<"static">>, '...', cowboy_http_static, %% {[<<"static">>, '...', cowboy_static,
%% [{directory, {priv_dir, cowboy, []}}, %% [{directory, {priv_dir, cowboy, []}},
%% {etag, default}]]} %% {etag, default}]]}
%% %%
%% %% Use all avaliable ETag function arguments to generate a header value. %% %% Use all avaliable ETag function arguments to generate a header value.
%% {[<<"static">>, '...', cowboy_http_static, %% {[<<"static">>, '...', cowboy_static,
%% [{directory, {priv_dir, cowboy, []}}, %% [{directory, {priv_dir, cowboy, []}},
%% {etag, {attributes, [filepath, filesize, inode, mtime]}}]]} %% {etag, {attributes, [filepath, filesize, inode, mtime]}}]]}
%% %%
%% %% Use a user defined function to generate a strong ETag header value. %% %% Use a user defined function to generate a strong ETag header value.
%% {[<<"static">>, '...', cowboy_http_static, %% {[<<"static">>, '...', cowboy_static,
%% [{directory, {priv_dir, cowboy, []}}, %% [{directory, {priv_dir, cowboy, []}},
%% {etag, {fun generate_strong_etag/2, strong_etag_extra}}]]} %% {etag, {fun generate_strong_etag/2, strong_etag_extra}}]]}
%% %%
@ -153,21 +153,21 @@
%% %%
%% ``` %% ```
%% %% Serve cowboy/priv/www/index.html as http://example.com/ %% %% Serve cowboy/priv/www/index.html as http://example.com/
%% {[], cowboy_http_static, %% {[], cowboy_static,
%% [{directory, {priv_dir, cowboy, [<<"www">>]}} %% [{directory, {priv_dir, cowboy, [<<"www">>]}}
%% {file, <<"index.html">>}]} %% {file, <<"index.html">>}]}
%% %%
%% %% Serve cowboy/priv/www/page.html under http://example.com/*/page %% %% Serve cowboy/priv/www/page.html under http://example.com/*/page
%% {['*', <<"page">>], cowboy_http_static, %% {['*', <<"page">>], cowboy_static,
%% [{directory, {priv_dir, cowboy, [<<"www">>]}} %% [{directory, {priv_dir, cowboy, [<<"www">>]}}
%% {file, <<"page.html">>}]}. %% {file, <<"page.html">>}]}.
%% %%
%% %% Always serve cowboy/priv/www/other.html under http://example.com/other %% %% Always serve cowboy/priv/www/other.html under http://example.com/other
%% {[<<"other">>, '...'], cowboy_http_static, %% {[<<"other">>, '...'], cowboy_static,
%% [{directory, {priv_dir, cowboy, [<<"www">>]}} %% [{directory, {priv_dir, cowboy, [<<"www">>]}}
%% {file, "other.html"}]} %% {file, "other.html"}]}
%% ''' %% '''
-module(cowboy_http_static). -module(cowboy_static).
%% include files %% include files
-include("http.hrl"). -include("http.hrl").

View file

@ -227,21 +227,21 @@ init_dispatch(Config) ->
[{body, <<"A flameless dance does not equal a cycle">>}]}, [{body, <<"A flameless dance does not equal a cycle">>}]},
{[<<"stream_body">>, <<"set_resp">>], http_handler_stream_body, {[<<"stream_body">>, <<"set_resp">>], http_handler_stream_body,
[{reply, set_resp}, {body, <<"stream_body_set_resp">>}]}, [{reply, set_resp}, {body, <<"stream_body_set_resp">>}]},
{[<<"static">>, '...'], cowboy_http_static, {[<<"static">>, '...'], cowboy_static,
[{directory, ?config(static_dir, Config)}, [{directory, ?config(static_dir, Config)},
{mimetypes, [{<<".css">>, [<<"text/css">>]}]}]}, {mimetypes, [{<<".css">>, [<<"text/css">>]}]}]},
{[<<"static_mimetypes_function">>, '...'], cowboy_http_static, {[<<"static_mimetypes_function">>, '...'], cowboy_static,
[{directory, ?config(static_dir, Config)}, [{directory, ?config(static_dir, Config)},
{mimetypes, {fun(Path, data) when is_binary(Path) -> {mimetypes, {fun(Path, data) when is_binary(Path) ->
[<<"text/html">>] end, data}}]}, [<<"text/html">>] end, data}}]},
{[<<"handler_errors">>], http_handler_errors, []}, {[<<"handler_errors">>], http_handler_errors, []},
{[<<"static_attribute_etag">>, '...'], cowboy_http_static, {[<<"static_attribute_etag">>, '...'], cowboy_static,
[{directory, ?config(static_dir, Config)}, [{directory, ?config(static_dir, Config)},
{etag, {attributes, [filepath, filesize, inode, mtime]}}]}, {etag, {attributes, [filepath, filesize, inode, mtime]}}]},
{[<<"static_function_etag">>, '...'], cowboy_http_static, {[<<"static_function_etag">>, '...'], cowboy_static,
[{directory, ?config(static_dir, Config)}, [{directory, ?config(static_dir, Config)},
{etag, {fun static_function_etag/2, etag_data}}]}, {etag, {fun static_function_etag/2, etag_data}}]},
{[<<"static_specify_file">>, '...'], cowboy_http_static, {[<<"static_specify_file">>, '...'], cowboy_static,
[{directory, ?config(static_dir, Config)}, [{directory, ?config(static_dir, Config)},
{mimetypes, [{<<".css">>, [<<"text/css">>]}]}, {mimetypes, [{<<".css">>, [<<"text/css">>]}]},
{file, <<"test_file.css">>}]}, {file, <<"test_file.css">>}]},