Skip to content

Commit

Permalink
Update example.
Browse files Browse the repository at this point in the history
  • Loading branch information
bakercp committed Apr 5, 2017
1 parent ecf1451 commit b8bde29
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 140 deletions.
20 changes: 10 additions & 10 deletions example_basic_server_post/bin/data/DocumentRoot/index.html
Expand Up @@ -4,7 +4,7 @@
<!-- Force latest IE rendering engine or ChromeFrame if installed -->
<!--[if IE]><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"><![endif]-->
<meta charset="utf-8">
<title>ofx::HTTP::BasicPostServer</title>
<title>ofx::HTTP::SimplePostServer</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" href="img/favicon.ico">
Expand All @@ -17,26 +17,26 @@
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<a class="navbar-brand" href="#">ofx::HTTP::BasicPostServer Demo</a>
<a class="navbar-brand" href="#">ofx::HTTP::SimplePostServer Demo</a>
</div>
</div>
</div>
<div class="container">
<h1>Basic Post Server Demo</h1>
<h1>Simple Post Server Demo</h1>
<br>
<blockquote>
<p>
<code>ofx::HTTP::BasicPostServer</code> is a simple server implements an HTML form server.
<code>ofx::HTTP::SimplePostServer</code> is a simple server implements an HTML form server.
</p>
</blockquote>
<br>
<h3>Example Form Using <code>text/plain</code> Form Encoding</h3>
<blockquote>
The following form is defined by <code>&lt;form role="form" action="/" method="post" enctype="text/plain"&gt;</code>.
The following form is defined by <code>&lt;form role="form" action="/post" method="post" enctype="text/plain"&gt;</code>.
This for will send an event to the <code>bool onHTTPPostEvent(ofx::HTTP::PostEventArgs& evt);</code> callback.
In this case, the content cannot be reliably parsed so it is up to the user to extract name / value pairs.
</blockquote>
<form role="form" action="/" method="post" enctype="text/plain">
<form role="form" action="/post" method="post" enctype="text/plain">
<div class="form-group">
<label for="text_0">Text Box 0</label>
<textarea name="text_0" class="form-control" rows="3"></textarea>
Expand All @@ -55,10 +55,10 @@ <h3>Example Form Using <code>text/plain</code> Form Encoding</h3>
<br>
<h3>Example Form Using <code>application/x-www-form-urlencoded</code> Form Encoding</h3>
<blockquote>
The following form is defined by <code>&lt;class="form-inline" role="form" action="/" method="post" enctype="application/x-www-form-urlencoded"&gt;</code>. This will send en event to the <code>bool onHTTPFormEvent(ofx::HTTP::PostFormEventArgs& evt);</code> callback.
The following form is defined by <code>&lt;class="form-inline" role="form" action="/post" method="post" enctype="application/x-www-form-urlencoded"&gt;</code>. This will send en event to the <code>bool onHTTPFormEvent(ofx::HTTP::PostFormEventArgs& evt);</code> callback.
In this case, the content will be parsed and returns as a set of name / value pairs.
</blockquote>
<form class="form-inline" role="form" action="/" method="post" enctype="application/x-www-form-urlencoded">
<form class="form-inline" role="form" action="/post" method="post" enctype="application/x-www-form-urlencoded">
<div class="form-group">
<label class="sr-only" for="email">Email address</label>
<input type="email" name="email" id="email" class="form-control" placeholder="Enter email">
Expand All @@ -77,7 +77,7 @@ <h3>Example Form Using <code>application/x-www-form-urlencoded</code> Form Encod
<br>
<h3>Example Form Using <code>multipart/form-data</code> Form Encoding</h3>
<blockquote>
The following form is defined by <code>&lt;role="form" action="/" method="post" enctype="multipart/form-data"&gt;</code>.
The following form is defined by <code>&lt;role="form" action="/post" method="post" enctype="multipart/form-data"&gt;</code>.
This will send events to three callbacks. If files are attached, each file will be processed in sequence and
will send events at the beginning of the upload, during progress (as determined by the size of the upload buffer)
and one upon completion. The callbacks are as follows:
Expand All @@ -94,7 +94,7 @@ <h3>Example Form Using <code>multipart/form-data</code> Form Encoding</h3>
</ul>
</pre>
</blockquote>
<form role="form" action="/" method="post" enctype="multipart/form-data">
<form role="form" action="/post" method="post" enctype="multipart/form-data">
<div class="form-group">
<label for="email">Email address</label>
<input type="email" name="email" id="email" class="form-control" placeholder="Enter email">
Expand Down
128 changes: 0 additions & 128 deletions example_basic_server_post/bin/data/DocumentRoot/index2.html

This file was deleted.

6 changes: 4 additions & 2 deletions example_basic_server_post/src/ofApp.cpp
Expand Up @@ -19,8 +19,10 @@ void ofApp::setup()
// Many other settings are available.
settings.setPort(7890);

// Set an alternate route path pattern (defaut is /post).
settings.postRouteSettings.setRoutePathPattern("/");
// If you want to set an alternate route path pattern (defaut is /post),
// you can change the POST endpoint here. Just be sure to also update it in
// any HTML forms in the bin/data/DocumentRoot.
// settings.postRouteSettings.setRoutePathPattern("/");

// Apply the settings.
server.setup(settings);
Expand Down

0 comments on commit b8bde29

Please sign in to comment.