Marcus,

Hi Joachim,

thanks for your feedback. Concerning the order of the values I rely solely
on the teapot error message.

The way I understand your code snippet, you access the url parameters by using "at: 
1". I have never used Teapot, but would be surprised if it encourages this. In HTTP 
world, a parameter consists of its name and value, both being Strings.

Besides I have no idea how I could make this
GET request independant from the order the HTML form generated.

You shouldn't be required to do anything. In the Smalltalk web frameworks I know (Sst and 
Seaside mostly) an HTTPRequest object has a Dictionary like API for accessing parameters. 
Maybe something like "parameterAt: 'r'" should do the trick.

Maybe with Javascript?

Javascript is the source of a lot of evil, but here, it is innocent like 
Cinderella.
Normal HTTP processing still works without javascript and I hope this won't 
change any time soon. This is simple HTTP back and forth, no javascript 
required nor desired.

But I assume this simple scenario should work in teapot and I
just understand it correctly...

Hmm. As I said, don't access url parameters by index, only by name. I am sure 
Teapot offers methods for that, in the most basic case it gives you a 
Dictionary or parameters, but most likely some wrapper that provides a 
Dictionary-esque access methods.

Maybe this bit is a starting point (found here 
https://ci.inria.fr/pharo-contribution/job/EnterprisePharoBook/lastSuccessfulBuild/artifact/Teapot/Teapot.html):


       3.1. Parameters in URLs

The URL pattern may contain named parameters (e.g., |<user>| above), whose values are accessible via the request object. The request is an extension of |ZnRequest| with some extra methods.

Query parameters and Form parameters can be accessed the same way as path parameters |(req at: #paramName)|. Teapot can perform conversions of parameters to a number, for example as follows:

|Teapot on GET: '/user/<id:IsInteger>' -> [ :req | users findById: (req at: #id)]; output: #ston; start.|

But hey, now I see why you wanted to use Regex: Chapter 3.2 introduces them.... So what can you do if you want to use the reqex stuff? I'd start by adding a Breakpoint into the handler block and inspect the req object that gets passed in. Maybe somethins is wrong about your regex (I am far from being an expert on Regular Expressions) and Teapot is not doing any harm. Joachim

--
-----------------------------------------------------------------------
Objektfabrik Joachim Tuchel          mailto:jtuc...@objektfabrik.de
Fliederweg 1                         http://www.objektfabrik.de
D-71640 Ludwigsburg                  http://joachimtuchel.wordpress.com
Telefon: +49 7141 56 10 86 0         Fax: +49 7141 56 10 86 1

Reply via email to