Seaside question

29 views
Skip to first unread message

Louis LaBrunda

unread,
Oct 18, 2025, 2:55:58 PMOct 18
to VAST Community Forum
Hi All,

I want to have one of my Seaside programs get something like this:


and have the server return a file based upon what follows the ? mark.

Currently this:


will start a Seaside session and bring the web browser to a login screen.  I handle all the files sent to and from the server ins Seaside/Smalltalk.  I don't use Apache or any of the other things like it.  I create anchors like this:


The above will work without creating a session, which is exactly what I want.  I think I can catch things in #setupFromInitialRequest: (or somewhere) in a session object and replace the URL (that has ?Weather or whatever) with something like that above that will return a file.  I'm hoping there is some filter magic that is the correct way to do it before I go and reinvent the wheel.

Lou



Marcus Wagner

unread,
Oct 19, 2025, 11:15:33 AMOct 19
to VAST Community Forum
Hi Lou,
I hope, I do not misunderstand your question, thus let me clearly know if I am going into a wrong direction.
First to your mistake, it is impossible to answer without creating a session. There is always one, created by the OS upon receiving a request and under its control. It is important to make clever use of this resource, to avoid unnecessary traffic and avoiding nasty response times.


The first portion of the function is also known as firewall, it decides whether to react on a request or not.  
If it decides to react, no matter what was sent to the port, a session will be created (it carries the start and the end point (10.1.5.2) and protocol (eg. http:).
The OS is reponsible to create a Session and to delegate an URL to somebody  (the handler) who is going creating the response. The OS decides to which program a session is delegated (Windows IIS, Apache, or the VAST VM, running Seaside, SST or s.th. else).
The response in turn can have different forms, e.g. formatted with html -> a web page to be presented, or a file-> causing the browser to ask if and where you want to save it.
Other common reactions are turning a device on or off, sending a picture, film or sound....

You cannot have two different programs to be launched presenting the same URL (the part before an optional ?, no matter what follows).
An Url triggers a handler to react upon, normally (in the case of Seaside) a session answering a HTML response.
Given your example, on  
10.1.5.2:8877/RaspberryRelay/... VAST VM running Seaside will react, create a (VAST internal) session (reuse if it was created before) and answer a HTML
where as upon
http://10.1.5.2:8877/root/...Windows IIS will react, create a (IIS internal) session ( reuse if it was created before ) and answer the file identified by the rest of the url.
[these internal sessions a place holders for the mandatory already established OS session].

The point is the difference of this prefix: on the first prefix (RaspberryRelay), Seaside is registered to react, on the second prefix (root), Windows IIS is set to react.
[as I said, I assume, you have activated the Windows feature www services and configured IIS to react on the prefix /root/. Otherwise windows wont send a file]
Now what you have to do in Seaside is to answer a file instead of a html (as you have registered Seaside to react on the prefix  RaspberryRelay).
Conclusion: first you have to decide who is going to response on an URL prefix and then what it has to answer (steered by the rest of the url and under consideration of an optional ? and a directive behind).
Now given your request to answer a file based upon the name behing the ? mark you have to adopt the existing code currently presenting a login as answer (because it does not inspect upon existance of ? mark and the rest, standard is to ignore this).
I assume that the existing code to provide a login is self written, making use of prefabricated framework components provided by the Seaside framework.

Johan Brichau

unread,
Oct 19, 2025, 12:48:03 PMOct 19
to VAST Community Forum
Hi Louis,

If you want to respond a document based on the value passed in the url and do not need to a Seaside session, I would recommend to use Seaside-Rest and setup a REST handler.
While you can achieve the same by implementing the #initialRequest: method in your Seaside application, using Seaside-REST will allow to not create a Seaside session, and should do what you want. Of course, if you need stateful behavior or need this embedded in a Seaside application, then please provide some more context and I may be able to provide more adequate advice.

With Seaside-REST, the only quibble is that current implementation of the route specification does not make it practical to implement a solution where you specify the file path as a part of the URL path. Therefore, I would recommend to opt for a query parameter in the URL to pass the file path. Your url would thus become:

http://10.1.5.2:8877/?file=C:/KSCVAST/RaspberryRelay/RaspberryRelay/logs/RaspberryRelay.Log

Register a subclass of WARestfulHandler with an implementation such as the one below, and you should be on your way:

WARestfulFileDemoHander>>#getFile: path

<get>
<path: '/?file={path}'>

self respond: [ :response |
response
document: ...
mimeType: ...
fileName: ...
]


Best regards
Johan

Louis LaBrunda

unread,
Oct 19, 2025, 3:33:17 PMOct 19
to VAST Community Forum
Hi  Marcus and Johan,

Thank you both very much for responding.  I have solved my problem but not in the way I asked.  I will try to briefly explain as to not waste too much of everyone's time.

I am getting an AcuRite Iris (5-in-1) Weather Sensor system.  With the help of some other software I am adding the data it creates to one of my Raspberry Pi VA Smalltalk based systems.  I want that data to be available to my other Raspberry Pi VA Smalltalk based systems.  In those systems, I want to ask the system with the data to answer the data when sent something like:

10.1.5.2:8877/AcuRiteWeather

I forgot that I had already written code to serve files to web browser requests that look similar to those in the example of my request.  It is how I serve all my JavaScript and CSS files (to the web browser).  The Raspberry Pi programs run on Linux but I massage things a little so I can test part of the code in my Windows development environment.  I cache the files so as not to have to read them over and over again if not needed.  Although I wrote the system to return files (to free me from dealing with Apache and its friends) it can answer anything I put in the cache.

Lou

P.S.  Please forgive my fading memory, I'm getting old.  I remembered I had written to code but forgot just how powerful it was.  I console myself by thinking that most C (and Java...) programmers can't read what they wrote 6 months ago, even if they can remember what they think it does.
Reply all
Reply to author
Forward
0 new messages