Feature #6432
implement the WEB special stream
100%
Related issues
History
#1 Updated by Greg Shah about 4 years ago
- Related to Feature #6506: implement CGI WebSpeed support and the standard web-disp.p dispatch functionality added
#2 Updated by Greg Shah over 1 year ago
In E4GL preprocessed code, there will be include files (e.g. @) which will place many definitions and functions into the expanded 4GL code. One of those definitions is @DEFINE SHARED STREAM WebStream.. The subsequent code will have many entries like PUT STREAM WebStream UNFORMATTED ' <TABLE>~n'. which will write HTML content to that stream.
The stream itself must be created as part of the CGI wrapper implementation (see #6506) and must be present at the moment that any CGI wrapper 4GL code is invoked.
#3 Updated by Constantin Asofiei over 1 year ago
This stream is defined as OUTPUT STREAM WebStream TO "WEB":U. in web-disp.p
Also, web-disp.p uses ON "WEB-NOTIFY":U ANYWHERE DO: trigger, which is not supported by FWD yet.
#4 Updated by Greg Shah over 1 year ago
- Assignee set to Radu Apetrii
- reviewer Constantin Asofiei added
#5 Updated by Radu Apetrii over 1 year ago
Constantin Asofiei wrote:
Also,
web-disp.pusesON "WEB-NOTIFY":U ANYWHERE DO:trigger, which is not supported by FWD yet.
I might be poking the sleeping bear here, but what do I need to add in order to accomplish this? I would like to have a small working web-disp.p program and this thing is currently standing in my way. May I benefit from an overview of the steps required to achieve support for the WEB-NOTIFY trigger?
I presume I need to modify progress.g to include the WEB-NOTIFY keyword. Afterwards, do I need to create a web-notify statement (as it is for entry_stmt for example)? And for runtime, what should I be adding?
#6 Updated by Constantin Asofiei over 1 year ago
I think you need to register it in Keyboard.java and in key_function in progress.g (thus as keyword, etc).
About the runtime - use a simple test as this, it also works in OE:
on "web-notify" of default-window do: message "here". end. apply "web-notify" to default-window. // the trigger is executed
#7 Updated by Radu Apetrii over 1 year ago
Constantin Asofiei wrote:
I think you need to register it in
Keyboard.java.
I was one step ahead with this one. The change is already in 6506a rev. 15636.
and in
key_functionin progress.g (thus as keyword, etc).
I added this and the test you provided completed successfully. "here" was printed on the screen.
Thank you for the help!
#8 Updated by Radu Apetrii over 1 year ago
- Status changed from New to WIP
- Create a server-side
GenericOutputStreamthat extendsStream. - In
StreamFactory, create anopenWebStreamimplementation that writes on the given (as a parameter) stream. - Things can be directly written in the response's stream (the one from
WebspeedHandler.handle).- The only things I'm not entirely sure is how to link these two, the stream obtained from the Jetty request, and the implementation that extends the Stream.
Again, it might be a bit vague, but I will uncover more of the mist throughout the implementation process.
#9 Updated by Radu Apetrii about 1 year ago
- Status changed from WIP to Review
- % Done changed from 0 to 100
#10 Updated by Greg Shah 10 months ago
I see that StreamFactory.openWebStream() has this:
public static Stream openWebStream(boolean write, int pageSz, boolean paged)
{
UnimplementedFeature.missing("Open Web Stream: paged and page-size are not supported yet.");
if (write)
{
return new WebOutputStream(WebHandlerHelper.getHttpResponse());
}
else
{
UnimplementedFeature.missing("Open Web Stream: Input streams are not supported yet.");
}
return null;
}
Please check if the WEB stream can be opened in input mode, and whether it can have paged or page-size set. I suspect none of these are possible. If so, then we don't need to fill the logfiles with these messages.
#12 Updated by Greg Shah 7 months ago
As seen in a customer project, using 6506a rev 15777, the following code fails to convert:
PUT STREAM WebStream UNFORMATTED '<!doctype html><html><head><title>Example Page</title></head><body><p>Some content.</p></body></html>'.
The name WebStream is a special stream which can be referenced using the built-in preprocessor define {&WEBSTREAM}. But the same text can be coded directly. This customer code does not open the WebStream explicitly. The code parses fine but it won't convert. Support for this needs to be added to 6506a.
#13 Updated by Radu Apetrii 7 months ago
Greg Shah wrote:
Please check if the
WEBstream can be opened in input mode, and whether it can havepagedorpage-sizeset. I suspect none of these are possible. If so, then we don't need to fill the logfiles with these messages.
For the first question, if a WEB stream supports input mode, the answer is yes, it can be opened as an input stream, meaning that Progress will not throw an error if you try to do so, but it won't have any effect. From what I understand, WEB is output-only, which means that the stream (opened in input mode) will just contain nothing. And indeed, every time I tried to output something from the web stream opened as input, the result was simply nothing.
For the paged option, take a look at the following piece of code:
def stream rpt. output stream rpt to "web" paged. put stream rpt unformatted 'hello1'. //page stream rpt. put stream rpt unformatted 'hello2'.
Without applying the page option, the output on the browser is hello1hello2. Then, if I uncomment that page instruction, the output looks something like this:
hello1 ------------- hello2
That line is a contiguous one, I just replicated it with multiple dashes. So I guess it is possible to use paged, I think.
As for the page-size, yes, I am able to set the page size. Take a look at this example: output stream rpt to "web" paged page-size 1.. Then, when I call page-size(rpt), the returned value is indeed 1. If I wouldn't have set the page-size in the output stream part, the returned value would have been 56. So I guess it is possible to set page-size, although I haven't really seen a notable difference between those values, 1 and 56.
If you feel like I should go more in depth with the explanations, let me know.