<div dir="ltr">Thank you so much Mariano! That was very helpful!</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Jun 15, 2024 at 10:56 PM Mariano Montone via Cuis-dev <<a href="mailto:cuis-dev@lists.cuis.st">cuis-dev@lists.cuis.st</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><u></u>
<div>
<p>Hi Mark,</p>
<p>don't put the code that does the response inside a block. Once
you pass that block you cannot access it and change it anymore.</p>
<p>Instead, dispatch to a method, and modify that method.</p>
<pre>initialize
WebServer new</pre>
<pre> <font face="monospace"> listenOn: 3000;</font> </pre>
<pre> addService: '/hello' action: (MessageSend receiver: self selector: #helloWorld:)
</pre>
<p>Then implement the #helloWorld: method and change a piacere.</p>
<p>Also, I would not start the service when you create it. I would
start and stop it manually so you have control.</p>
<p>I attach an example. Look at the class comment.</p>
<p>Cheers,</p>
<p> </p>
<p> Mariano <br>
<br>
</p>
<div>El 14/6/24 a las 20:05, Mark Volkmann
via Cuis-dev escribió:<br>
</div>
<blockquote type="cite">
<div dir="ltr">I'm using the <font face="monospace">WebServer</font>
class in the <font face="monospace">WebClient</font> package.
Any time I change a "route", I have to restart the VM in order
for the change to take effect. There must be some way around
this. Here's a very simple way to duplicate what I'm seeing.
<div>
<div><br>
</div>
<div>1. In a Workspace, enter<span> </span><font face="monospace">Feature require: 'WebClient'</font><span> </span>and "Do it".</div>
</div>
<div>2. Define a class with a name like <font face="monospace">TestServer</font>.</div>
<div>3. An an instance method named <font face="monospace">initialize</font>
containing the following:</div>
<div><br>
</div>
<div><font face="monospace">initialize<br>
<br>
WebServer new<br>
listenOn: 3000;<br>
addService: '/' action: [ :req | req
send200Response: 'Hello World!' ]</font></div>
<div><br>
</div>
<div>4. In the Workspace, enter <font face="monospace">TestServer
new</font> and "Do it".<br>
</div>
<div>5. In a web browser, browse localhost:3000 and verify that
Hello World! is displayed.</div>
<div>6. In the <font face="monospace">initialize</font> method,
change "Hello World!" to anything else and save the change.</div>
<div>7. What can you do now so the new text appears when you
browse that URL?<br>
<div><br>
</div>
<div>I have tried opening a Process Browser window, killing
the "WebServer's listener process", and restarting the
server from the Workspace by running <font face="monospace">TestServer
new</font> again, but that doesn't work. The only thing
that works for me is saving and restarting the image, which
of course is very tedious to do after every code change.</div>
<div>
<div><br>
</div>
<span class="gmail_signature_prefix">-- </span><br>
<div dir="ltr" class="gmail_signature">
<div dir="ltr">
<div>
<div dir="ltr">
<div>
<div dir="ltr">
<div dir="ltr">
<div><font face="arial, helvetica, sans-serif">R.
Mark Volkmann</font></div>
<div><span style="font-size:12.8px"><font face="arial, helvetica, sans-serif">Object
Computing, Inc.</font></span></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<br>
<fieldset></fieldset>
</blockquote>
</div>
-- <br>
Cuis-dev mailing list<br>
<a href="mailto:Cuis-dev@lists.cuis.st" target="_blank">Cuis-dev@lists.cuis.st</a><br>
<a href="https://lists.cuis.st/mailman/listinfo/cuis-dev" rel="noreferrer" target="_blank">https://lists.cuis.st/mailman/listinfo/cuis-dev</a><br>
</blockquote></div><br clear="all"><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div><font face="arial, helvetica, sans-serif">R. Mark Volkmann</font></div><div><span style="font-size:12.8px"><font face="arial, helvetica, sans-serif">Object Computing, Inc.</font></span></div></div></div></div></div></div></div></div>