title: URL mapping with C# HttpListener
body: <p>In the code below I am waiting for any call to the 8080 port.</p>
  <pre class="lang-cs prettyprint-override"><code>public static void Main()
  {
      HttpListener listener = new HttpListener();
      listener.Prefixes.Add(&quot;http://*:8080/&quot;);
      
      listener.Start();
      
      while(isRunning)
      {
          HttpListenerContext ctx = listener.GetContext();
          new Thread(new Worker(ctx).ProcessRequest).Start();
      }
  }
  </code></pre>
  <p>Is it possible to map specific URL patterns to different behavior? I want achieve a REST-style server i.e. a call to <code>localhost:8080/person/1</code> will launch <code>getPersonHandler(int)</code></p>
  <pre class="lang-cs prettyprint-override"><code>[Mapping(&quot;*:8080/person/$id&quot;)]
  public void getPersonHandler(int id)
  {
     // ...
  }
  </code></pre>
  <p>The <code>Mapping</code> syntax is just my wishful analogy to JAX-RS libraries that I know. I would like to do the same in C# (desktop C#, not asp).</p>