<?xml version="1.0"?>
<rss version="2.0">
  <channel><title>Breakpointing</title><link>http://bill.welliver.org//space/pike/Fins/Developer/Breakpointing</link><description>Fins supports request breakpointing, which allows you to pause a request in flight and query and modify it.&lt;p class="paragraph"/&gt;
To enable breakpointing, add the following to your application's configuration file:&lt;p class="paragraph"/&gt;
&lt;div class="code"&gt;&lt;pre&gt;&lt;pre&gt;&#xD;
&amp;#91;application]&#xD;
breakpoint=1&#xD;
breakpoint_port=12345&#xD;
&lt;/pre&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p class="paragraph"/&gt;
&#xD;
Then when you restart your app, you should see a line that says the breakpoint server is being started. Once you see that, you can telnet to that port:&lt;p class="paragraph"/&gt;
&lt;div class="code"&gt;&lt;pre&gt;&lt;pre&gt;&#xD;
bash-2.05$ telnet buoy.riverweb.com 12345&#xD;
Trying 204.97.242.43...&#xD;
Connected to buoy.riverweb.com.&#xD;
Escape character is '^]'.&#xD;
Welcome to Fins Breakpoint Service.&#xD;
&lt;/pre&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p class="paragraph"/&gt;
&#xD;
Now, it's just waiting for a request to hit a breakpoint. To add a breakpoint, you add something like this in your controller's event:&lt;p class="paragraph"/&gt;
&lt;div class="code"&gt;&lt;pre&gt;&lt;pre&gt;&#xD;
  app-&amp;gt;breakpoint(&lt;i&gt;&lt;font color=darkred&gt;"some description"&lt;/font&gt;&lt;/i&gt;, (&amp;#91;&lt;i&gt;&lt;font color=darkred&gt;"id"&lt;/font&gt;&lt;/i&gt;: id, &lt;i&gt;&lt;font color=darkred&gt;"response"&lt;/font&gt;&lt;/i&gt;: response ]));&#xD;
&lt;/pre&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p class="paragraph"/&gt;
&#xD;
...and when your app hits that point, your telnet session will come alive with a hilfe prompt. You can access the request object as "id" and the response as "response". You can access request variables and change the response (though if code later on in the request modifies it, your changes may be overwritten.)&lt;p class="paragraph"/&gt;
For example:&lt;p class="paragraph"/&gt;
&lt;div class="code"&gt;&lt;pre&gt;&lt;pre&gt;&#xD;
Welcome to Fins Breakpoint Service.&#xD;
Breakpoint on test&#xD;
&amp;gt; id;&#xD;
(1) Result: Fins.HTTPRequest(&lt;i&gt;&lt;font color=darkred&gt;"GET"&lt;/font&gt;&lt;/i&gt; &lt;i&gt;&lt;font color=darkred&gt;"/space/start/2006-04-25/2"&lt;/font&gt;&lt;/i&gt;)&#xD;
&amp;gt; id-&amp;gt;variables;&#xD;
(2) Result: (&amp;#91; ])&#xD;
&amp;gt; id-&amp;gt;misc;&#xD;
(3) Result: (&amp;#91; &lt;font color=red&gt;/* 5 elements */&lt;/font&gt;&#xD;
              &lt;i&gt;&lt;font color=darkred&gt;"_session"&lt;/font&gt;&lt;/i&gt;: Session(6d5581d44dab127d7fb1, (&amp;#91; ])),&#xD;
              &lt;i&gt;&lt;font color=darkred&gt;"current_page"&lt;/font&gt;&lt;/i&gt;: &lt;i&gt;&lt;font color=darkred&gt;"start/2006-04-25/2"&lt;/font&gt;&lt;/i&gt;,&#xD;
              &lt;i&gt;&lt;font color=darkred&gt;"current_page_object"&lt;/font&gt;&lt;/i&gt;: &lt;b&gt;&lt;font color=darkgreen&gt;object(230)&lt;/font&gt;&lt;/b&gt;&lt;b&gt;&lt;font color=darkbrown&gt;&lt;/font&gt;&lt;/b&gt;,&#xD;
              &lt;i&gt;&lt;font color=darkred&gt;"session_id"&lt;/font&gt;&lt;/i&gt;: &lt;i&gt;&lt;font color=darkred&gt;"6d5581d44dab127d7fb1"&lt;/font&gt;&lt;/i&gt;,&#xD;
              &lt;i&gt;&lt;font color=darkred&gt;"session_variables"&lt;/font&gt;&lt;/i&gt;: (&amp;#91; ])&#xD;
            ])&#xD;
&amp;gt; id-&amp;gt;misc-&amp;gt;current_page_object&amp;#91;&lt;i&gt;&lt;font color=darkred&gt;"title"&lt;/font&gt;&lt;/i&gt;];&#xD;
(4) Result: &lt;i&gt;&lt;font color=darkred&gt;"Collaborative editing for Mac: on sale, too!"&lt;/font&gt;&lt;/i&gt;&#xD;
&amp;gt; go&#xD;
Resuming.&#xD;
&lt;/pre&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p class="paragraph"/&gt;
&#xD;
The only limitation to using breakpoints is that it uses threads. Not a big deal, just something to be aware of.</description><generator>Fins 0.9.7</generator><docs>http://blogs.law.harvard.edu/tech/rss</docs></channel>
</rss>
