Added readme files to the examples.
Minor changes in various ecf file and code. Moved filter example under _update_needed since it has obsolete code.
This commit is contained in:
65
examples/README.md
Normal file
65
examples/README.md
Normal file
@@ -0,0 +1,65 @@
|
||||
Examples
|
||||
========
|
||||
|
||||
This folder contains a few examples demonstrating the EiffelWeb framework solution.
|
||||
|
||||
|
||||
## tutorial
|
||||
This is a step by step tutorial to discover the EiffelWeb framework (EWF).
|
||||
How to build your first service, access the request data and send the response, also how to use the router to dispatch url easily.
|
||||
|
||||
## simple
|
||||
This is a very simple system that can be executed as standalone, or hosted as CGI or libFCGI application on Apache, IIS, ...
|
||||
You will learn how to customize the launcher (port number for standalone, ...), and how to use the interface of `WSF_RESPONSE` to send the response.
|
||||
(note: in this example, you have to deal with the Content-Type and Content-Length http header, this requires basic knowledge about the http protocol).
|
||||
[learn more](./simple/README.md)
|
||||
|
||||
## simple_ssl
|
||||
Almost the same as `simple` example, except this `simple_ssl` example is using only the `standalone` connector, and is supporting `https://` request. You will learn how to configure the .ecf file to add ssl support (see `<variable name="ssl_enabled" value="true"/>`), and how to enable it for instance via the `simple.ini` file (imported from the class `APPLICATION`).
|
||||
[learn more](./simple_ssl/README.md)
|
||||
|
||||
## simple_file
|
||||
This demonstrates how to return a file to the client. In this example you will learn how to dispatch manually the URL thanks to the `request.path_info` value.
|
||||
You will also learn how to use the `WSF_RESPONSE.send (message)` interface that does not require you to know that much about http protocol since you will build `WSF_FILE_RESPONSE` and `WSF_NOT_FOUND_MESSAGE` objects.
|
||||
[learn more](./simple_file/README.md)
|
||||
|
||||
## upload_image
|
||||
This example shows how to handle file uploading, and also how to use the `WSF_FILE_SYSTEM_HANDLER` to serve local files (i.e a file server component).
|
||||
It also uses the `WSF_ROUTER` component to route URL based on URI-template declaration.
|
||||
[learn more](./upload_image/README.md)
|
||||
|
||||
## form
|
||||
The EiffelWeb framework provides the `wsf_html` library, it is a set of classes to make it easier to generate html using Eiffel code. This includes web form generation, but also web form handling as it analyzes the request data to fill the web form response.
|
||||
This example shows a simple web form asking for name, birthday, and other radio,checkboxes,combo,file ... input data, and store the result in local directory.
|
||||
[learn more](./form/README.md)
|
||||
|
||||
## desktop_app
|
||||
Using the EiffelVision2 embedded web browser component, you will learn how to embed a web server in your GUI application. This way you can run locally a web server and display html pages in the GUI application itself.
|
||||
[learn more](./desktop_app/README.md)
|
||||
|
||||
## proxy
|
||||
Via the `wsf_proxy` library, it is possible to implement a simple reverse proxy service.
|
||||
Note: you need to edit the `application_execution.e` file to use proper remote service.
|
||||
[learn more](./proxy/README.md)
|
||||
|
||||
## websocket
|
||||
The EiffelWeb framework provides a websocket server and websocket client solution. This example demonstrates how to build a simple websocket service and consume it from a html+javascript page. This is a very simple chat application.
|
||||
[learn more](./websocket/README.md)
|
||||
|
||||
## rest
|
||||
### restbuck CRUD system
|
||||
Restbuck Eiffel Implementation based on the book of REST in Practice.
|
||||
This is an implementation of CRUD pattern for manipulate resources, this is the first step to use the HTTP protocol as an application protocol instead of a transport protocol.
|
||||
[learn more](./rest/restbucks_CRUD/readme.md)
|
||||
|
||||
## debug
|
||||
This example is a simple service that analyze the request and return a formatted output of the request data (query parameters, form parameters, environment variables, and so on). It could be used to debug client, or to experiment the EiffelWeb behavior on various connectors (standalone, apache, iis, ...).
|
||||
[learn more](./debug/README.md)
|
||||
|
||||
## obsolete
|
||||
A set of example using the old interface of EiffelWeb (i.e version v0). We keep them as example for people having existing project based on EWF v0, but willing to compile with latest EiffelStudio, and latest EWF source code.
|
||||
[learn more](./obsolete/README.md)
|
||||
|
||||
## _update_needed
|
||||
This folder contains set of examples that need to be reviewed and updated for various reason.
|
||||
[learn more](./_update_needed/README.md)
|
||||
14
examples/_update_needed/README.md
Normal file
14
examples/_update_needed/README.md
Normal file
@@ -0,0 +1,14 @@
|
||||
Examples to update
|
||||
==================
|
||||
|
||||
This folder contains a few examples that needs to be updated.
|
||||
It could be for many reason
|
||||
- using obsolete components
|
||||
- bad style
|
||||
- not using latest EiffelWeb features
|
||||
- issue in SCOOP concurrency mode
|
||||
- ...
|
||||
|
||||
## filter
|
||||
It demonstrates how to use the `WSF_FILTER` components. It can be used for authentication, and various usage (logging, setting specific http header such as CORS related settings, ...).
|
||||
|
||||
@@ -11,23 +11,23 @@
|
||||
</option>
|
||||
<setting name="concurrency" value="thread"/>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf" readonly="true"/>
|
||||
<library name="http" location="..\..\library\network\protocol\http\http-safe.ecf" readonly="true"/>
|
||||
<library name="http_authorization" location="..\..\library\server\authentication\http_authorization\http_authorization-safe.ecf" readonly="true"/>
|
||||
<library name="http" location="..\..\..\library\network\protocol\http\http-safe.ecf" readonly="true"/>
|
||||
<library name="http_authorization" location="..\..\..\library\server\authentication\http_authorization\http_authorization-safe.ecf" readonly="true"/>
|
||||
<library name="json" location="$ISE_LIBRARY\contrib\library\text\parser\json\library\json-safe.ecf"/>
|
||||
<library name="net" location="$ISE_LIBRARY\library\net\net-safe.ecf" readonly="true"/>
|
||||
<library name="wsf" location="..\..\library\server\wsf\wsf-safe.ecf" readonly="false"/>
|
||||
<library name="wsf_extension" location="..\..\library\server\wsf\wsf_extension-safe.ecf" readonly="true"/>
|
||||
<library name="wsf_router_context" location="..\..\library\server\wsf\wsf_router_context-safe.ecf" readonly="true"/>
|
||||
<library name="wsf" location="..\..\..\library\server\wsf\wsf-safe.ecf" readonly="false"/>
|
||||
<library name="wsf_extension" location="..\..\..\library\server\wsf\wsf_extension-safe.ecf" readonly="true"/>
|
||||
<library name="wsf_router_context" location="..\..\..\library\server\wsf\wsf_router_context-safe.ecf" readonly="true"/>
|
||||
</target>
|
||||
<target name="filter_standalone" extends="common">
|
||||
<root class="FILTER_SERVER" feature="make"/>
|
||||
<setting name="concurrency" value="thread"/>
|
||||
<library name="default_standalone" location="..\..\library\server\wsf\default\standalone-safe.ecf" readonly="true"/>
|
||||
<library name="default_standalone" location="..\..\..\library\server\wsf\default\standalone-safe.ecf" readonly="true"/>
|
||||
<cluster name="filter" location="src\" recursive="true"/>
|
||||
</target>
|
||||
<target name="filter_fcgi" extends="common">
|
||||
<root class="FILTER_SERVER" feature="make"/>
|
||||
<library name="default_libfcgi" location="..\..\library\server\wsf\default\libfcgi-safe.ecf"/>
|
||||
<library name="default_libfcgi" location="..\..\..\library\server\wsf\default\libfcgi-safe.ecf"/>
|
||||
<cluster name="filter" location="src\" recursive="true"/>
|
||||
</target>
|
||||
<target name="filter" extends="filter_standalone">
|
||||
1
examples/debug/README.md
Normal file
1
examples/debug/README.md
Normal file
@@ -0,0 +1 @@
|
||||
This example is a simple service that analyze the request and return a formatted output of the request data (query parameters, form parameters, environment variables, and so on). It could be used to debug client, or to experiment the EiffelWeb behavior on various connectors (standalone, apache, iis, ...).
|
||||
6
examples/obsolete/README.md
Normal file
6
examples/obsolete/README.md
Normal file
@@ -0,0 +1,6 @@
|
||||
Obsolete example based on EWF v0
|
||||
================================
|
||||
|
||||
Those examples are using the old EWF v0 interface, including use of deprecated "nino" connector.
|
||||
They serves as example for existing project based on EWF v0, but willing to use latest EiffelStudio, and latest EWF repository.
|
||||
|
||||
6
examples/proxy/README.md
Normal file
6
examples/proxy/README.md
Normal file
@@ -0,0 +1,6 @@
|
||||
Proxy example
|
||||
=============
|
||||
|
||||
Via the `wsf_proxy` library, it is possible to implement a simple reverse proxy service.
|
||||
Note: you need to edit the `application_execution.e` file to use proper remote service.
|
||||
(You can use for instance any of the EWF examples as remote server, or also existing public server).
|
||||
7
examples/simple/README.md
Normal file
7
examples/simple/README.md
Normal file
@@ -0,0 +1,7 @@
|
||||
Simple example
|
||||
==============
|
||||
|
||||
This is a very simple system that can be executed as standalone, or hosted as CGI or libFCGI application on Apache, IIS, ...
|
||||
You will learn how to customize the launcher (port number for standalone, ...), and how to use the interface of `WSF_RESPONSE` to send the response.
|
||||
(note: in this example, you have to deal with the Content-Type and Content-Length http header, this requires basic knowledge about the http protocol).
|
||||
|
||||
6
examples/simple_file/README.md
Normal file
6
examples/simple_file/README.md
Normal file
@@ -0,0 +1,6 @@
|
||||
File response example
|
||||
=====================
|
||||
|
||||
This demonstrates how to return a file to the client. In this example you will learn how to dispatch manually the URL thanks to the `request.path_info` value.
|
||||
You will also learn how to use the `WSF_RESPONSE.send (message)` interface that does not require you to know that much about http protocol since you will build `WSF_FILE_RESPONSE` and `WSF_NOT_FOUND_MESSAGE` objects.
|
||||
|
||||
5
examples/simple_ssl/README.md
Normal file
5
examples/simple_ssl/README.md
Normal file
@@ -0,0 +1,5 @@
|
||||
SSL support with Standalone connector
|
||||
=====================================
|
||||
|
||||
Almost the same as `simple` example, except this `simple_ssl` example is using only the `standalone` connector, and is supporting `https://` request. You will learn how to configure the .ecf file to add ssl support (see `<variable name="ssl_enabled" value="true"/>`), and how to enable it for instance via the `simple.ini` file (imported from the class `APPLICATION`).
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
= Eiffel Web Framework =
|
||||
= EiffelWeb Framework =
|
||||
|
||||
== Why would you use the Eiffel Web Framework ? ==
|
||||
|
||||
@@ -7,28 +7,28 @@ To write once and run on any web server, on any platforms thanks to the notion o
|
||||
|
||||
== What is a connector? ==
|
||||
|
||||
A connector is the layer between the underlying httpd server, and your application based on EWF.
|
||||
Currently, 4 connectors are available within EWF (but others are available outside).
|
||||
* CGI: the common CGI application (apache, iis, ...)
|
||||
A connector is the layer between the underlying httpd server, and your application based on EiffelWeb.
|
||||
Currently, 4 connectors are available within EiffelWeb (but others are available outside).
|
||||
* CGI: the common CGI application (apache, iis, ...)
|
||||
* FastCGI: on any server supporting libfcgi handling (apache, iis, ...)
|
||||
* Standalone: a standalone Eiffel Web server, it can be run anywhere easily, and debug simply with EiffelStudio's debugger. It supports all concurrency modes, and require EiffelStudio >= 15.05.
|
||||
* Standalone: a standalone Eiffel Web server, it can be run anywhere easily, and debug simply with EiffelStudio's debugger. It supports all concurrency modes, and require EiffelStudio >= 16.05
|
||||
|
||||
Supporting a new connector is fairly simple, it just has to support the simple EWSGI specification which is really small. Then EWF will bring the power on top of it.
|
||||
Supporting a new connector is fairly simple, it just has to support the simple EWSGI specification which is really small. Then EiffelWeb will bring the power on top of it.
|
||||
|
||||
So you can build your application and be sure you will be able to run it ... anywhere thanks to the conceіpt of connectors.
|
||||
So you can build your application and be sure you will be able to run it ... anywhere thanks to the concept of connectors.
|
||||
|
||||
== EWSGI specification ==
|
||||
|
||||
EWF relies on a small core specification, named EWSGI (Eiffel Web Servєr Gateway Interface).
|
||||
EiffelWeb relies on a small core specification, named EWSGI (Eiffel Web Server Gateway Interface).
|
||||
It is very limited on purpose to allow building new connector very easily.
|
||||
|
||||
For now, you just need to know EWF is compliant with EWSGI specification.
|
||||
For now, you just need to know EiffelWeb is compliant with EWSGI specification.
|
||||
|
||||
= Tutorial =
|
||||
|
||||
Now let's discover the Eiffel Web Framework with this tutorial:
|
||||
|
||||
# [[step_1.wiki|Step #1]]: You will learn first, how to get and install EWF.
|
||||
# [[step_1.wiki|Step #1]]: You will learn first, how to get and install EiffelWeb.
|
||||
# [[step_2.wiki|Step #2]]: build a simple Hello World application
|
||||
# [[step_3.wiki|Step #3]]: use the parameter to build dynamic service
|
||||
# [[step_4.wiki|Step #4]]: And you will learn how to dispatch URL
|
||||
|
||||
6
examples/upload_image/README.md
Normal file
6
examples/upload_image/README.md
Normal file
@@ -0,0 +1,6 @@
|
||||
Uploading file example
|
||||
======================
|
||||
|
||||
This example shows how to handle file uploading, and also how to use the `WSF_FILE_SYSTEM_HANDLER` to serve local files (i.e a file server component).
|
||||
It also uses the `WSF_ROUTER` component to route URL based on URI-template declaration.
|
||||
|
||||
@@ -8,12 +8,8 @@ class
|
||||
IMAGE_UPLOADER
|
||||
|
||||
inherit
|
||||
ANY
|
||||
|
||||
WSF_DEFAULT_SERVICE [IMAGE_UPLOADER_EXECUTION]
|
||||
|
||||
SHARED_EXECUTION_ENVIRONMENT
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
note
|
||||
description: "Summary description for {IMAGE_UPLOADER_EXECUTION}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
@@ -11,8 +10,6 @@ inherit
|
||||
WSF_ROUTED_SKELETON_EXECUTION
|
||||
undefine
|
||||
requires_proxy
|
||||
redefine
|
||||
initialize
|
||||
end
|
||||
|
||||
WSF_NO_PROXY_POLICY
|
||||
@@ -26,12 +23,6 @@ create
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
initialize
|
||||
do
|
||||
Precursor
|
||||
initialize_router
|
||||
end
|
||||
|
||||
setup_router
|
||||
-- Setup router
|
||||
local
|
||||
@@ -186,32 +177,21 @@ feature {NONE} -- Encoder
|
||||
|
||||
new_temporary_output_file (n: detachable READABLE_STRING_8): detachable FILE
|
||||
local
|
||||
ut: WSF_FILE_UTILITIES [RAW_FILE]
|
||||
bp: detachable PATH
|
||||
d: DIRECTORY
|
||||
i: INTEGER
|
||||
do
|
||||
create bp.make_current
|
||||
create d.make_with_path (bp)
|
||||
if not d.exists then
|
||||
d.recursive_create_dir
|
||||
end
|
||||
|
||||
create ut
|
||||
if n /= Void then
|
||||
bp := bp.extended ("tmp-download-" + n)
|
||||
Result := ut.new_temporary_file (d, Void, n)
|
||||
else
|
||||
bp := bp.extended ("tmp")
|
||||
end
|
||||
from
|
||||
i := 0
|
||||
until
|
||||
Result /= Void or i > 100
|
||||
loop
|
||||
i := i + 1
|
||||
create {RAW_FILE} Result.make_with_path (bp.appended ("__" + i.out))
|
||||
if Result.exists then
|
||||
Result := Void
|
||||
else
|
||||
Result.open_write
|
||||
end
|
||||
Result := ut.new_temporary_file (d, "tmp", Void)
|
||||
end
|
||||
ensure
|
||||
Result /= Void implies Result.is_open_write
|
||||
|
||||
1
examples/websocket/README.md
Normal file
1
examples/websocket/README.md
Normal file
@@ -0,0 +1 @@
|
||||
The EiffelWeb framework provides a websocket server and websocket client solution. This example demonstrates how to build a simple websocket service and consume it from a html+javascript page. This is a very simple chat application.
|
||||
Reference in New Issue
Block a user