https://proj.goldencode.com/https://proj.goldencode.com/favicon.ico2018-02-10T15:40:14ZGolden Code RedmineUser Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=586802018-02-10T15:40:14ZGreg Shah
<ul></ul><p>Implement a variant of <code>P2J-OPEN-URL</code> (see #1815) called <code>OPEN-MIME-RESOURCE</code>. The idea is that where <code>P2J-OPEN-URL</code> is meant to allow the user's browser to load the URL directly, the <code>OPEN-MIME-RESOURCE</code> is meant to load a mime resource (text file, PDF, CSV, XLS, even html... that exists on the FWD client) down into the user's browser. If that resource can be rendered by the browser, we would want it to load in its own tab. As a fallback, any resource that cannot be rendered by the browser should prompt the user for download/open via helper app.</p>
<p>Please see <a class="issue tracker-2 status-5 priority-4 priority-default closed" title="Feature: implement printing support (real GUI printing not the child process stuff used in CHUI) (Closed)" href="https://proj.goldencode.com/issues/1795#note-61">#1795-61</a> (and later) for more details on the features needed. This should be used for both <code>OUTPUT TO PRINTER</code> as well as for the enhanced browse export feature.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=599782018-03-28T04:16:40ZEric Faulhaber
<ul><li><strong>Assignee</strong> set to <i>Sergey Ivanovskiy</i></li></ul> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=600242018-03-29T14:10:03ZSergey Ivanovskiy
<ul></ul><p>Created 3474a for this task.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=600672018-03-30T13:05:43ZSergey Ivanovskiy
<ul></ul><p>Please clarify that OPEN-MIME-RESOURCE should be used in OUTPUT TO PRINTER statement as well as for the enhanced browse export feature. What does it mean?</p>
<p>This js framework <a class="external" href="http://mozilla.github.io/pdf.js/getting_started/">http://mozilla.github.io/pdf.js/getting_started/</a> can be used by Swing and Web clients both to render pdf documents in browsers.</p>
<p>Also this java library <a class="external" href="http://cssbox.sourceforge.net/pdf2dom/">http://cssbox.sourceforge.net/pdf2dom/</a> can be evaluated. It transforms pdf documents into html documents.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=600692018-03-30T13:25:57ZGreg Shah
<ul></ul><p>There are many ways for converted 4GL code to generate some kind of output. Once that output is created, it needs to be provided to the end user in some way. In the original 4GL system, the output was already on the end user's desktop system. File resources were on the hard drive, other things might be directly output to printers, email or devices (including the screen).</p>
<p>In the web client the user is assumed to be running the browser on a different system than where the FWD client is executing. Although the local web client is possible, we cannot assume it is in use. Since the user has no direct access to the output, we must provide a facility for the output to be opened via the browser so that the user can view, interact, save and print any such output.</p>
<p>The idea of <code>OPEN-MIME-RESOURCE</code> is to provide a tool to do this which can be used in 4GL converted code (but only in FWD since there is no OpenEdge version). This is an enhancement of the 4GL syntax itself.</p>
<p><code>OUTPUT TO PRINTER</code> sends the PDF down to the browser. It appears as a "download or open with" prompt. Just like with any other output that is generated by the FWD client, the PDF needs to get down to the user's browser BUT we don't want it to always prompt for the user to open or download it. We really want it to be loaded as a tab in the user's browser with no other interaction needed. This is the same thing we are already doing for <code>OPEN-MIME-RESOURCE</code>, so I don't want to duplicate work. The same solution for <code>OPEN-MIME-RESOURCE</code> should be used "under the covers" in <code>OUTPUT TO PRINTER</code>.</p>
<blockquote>
<p>This js framework <a class="external" href="http://mozilla.github.io/pdf.js/getting_started/">http://mozilla.github.io/pdf.js/getting_started/</a> can be used by Swing and Web clients both to render pdf documents in browsers.</p>
</blockquote>
<p>The license is Apache 2, so it is OK. I'm open to this idea. Can you please describe how you envision this to be implemented?</p>
<p>Does this only work for PDF mime types? We must support a range of mime types (text, xls, pdf...). I was thinking we would use the browser's built-in support for mime types rather than build our own custom viewer for each one.</p>
<p>On the other hand, PDF will be a very common one and could be worth a custom implementation if we get a really good result (as compared with using the browser directly).</p>
<blockquote>
<p>Also this java library <a class="external" href="http://cssbox.sourceforge.net/pdf2dom/">http://cssbox.sourceforge.net/pdf2dom/</a> can be evaluated. It transforms pdf documents into html documents.</p>
</blockquote>
<p>No, this won't work for our needs. The user must have the original file and be provided to the user so they can save it or interact with it using some native tool (e.g. xls file in Excel as the browser's application helper).</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=600702018-03-30T14:10:40ZSergey Ivanovskiy
<ul></ul><p>Found that pdf.js supports only these browsers <a class="external" href="https://github.com/mozilla/pdf.js/wiki/Frequently-Asked-Questions#what-browsers-are-supported">https://github.com/mozilla/pdf.js/wiki/Frequently-Asked-Questions#what-browsers-are-supported</a> It is reported that Safari and IE11/Edge have limited supports(?).<br />If it is fitted our case, then we can create the dedicated mime type servlet handler that sends html output rendered in a web page. Although the viewer web page design can be the issue, pdf.js provides this example for evaluations <a class="external" href="http://jsfiddle.net/pdfjs/wagvs9Lf/?utm_source=website&utm_medium=embed&utm_campaign=wagvs9Lf">http://jsfiddle.net/pdfjs/wagvs9Lf/?utm_source=website&utm_medium=embed&utm_campaign=wagvs9Lf</a></p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=600722018-03-30T14:43:23ZSergey Ivanovskiy
<ul></ul><p>It seems that a servlet that implements OPEN-MIME-RESOURCE should only send a document with its correct mime type, then the target browser can display the target document if its document type is supported by this browser.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=600742018-03-30T15:05:15ZHynek Cihlar
<ul></ul><p>Sergey Ivanovskiy wrote:</p>
<blockquote>
<p>It seems that a servlet that implements OPEN-MIME-RESOURCE should only send a document with its correct mime type, then the target browser can display the target document if its document type is supported by this browser.</p>
</blockquote>
<p>Note that using the <code>embed</code> HTML 5 tag can increase the chance for the browser to open the document in a new window/tab. This worked OK for Chrome, even when it was configured not to open pdf files in a tab.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=600772018-03-30T17:34:06ZSergey Ivanovskiy
<ul></ul><p>OK. I will try <code>embed</code>. What are operands of this OPEN-MIME-RESOURCE? Is it the same as for P2J-OPEN-URL?</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=600782018-03-30T17:40:50ZGreg Shah
<ul></ul><blockquote>
<p>What are operands of this OPEN-MIME-RESOURCE? Is it the same as for P2J-OPEN-URL?</p>
</blockquote>
<p>It is not the same.</p>
<p>1. MIME type as a string/character value (e.g. "text/plain").<br />2. Some way to reference the resource, usually a filename for the FWD client system is one example. I'm not sure what is needed for usage from <code>OUTPUT TO PRINTER</code>.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=600812018-03-30T19:03:52ZSergey Ivanovskiy
<ul></ul><p>Thank you. I will follow this design.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=601072018-04-02T04:02:04ZEric Faulhaber
<ul><li><strong>Status</strong> changed from <i>New</i> to <i>WIP</i></li></ul> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=601082018-04-02T05:51:59ZSergey Ivanovskiy
<ul></ul><p>Working on <code>OPEN-MIME-RESOURCE</code>. According to <code>P2J-OPEN-URL</code><br /><pre>
/**
* Matches the P2J-extension language statement <code>P2J-OPEN-URL</code> and a mandatory
* following character expression.<br /> */<br />p2j_open_url_stmt<br /> :<br /> KW_OPEN_URL^ expr DOT!<br /> ;<br /></pre><br />the target statement requires to define a pair of strings or to define 2-tuple in order to state something like<br /><pre>
open_mime_rsrc_stmt
:
KW_OPEN_MIME_RESOURCE^ pair DOT!
;
</pre></p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=601092018-04-02T06:01:09ZSergey Ivanovskiy
<ul></ul><p>Actually, there is a helpful example how to state 2 or 3 parameters<br /><pre>
/**
* Matches the <code>COLLATE</code> keyword and the required following
* 2 or 3 character expressions. The tree is rooted on the
* <code>COLLATE</code> keyword and all parenthesis and commas are
* dropped from the tree. The resulting tree will have 2 or 3 children,
* each an expression.
* <p>
* Used by {@link #preselect_phrase} and the subtree is rooted by the
* keyword (which is the reason for using a separate rule for something so
* simple).<br /> */<br />collate_clause <br /> :<br /> KW_COLLATE^ LPARENS! expr COMMA! expr (COMMA! expr)? RPARENS!<br /> (KW_DESCEND)?<br /> ;<br /></pre></p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=601112018-04-02T09:29:18ZSergey Ivanovskiy
<ul></ul><p>Finally, this construction works properly<br /><pre>
/**
* Matches the FWD-extension language statement <code>OPEN-MIME-RESOURCE</code> and a mandatory
* pair of resource mime type character and its url character expression.<br /> */<br />open_mime_resource_stmt<br /> :<br /> KW_OPEN_MIME_RESOURCE^ expr expr DOT!<br /> ;<br /></pre></p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=601192018-04-02T14:47:55ZSergey Ivanovskiy
<ul></ul><p>Working on <code>OpenMimeResourceHandler</code> that should handle print requests from js web clients by loading html document with the embedded content to the target resource, then <code>PDFPrintOutputHandler</code> loads this document to the browser. <br />It seems that if we consider the case when java web clients are under proxy server, then the following code shouldn't work<br /><pre>
case types.MSG_OPEN_PRINT_OUTPUT:
var offset = 1;
var textLength = message[offset];
offset = offset + 1;
var id = me.readStringBinaryMessageByLength(message, offset, textLength);
offset = offset + textLength * 2;
window.open("/print/" + id, "_blank");
break;
</pre><br />because JS clients are out of the proxy server network. According to our web client design we have <code>webRoot</code> path as a root for all available web resources.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=601242018-04-02T15:42:14ZHynek Cihlar
<ul></ul><p>Sergey Ivanovskiy wrote:</p>
<blockquote>
<p>According to our web client design we have <code>webRoot</code> path as a root for all available web resources.</p>
</blockquote>
<p>Btw. why don't we reference the resources relative to the index file?</p>
<p>So instead of <br /><code><script type="text/javascript" src="${webRoot}/common/p2j.js"></script></code><br />having this<br /><code><script type="text/javascript" src="common/p2j.js"></script></code>.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=601252018-04-02T15:58:25ZSergey Ivanovskiy
<ul></ul><p>Yes, it seems we can use relative path if there are no missed design features.<br />It seems that web socket requires absolute path in this template <code>index.html</code><br /><pre>
'url' : 'wss://' + window.location.host + '${webRoot}/ajax',
</pre></p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=601442018-04-02T20:16:32ZSergey Ivanovskiy
<ul></ul><p>I tested PDFPrintOutputHandler and encountered this exception<br /><pre>
WARNING: //localhost:7449/print/7d9b2414-a5a5-4b19-a0ca-e7b5eaa9311c
java.lang.RuntimeException: org.eclipse.jetty.io.EofException
at com.goldencode.p2j.util.GUIPrinterStreamSupport.lambda$closeStream$1(GUIPrinterStreamSupport.java:351)
at com.goldencode.p2j.ui.client.gui.driver.web.PDFPrintOutputHandler.handle(PDFPrintOutputHandler.java:149)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1162)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1096)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:119)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
at org.eclipse.jetty.server.Server.handle(Server.java:518)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:308)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:244)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:273)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95)
at org.eclipse.jetty.io.ssl.SslConnection.onFillable(SslConnection.java:186)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:273)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95)
at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93)
at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceAndRun(ExecuteProduceConsume.java:246)
at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:156)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:654)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:572)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.eclipse.jetty.io.EofException
at org.eclipse.jetty.io.ChannelEndPoint.flush(ChannelEndPoint.java:197)
at org.eclipse.jetty.io.ssl.SslConnection$DecryptedEndPoint.flush(SslConnection.java:814)
at org.eclipse.jetty.io.WriteFlusher.flush(WriteFlusher.java:419)
at org.eclipse.jetty.io.WriteFlusher.write(WriteFlusher.java:313)
at org.eclipse.jetty.io.AbstractEndPoint.write(AbstractEndPoint.java:141)
at org.eclipse.jetty.server.HttpConnection$SendCallback.process(HttpConnection.java:724)
at org.eclipse.jetty.util.IteratingCallback.processing(IteratingCallback.java:241)
at org.eclipse.jetty.util.IteratingCallback.iterate(IteratingCallback.java:224)
at org.eclipse.jetty.server.HttpConnection.send(HttpConnection.java:512)
at org.eclipse.jetty.server.HttpChannel.sendResponse(HttpChannel.java:668)
at org.eclipse.jetty.server.HttpChannel.write(HttpChannel.java:722)
at org.eclipse.jetty.server.HttpOutput.write(HttpOutput.java:179)
at org.eclipse.jetty.server.HttpOutput.write(HttpOutput.java:163)
at org.eclipse.jetty.server.HttpOutput.flush(HttpOutput.java:299)
at java.io.FilterOutputStream.flush(FilterOutputStream.java:140)
at java.io.FilterOutputStream.close(FilterOutputStream.java:158)
at org.apache.pdfbox.pdfwriter.COSWriter.close(COSWriter.java:311)
at org.apache.pdfbox.pdmodel.PDDocument.save(PDDocument.java:1254)
at com.goldencode.p2j.util.GUIPrinterStreamSupport.lambda$closeStream$1(GUIPrinterStreamSupport.java:346)
... 20 more
Caused by: java.io.IOException: Broken pipe
at sun.nio.ch.FileDispatcherImpl.write0(Native Method)
at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:47)
at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:93)
at sun.nio.ch.IOUtil.write(IOUtil.java:51)
at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:471)
at org.eclipse.jetty.io.ChannelEndPoint.flush(ChannelEndPoint.java:175)
... 38 more
</pre><br />when this program is executed<br /><pre>
def var h1 as handle.
create window h1 assign title = "h1".
def var path as character format "x(256)" label "URL".
def button go1 label "Go".
form path skip go1 with frame f1 title "fh1".
enable all with frame f1 in window h1.
on "choose" of go1 in frame f1 do:
/* assign path.
message "Go " + path in window h1.
p2j-open-url path.
open-mime-resource string("text/plain") path.*/
def var i as int.
message "Starting.".
output to printer page-size 10.
repeat i = 1 to 1000:
display "this is a test line" i.
end.
output close.
message "Finished.".
end.
view h1.
wait-for close of current-window.
</pre></p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=601452018-04-02T20:17:57ZSergey Ivanovskiy
<ul></ul><p>Committed revision 11245.(3474a).</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=601512018-04-03T07:59:52ZSergey Ivanovskiy
<ul></ul><p>It seems the idea applied in <code>PDFPrintOutputHandler</code> to use direct output on <code>document.save(output)</code> should not work because it should close output stream before the actual data was written into https channel.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=601522018-04-03T08:10:40ZHynek Cihlar
<ul></ul><p>Sergey Ivanovskiy wrote:</p>
<blockquote>
<p>It seems the idea applied in <code>PDFPrintOutputHandler</code> to use direct output on <code>document.save(output)</code> should not work because it should close output stream before the actual data was written into https channel.</p>
</blockquote>
<p>Which output stream do you mean to be closed?</p>
<p>Btw. I think there is a bug in <code>GUIPrinterStreamSupport.closeStream()</code>. The document should be only closed from the finalizer, and not from the consumer.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=601542018-04-03T08:28:52ZSergey Ivanovskiy
<ul></ul><p>I mean https output stream. For an example, this code works properly<br /><pre>
ByteArrayOutputStream bout = new ByteArrayOutputStream();
output.outputConsumer.accept(bout);
ServletOutputStream out = httpServletResponse.getOutputStream();
out.write(bout.toByteArray());
out.flush();
</pre><br />The next finding is that <code>embed</code> tag in my environment doesn't help to display the target pdf. I can watch its content if looking at the source document. <code>view-source:https://localhost:7449/print/8fd81ccd-2f4c-4668-8097-c79a3b510a06</code>. I think we should send pdf output without wrapping it in html template.<br /><pre>
<html>
<head>
<title></title>
</head>
<body>
<embed src="/print/8fd81ccd-2f4c-4668-8097-c79a3b510a06" type="application/pdf"/>
</body>
</html>
</pre></p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=601552018-04-03T08:40:04ZSergey Ivanovskiy
<ul></ul><p>In my test the requested wrapped document has this url <code>https://localhost:7449/open/resource/?path=8fd81ccd-2f4c-4668-8097-c79a3b510a06&mimeType=application/pdf</code> and the target document has this <code>https://localhost:7449/print/8fd81ccd-2f4c-4668-8097-c79a3b510a06</code>. I got this document<br /><pre>
<html>
<head>
<title></title>
</head>
<body>
<embed src="/print/8fd81ccd-2f4c-4668-8097-c79a3b510a06" type="application/pdf"/>
</body>
</html>
</pre><br />and got <code>/print/8fd81ccd-2f4c-4668-8097-c79a3b510a06</code> but Firefox didn't show its look and feel.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=601562018-04-03T08:49:47ZHynek Cihlar
<ul></ul><p>Sergey Ivanovskiy wrote:</p>
<blockquote>
<p>I mean https output stream. For an example, this code works properly<br />[...]</p>
</blockquote>
<p>The problem is that PdfBox closes the provided stream when <code>PDDocument.save()</code> is called. Instead of creating new memory-backed stream, just create a simple stream wrapper that will provide a no-op override for its <code>close()</code> method and use it in <code>GUIPrinterStreamSupport.closeStream()</code>. <code>GuiDriver.deliverPrintOutput()</code> states "The consumer implementation must not close the provided stream.", so this change should satisfy the requirement.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=601572018-04-03T08:52:04ZSergey Ivanovskiy
<ul></ul><p>Yes, agree. About embed tag I can test this <a class="external" href="http://mozilla.github.io/pdf.js/getting_started/">http://mozilla.github.io/pdf.js/getting_started/</a> with our own view pdf template <code>open-resource.html</code> if there are no objections.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=601582018-04-03T08:54:42ZHynek Cihlar
<ul></ul><p>Sergey Ivanovskiy wrote:</p>
<blockquote>
<p>I mean https output stream. For an example, this code works properly<br />[...]<br />The next finding is that <code>embed</code> tag in my environment doesn't help to display the target pdf. I can watch its content if looking at the source document. <code>view-source:https://localhost:7449/print/8fd81ccd-2f4c-4668-8097-c79a3b510a06</code>. I think we should send pdf output without wrapping it in html template.<br />[...]</p>
</blockquote>
<p>Check the network monitor in the browser on the pdf resource (/print/...), what HTTP status code do you get in the response? Also do you see any errors in <code>PDFPrintOutputHandler</code>?</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=601592018-04-03T09:33:40ZSergey Ivanovskiy
<ul></ul><p>Hynek Cihlar wrote:</p>
<blockquote>
<p>Sergey Ivanovskiy wrote:</p>
<blockquote>
<p>I mean https output stream. For an example, this code works properly<br />[...]<br />The next finding is that <code>embed</code> tag in my environment doesn't help to display the target pdf. I can watch its content if looking at the source document. <code>view-source:https://localhost:7449/print/8fd81ccd-2f4c-4668-8097-c79a3b510a06</code>. I think we should send pdf output without wrapping it in html template.<br />[...]</p>
</blockquote>
<p>Check the network monitor in the browser on the pdf resource (/print/...), what HTTP status code do you get in the response? Also do you see any errors in <code>PDFPrintOutputHandler</code>?</p>
</blockquote>
<p>There are no exceptions and pdf document is on the client but it isn't displayed by Firefox. May be it is a template issue (open-resource.html). Please review committed revision 11246 with <code>PDFPrintOutputHandler</code> changes.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=601602018-04-03T10:10:26ZSergey Ivanovskiy
<ul></ul><p>Another questions follow. We have <code>ReportOutputFormat</code> and <code>GuiDriver.this.deliverPrintOutput(Consumer<OutputStream> consumer, Runnable finalizer, ReportOutputFormat format)</code> and reports of this type <code>ReportOutputFormat.PDF</code> are handled by <code>PDFPrintOutputHandler</code>. Are there handlers for CSV, XLS, XLSX reports? How to test these document types?</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=601612018-04-03T10:20:07ZHynek Cihlar
<ul><li><strong>File</strong> <a href="/attachments/download/6534/test.html">test.html</a><a href="/attachments/6534/test.html"><img src="/images/magnifier.png" alt="Magnifier" /></a> added</li></ul><p>Sergey Ivanovskiy wrote:</p>
<blockquote>
<p>Hynek Cihlar wrote:</p>
<blockquote>
<p>Sergey Ivanovskiy wrote:</p>
<blockquote>
<p>I mean https output stream. For an example, this code works properly<br />[...]<br />The next finding is that <code>embed</code> tag in my environment doesn't help to display the target pdf. I can watch its content if looking at the source document. <code>view-source:https://localhost:7449/print/8fd81ccd-2f4c-4668-8097-c79a3b510a06</code>. I think we should send pdf output without wrapping it in html template.<br />[...]</p>
</blockquote>
<p>Check the network monitor in the browser on the pdf resource (/print/...), what HTTP status code do you get in the response? Also do you see any errors in <code>PDFPrintOutputHandler</code>?</p>
</blockquote>
<p>There are no exceptions and pdf document is on the client but it isn't displayed by Firefox. May be it is a template issue (open-resource.html). Please review committed revision 11246 with <code>PDFPrintOutputHandler</code> changes.</p>
</blockquote>
<p>Open the attached html file, does it show up correctly? It does for me.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=601622018-04-03T10:27:50ZHynek Cihlar
<ul></ul><p>Sergey Ivanovskiy wrote:</p>
<blockquote>
<p>Another questions follow. We have <code>ReportOutputFormat</code> and <code>GuiDriver.this.deliverPrintOutput(Consumer<OutputStream> consumer, Runnable finalizer, ReportOutputFormat format)</code> and reports of this type <code>ReportOutputFormat.PDF</code> are handled by <code>PDFPrintOutputHandler</code>. Are there handlers for CSV, XLS, XLSX reports? How to test these document types?</p>
</blockquote>
<p><code>ReportOutputFormat</code>, <code>GuiDriver.deliverPrintOutput()</code> and related were created to support delivery of print outputs to clients. They were created before I was aware of <code>OPEN-MIME-RESOURCE</code>.</p>
<p>But I think these can be generalized easily. Rename <code>deliverPrintOutput</code> to something like <code>deliverMediaResource</code>, <code>PDFPrintOutputHandler</code> to <code>MediaResourceHandler</code> and so on. Also <code>ReportOutputFormat</code> is probably redundant, it can be replaced with <code>com.google.common.net.MediaType</code>.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=601632018-04-03T11:26:12ZSergey Ivanovskiy
<ul></ul><p>Yes, it works for me too. The problem was "Content-disposition" value: <code>attachment</code> or <code>inline</code>. If <code>attachment</code> is specified in header "Content-disposition", then nothing is displayed and the content isn't downloaded.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=601662018-04-03T12:32:19ZSergey Ivanovskiy
<ul></ul><p>It seems that file resources available from Swing client should be available via web clients. Thus, <code>FileResourceHandler</code> should be implemented. If it is required, then please help with FWD API for file resource searching.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=601672018-04-03T12:55:24ZHynek Cihlar
<ul></ul><p>Sergey Ivanovskiy wrote:</p>
<blockquote>
<p>It seems that file resources available from Swing client should be available via web clients. Thus, <code>FileResourceHandler</code> should be implemented. If it is required, then please help with FWD API for file resource searching.</p>
</blockquote>
<p>I am not aware of any special requirements for retrieving the file resources. Can you just simply open a file stream and supply it to <code>GuiDriver.deliverPrintOutput()</code> (or the renamed equivalent)?</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=601782018-04-03T14:58:55ZSergey Ivanovskiy
<ul></ul><p>Committed revision 11247 fixed issues with pdf and added new MSG_OPEN_MIME_RESOURCE. Working to implement file resource handler.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=601802018-04-03T14:59:30ZSergey Ivanovskiy
<ul></ul><p>Hynek Cihlar wrote:</p>
<blockquote>
<p>Sergey Ivanovskiy wrote:</p>
<blockquote>
<p>It seems that file resources available from Swing client should be available via web clients. Thus, <code>FileResourceHandler</code> should be implemented. If it is required, then please help with FWD API for file resource searching.</p>
</blockquote>
<p>I am not aware of any special requirements for retrieving the file resources. Can you just simply open a file stream and supply it to <code>GuiDriver.deliverPrintOutput()</code> (or the renamed equivalent)?</p>
</blockquote>
<p>Yes, I will try this way.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=601932018-04-03T18:01:43ZSergey Ivanovskiy
<ul></ul><p>Please review committed revision 11248. Now this construction is supported by web clients. <br /><pre>
open-mime-resource string("application/pdf") string("file:/home/sbi/Documents/groups.pdf").
</pre><br />I didn't implement it for Swing clients.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=601972018-04-03T18:57:51ZGreg Shah
<ul></ul><blockquote>
<p>I didn't implement it for Swing clients.</p>
</blockquote>
<p>It would be useful to launch a browser (we already support that) and then load the same way as in the web client.</p>
<p>Otherwise we have no solution for the Swing case, in printing or anything else like this.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=602282018-04-04T13:05:42ZSergey Ivanovskiy
<ul></ul><p>It needs to reuse the code that is responsible to fill html templates <code>HtmlResourceHandler</code>. Otherwise these functionality will be duplicated.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=602442018-04-05T05:32:44ZSergey Ivanovskiy
<ul></ul><p>The implemented method to wrap documents with help of <code>open-resource.html</code> template (embed) doesn't work for binary content types represented by <code>application/octet-stream</code>. It seems that in this case it is needed to request the target document directly from its handler.<br />Committed rev 11251 has been updated over trunc rev 11244.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=602452018-04-05T06:23:42ZConstantin Asofiei
<ul></ul><p>Sergey Ivanovskiy wrote:</p>
<blockquote>
<p>Finally, this construction works properly<br />[...]</p>
</blockquote>
<p>Does this allow you to have something like <code>open-mine-resource "text/plain" "a.txt".</code> or is it always needed to have <code>string("text/plain")</code>?</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=602462018-04-05T06:43:06ZSergey Ivanovskiy
<ul></ul><p>I checked that plain string parameters can be used too. Committed rev 11252 added missed java docs.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=602472018-04-05T06:45:16ZSergey Ivanovskiy
<ul></ul><p>It seems that now url string should be with its protocol, for an example "file:./a.txt".</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=602492018-04-05T08:43:06ZHynek Cihlar
<ul></ul><p>Sergey Ivanovskiy wrote:</p>
<blockquote>
<p>The implemented method to wrap documents with help of <code>open-resource.html</code> template (embed) doesn't work for binary content types represented by <code>application/octet-stream</code>. It seems that in this case it is needed to request the target document directly from its handler.<br />Committed rev 11251 has been updated over trunc rev 11244.</p>
</blockquote>
<p>Embedding the media (using embed tag for example) relies on the browser (or an installed plugin) being capable to handle it. Some media types can be embedded, some not. We should probably make this configurable. Greg, what do you think?</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=602532018-04-05T11:18:27ZGreg Shah
<ul></ul><blockquote>
<p>We should probably make this configurable. Greg, what do you think?</p>
</blockquote>
<p>Yes, this makes sense. We can embed by default and allow an optional boolean 3rd parameter (<code>true</code> means embed, <code>false</code> means don't embed).</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=602542018-04-05T13:58:22ZSergey Ivanovskiy
<ul></ul><p>OK, planning to add this optional parameter. Committed revision 11254 changed <code>SwingGuiDriver.this.deliverPrintOutput</code> to open printed documents via <code>SwingGuiDriver.this.openURL</code>. I found that <code>SwingGuiDriver.this.deliverPrintOutput</code> is possibly changed in the future<br /><pre>
// this implementation is not expected to be deployed in production due to possible file name collisions
// in multi-user environments and unresolved security concerns
UnimplementedFeature.experimental("Swing GUI PDF print output is an experimental feature not meant " +
"to be used in production environments.");
try
{
File outFile = new File(getPrintOutputDir(), getPrintOutputFile(format));
try(OutputStream os = new FileOutputStream(outFile))
{
consumer.accept(os);
}
openURL(outFile.toURI().normalize().toASCIIString());
..........................
</pre></p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=602682018-04-06T05:19:10ZSergey Ivanovskiy
<ul></ul><p>Greg, please review committed revision 11255.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=602692018-04-06T05:38:53ZSergey Ivanovskiy
<ul><li><strong>Status</strong> changed from <i>WIP</i> to <i>Review</i></li></ul> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=602722018-04-06T08:37:36ZHynek Cihlar
<ul></ul><p>Currently all the url targets are first copied to the machine that runs the FWD client and then streamed to the end-user's browser. This holds true even for urls that are not local to the FWD client system. Do we really want this? Or do we want to directly open the global urls in the user's browser (i.e. <a class="external" href="http://example.com/example.pdf">http://example.com/example.pdf</a>)?</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=602732018-04-06T09:11:08ZSergey Ivanovskiy
<ul></ul><p>Hynek Cihlar wrote:</p>
<blockquote>
<p>Currently all the url targets are first copied to the machine that runs the FWD client and then streamed to the end-user's browser. This holds true even for urls that are not local to the FWD client system. Do we really want this? Or do we want to directly open the global urls in the user's browser (i.e. <a class="external" href="http://example.com/example.pdf">http://example.com/example.pdf</a>)?</p>
</blockquote>
<p>No, only ids are copied.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=602742018-04-06T09:55:55ZHynek Cihlar
<ul></ul><p>Sergey Ivanovskiy wrote:</p>
<blockquote>
<p>Hynek Cihlar wrote:</p>
<blockquote>
<p>Currently all the url targets are first copied to the machine that runs the FWD client and then streamed to the end-user's browser. This holds true even for urls that are not local to the FWD client system. Do we really want this? Or do we want to directly open the global urls in the user's browser (i.e. <a class="external" href="http://example.com/example.pdf">http://example.com/example.pdf</a>)?</p>
</blockquote>
<p>No, only ids are copied.</p>
</blockquote>
<p>In <code>GuiWebDriver.openMimeResource()</code> method body:<br /><pre>
public void openMimeResource(String mimeType, String path, boolean embedded)
throws MalformedURLException
{
final URL url = new URL(path);
Consumer<OutputStream> consumer = output ->
{
try(InputStream input = url.openStream())
{
ByteStreams.copy(input, output);
...
</pre></p>
<p>When you supply an absolute URL with a domain, the <code>openStream()</code> and the <code>ByteStreams.copy()</code> calls will effectively fetch the target resource to FWD client.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=602752018-04-06T10:04:58ZHynek Cihlar
<ul></ul><p>Hynek Cihlar wrote:</p>
<blockquote>
<p>When you supply an absolute URL with a domain, the <code>openStream()</code> and the <code>ByteStreams.copy()</code> calls will effectively fetch the target resource to FWD client.</p>
</blockquote>
<p>To clarify, I'm not saying this is necessarily wrong, I just want to point this out whether we want this behavior.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=602762018-04-06T10:42:45ZSergey Ivanovskiy
<ul></ul><blockquote>
<p>Hynek Cihlar wrote:</p>
<blockquote>
<p>When you supply an absolute URL with a domain, the <code>openStream()</code> and the <code>ByteStreams.copy()</code> calls will effectively fetch the target resource to FWD client.</p>
</blockquote>
<p>To clarify, I'm not saying this is necessarily wrong, I just want to point this out whether we want this behavior.</p>
</blockquote>
<p>Now I understand your question. Yes, now it is possible to load documents by their URLs. it depends on requirements for OPEN-MIME-RESOURCE.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=602772018-04-06T11:06:03ZGreg Shah
<ul></ul><blockquote>
<p>Yes, now it is possible to load documents by their URLs. it depends on requirements for OPEN-MIME-RESOURCE.</p>
</blockquote>
<p>I should have specified this.</p>
<p>Only resources that are already on the FWD systems should be streamed. Any directly accessible URLS should be sent only as a URL, without copying to the FWD client.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=602782018-04-06T11:12:50ZGreg Shah
<ul></ul><p>Please remove this comment and code:</p>
<pre>
// this implementation is not expected to be deployed in production due to possible file name collisions
// in multi-user environments and unresolved security concerns
UnimplementedFeature.experimental("Swing GUI PDF print output is an experimental feature not meant " +
"to be used in production environments.");
</pre>
<p>At this time, I don't think we need to treat this as experimental.</p>
<p>The same issues exist for both Swing and Web clients. Actually, the Swing client is more likely to be run on a single client system, reducing the possible security issues. The primary problem is that we do no checking of the URL and this certainly exposes the user to some level of danger depending on how the URL is obtained.</p>
<p>Regardless, I don't want to suggest in the code that the feature doesn't work or cannot be relied upon.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=602802018-04-06T11:52:52ZSergey Ivanovskiy
<ul></ul><blockquote>
<p>Only resources that are already on the FWD systems should be streamed. Any directly accessible URLS should be sent only as a URL, without copying to the FWD client.</p>
</blockquote>
<p>Greg, please clarify this case. There are server's resources and client's resources. Should <code>P2j-OPEN-URL url.</code> satisfy the same requirement that resources are loaded only if they are on the FWD system?</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=602812018-04-06T11:57:15ZGreg Shah
<ul></ul><blockquote>
<p>There are server's resources and client's resources.</p>
</blockquote>
<p>As far as I know, at this point all the resources we need to <strong>stream</strong> are already on the FWD client. Those resources would be accessed via a <code>file://</code> URL.</p>
<p>Does anyone know of a case where we need to load from the FWD server?</p>
<p>Any URL that addresses a resource located outside of the FWD client, should still be sent to the client but it will <code>not be streamed</code> from the FWD client. Instead, the browser can load that resource directly from the URL.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=602832018-04-06T12:30:18ZSergey Ivanovskiy
<ul></ul><p>We don't specify the case if this command is failed. What should be done in this case? Now if resources are failed to load or specified urls are malformed, then exceptions on the client side are thrown. If resources are external, then only urls will be sent to the client side. Does it need to have a feedback in this case?</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=602872018-04-06T14:19:42ZGreg Shah
<ul></ul><blockquote>
<p>If resources are external, then only urls will be sent to the client side. Does it need to have a feedback in this case?</p>
</blockquote>
<p>No.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=603022018-04-07T14:38:52ZSergey Ivanovskiy
<ul></ul><p>Please review committed revision 11256 that fixed <a class="issue tracker-2 status-5 priority-4 priority-default closed" title="Feature: OPEN-MIME-RESOURCE (Closed)" href="https://proj.goldencode.com/issues/3474#note-55">#3474-55</a> and <a class="issue tracker-2 status-5 priority-4 priority-default closed" title="Feature: OPEN-MIME-RESOURCE (Closed)" href="https://proj.goldencode.com/issues/3474#note-56">#3474-56</a>.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=603042018-04-09T11:12:09ZGreg Shah
<ul></ul><p>Code Review Task Branch 3474a Revision 11256</p>
<p>This is really good. I think it is almost finished.</p>
<p>1. Please change <code>kw_open_mime_resource</code> to be <code>kw_openmime</code>. We always limit the <code>KW_*</code> constants to a maximum length of 11 characters including the <code>KW_</code> prefix.</p>
<p>2. On the <code>new Keyword("open-mime-resource"...</code> line, please add a comment <code>// FWD extension, not real 4GL!</code>.</p>
<p>3. Please change the keyword text for <code>"p2j-open-url"</code> to <code>"open-url"</code>. It is more consistent with our current approach which <strong>does not</strong> use a <code>p2j-/fwd-</code> prefix.</p>
<p>4. Do we need to have both <code>MSG_OPEN_PRINT_OUTPUT</code> and <code>MSG_OPEN_MIME_RESOURCE</code> messages? Doesn't <code>MSG_OPEN_MIME_RESOURCE</code> handle both needs?</p>
<p>5. It seems that our <code>MSG_OPEN_PRINT_OUTPUT</code> and <code>MSG_OPEN_MIME_RESOURCE</code> message is limited to 255 bytes in size and the URL is also limited to 255 characters (if the entire URL could be fit). I say this because it seems that the size of the message and URL are both limited to a number tat can be fit into a single byte. This seems to be too small and it also might be a kind of buffer overflow problem if the input is larger.</p>
<p>6. Please check if we have other web socket cases where our strings are limited to 255 characters without any checking of actual lengths.</p>
<p>7. <code>PDFPrintOutput</code> is not always a PDF, right? Shouldn't we name this class differently to be more clear?</p>
<p>8. Is <code>TC.openMimeResource()</code> a superset of <code>TC.openURL()</code>? It seems like the server side can just call <code>TC.openMimeResource()</code> with the right parameters to get the same result.</p>
<p>9. For <code>SwingGuiDriver.openMimeResource()</code> can't we honor the <code>mimeType</code> and <code>embedded</code> parameters?</p>
<p>10. <code>build.xml</code>, <code>PDFPrintOutput</code>, <code>GUIPrinterStreamSupport</code> are missing history entries.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=603092018-04-09T13:36:27ZSergey Ivanovskiy
<ul></ul><p>Greg Shah wrote:</p>
<blockquote>
<p>Code Review Task Branch 3474a Revision 11256</p>
</blockquote>
<p>Thank you, planning to fix all these issues.</p>
<blockquote>
<p>4. Do we need to have both <code>MSG_OPEN_PRINT_OUTPUT</code> and <code>MSG_OPEN_MIME_RESOURCE</code> messages? Doesn't <code>MSG_OPEN_MIME_RESOURCE</code> handle both needs?</p>
</blockquote>
<p>Yes, it seems that <code>MSG_OPEN_URL</code> can be delegated to <code>MSG_OPEN_MIME_RESOURCE</code> too.</p>
<blockquote>
<p>5. It seems that our <code>MSG_OPEN_PRINT_OUTPUT</code> and <code>MSG_OPEN_MIME_RESOURCE</code> message is limited to 255 bytes in size and the URL is also limited to 255 >characters (if the entire URL could be fit). I say this because it seems that the size of the message and URL are both limited to a number tat can be <br />fit into a single byte. This seems to be too small and it also might be a kind of buffer overflow problem if the input is larger.</p>
</blockquote>
<p>Yes, the id field in <code>MSG_OPEN_PRINT_OUTPUT</code> holds UUID and has 16 byte length, but <code>MSG_OPEN_MIME_RESOURCE</code> can hold URL and the mime type field can be a long string. I missed all these facts.</p>
<blockquote>
<p>8. Is <code>TC.openMimeResource()</code> a superset of <code>TC.openURL()</code>? It seems like the server side can just call <code>TC.openMimeResource()</code> with the right parameters to get the same result.</p>
</blockquote>
<p>Yes.</p>
<blockquote>
<p>9. For <code>SwingGuiDriver.openMimeResource()</code> can't we honor the <code>mimeType</code> and <code>embedded</code> parameters?</p>
</blockquote>
<p>I didn't implement a special code because this command should open a browser with a file resource. It seems that the <code>embedded</code> value, false or true, doesn't have an affect on this case. And the <code>mimeType</code> value looks unimportant in this case.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=603102018-04-09T14:31:36ZGreg Shah
<ul></ul><blockquote>
<p>I didn't implement a special code because this command should open a browser with a file resource.</p>
</blockquote>
<p>It could be a external URL too.</p>
<blockquote>
<p>It seems that the embedded value, false or true, doesn't have an affect on this case. And the mimeType value looks unimportant in this case.</p>
</blockquote>
<p>I don't understand this part. If we have generated a PDF and are displaying it, the user will want the PDF to appear as a browser tab in the browser launched for the Swing client, just as they would see in the web client. The only difference between these cases is the fact that we must launch a browser in the Swing case. Otherwise, it should act the same.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=603232018-04-10T09:52:04ZSergey Ivanovskiy
<ul></ul><p>Please review committed revision 11258 that fixed <a class="issue tracker-2 status-5 priority-4 priority-default closed" title="Feature: OPEN-MIME-RESOURCE (Closed)" href="https://proj.goldencode.com/issues/3474#note-62">#3474-62</a>.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=603242018-04-10T10:09:17ZSergey Ivanovskiy
<ul></ul><p>Please review committed revision 11259 (missed changes) that removed <code>ScreenDriver.this.openURL</code> since <code>openURL</code> was delegated to <code>openMimeResource</code>.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=603312018-04-10T12:50:47ZGreg Shah
<ul></ul><p>Code Review Task Branch 3474a Revision 11259</p>
<p>I'm good with the changes. I did check in some minor formatting and comment cleanup.</p>
<p>Hynek: Please review.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=603502018-04-10T17:46:14ZHynek Cihlar
<ul></ul><p>Code review 3474a revision 11260.</p>
<p><code>open-resource.html</code>:<br /><code>"https://" + window.location.host + "${webRoot}/${documentHandler}/${documentPath}";</code><br />The expression misses <code>location.port</code>.</p>
<p><code>lang_stmts.rules</code><br />OPEN_MIME-RESOURCE -> OPEN-MIME-RESOURCE</p>
<p>Why do we need both keywords <code>OPEN-MIME-RESOURCE</code> and <code>OPEN-URL</code>? Is there any use case that <code>OPEN-URL</code> couldn't<br />handle? A file local to FWD client can be expressed with a url such as <code>file:///path/filename</code>.</p>
<p>The doc for the method <code>openMimeResource</code> in several classes mentions path as the second param. But this can<br />be a full URL according to all the implementations. Please rename the parameter and fix the documentation for<br />it.</p>
<p><code>GuiWebDriver.openMimeResource()</code><br />The opened input stream should be closed in a finalizer. Also the consumer can be called multiple times and so<br /> it must reset the stream before it reads it.<br /> The method should validate the input url in all the cases, not only the for the <code>file</code> scheme.</p>
<p><code>SwingGuiDriver.openMimeResource()</code><br />There is a standard class <code>Desktop</code>. I think it performs exactly those operations we need for opening media<br />files and urls. It declares two methods, <code>open()</code> and <code>browse()</code>. The former launches the application<br />associated with the provided file type. The latter opens the desktop default browser and navigates to the<br />provided url. Currently <code>SwingGuiDriver.openMimeResource()</code> always opens the preconfigured browser, so even if<br /> the user has Open Office installed, and thus capable to open the open office files directly, the current<br /> implementation will anyway launch a browser and download the file to a dir. Not very useful I think.</p>
<p><code>MSG_OPEN_MIME_RESOURCE</code> message handler in <code>p2j.socket.js</code> doesn't handle absolute urls,<br /><code>buildOpenResourceUrl</code> always prepends <code>p2j.webRoot</code> to the provided <code>path</code>.</p>
<p><code>SwingGuiDriver.deliverDocumentOutput()</code> still refers to PDF in its javadoc.</p>
<p><code>DocumentOutputHandler</code> still matches the "print" path.</p>
<p>Please move the PRINT OUTPUT related javadoc from <code>DocumentOutputStorage</code> to <code>GUIPrinterStreamSupport</code>.</p>
<p>Plus I renamed <code>ReportOutputFormat</code> to <code>MediaType</code> and moved it in <code>com.goldencode.p2j.util</code>.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=603522018-04-10T18:32:56ZSergey Ivanovskiy
<ul></ul><p>Hynek Cihlar wrote:</p>
<blockquote>
<p>Code review 3474a revision 11260.</p>
<p><code>open-resource.html</code>:<br /><code>"https://" + window.location.host + "${webRoot}/${documentHandler}/${documentPath}";</code><br />The expression misses <code>location.port</code>.</p>
</blockquote>
<p>This expression is correct according to <a class="external" href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLHyperlinkElementUtils/host">https://developer.mozilla.org/en-US/docs/Web/API/HTMLHyperlinkElementUtils/host</a> . Please look at this documentation. <code>host</code> expression includes <code>port</code>.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=603532018-04-10T18:46:43ZSergey Ivanovskiy
<ul></ul><p>Hynek Cihlar wrote:</p>
<blockquote>
<p><code>GuiWebDriver.openMimeResource()</code><br />The opened input stream should be closed in a finalizer. Also the consumer can be called multiple times and so<br />it must reset the stream before it reads it.<br />The method should validate the input url in all the cases, not only the for the <code>file</code> scheme.</p>
</blockquote>
<p>I don't understand why it requires <code>finalizer</code> because the <code>try with resource</code> construction is used. Please explain it more thoroughly.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=603542018-04-10T18:52:31ZSergey Ivanovskiy
<ul></ul><p>Hynek Cihlar wrote:</p>
<blockquote>
<p>Code review 3474a revision 11260.<br /><code>SwingGuiDriver.openMimeResource()</code><br />There is a standard class <code>Desktop</code>. I think it performs exactly those operations we need for opening media<br />files and urls. It declares two methods, <code>open()</code> and <code>browse()</code>. The former launches the application<br />associated with the provided file type. The latter opens the desktop default browser and navigates to the<br />provided url. Currently <code>SwingGuiDriver.openMimeResource()</code> always opens the preconfigured browser, so even if<br />the user has Open Office installed, and thus capable to open the open office files directly, the current<br />implementation will anyway launch a browser and download the file to a dir. Not very useful I think.</p>
</blockquote>
<p>It seems that now it is implemented as for the web client. If <code>Desktop</code> class helps to open Open Office documents, then this implementation will have different functionality. I don't object to implement this idea with <code>Desktop</code>.</p>
<p>Greg, please approve this requirement.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=603552018-04-10T18:57:41ZSergey Ivanovskiy
<ul></ul><p>Hynek Cihlar wrote:</p>
<blockquote>
<p>Code review 3474a revision 11260.</p>
<p>Plus I renamed <code>ReportOutputFormat</code> to <code>MediaType</code> and moved it in <code>com.goldencode.p2j.util</code>.</p>
</blockquote>
<p>It seems that it is already done, isn't it?</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=603562018-04-10T18:58:12ZHynek Cihlar
<ul></ul><p>Sergey Ivanovskiy wrote:</p>
<blockquote>
<p>I don't understand why it requires <code>finalizer</code> because the <code>try with resource</code> construction is used. Please explain it more thoroughly.</p>
</blockquote>
<p>You are right, the stream is opened only for the duration of the consumer. Please disregard this.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=603572018-04-10T18:59:46ZHynek Cihlar
<ul></ul><p>Sergey Ivanovskiy wrote:</p>
<blockquote><blockquote>
<p>Plus I renamed <code>ReportOutputFormat</code> to <code>MediaType</code> and moved it in <code>com.goldencode.p2j.util</code>.</p>
</blockquote>
<p>It seems that it is already done, isn't it?</p>
</blockquote>
<p>Yes.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=603642018-04-10T19:45:58ZGreg Shah
<ul></ul><blockquote>
<p>If Desktop class helps to open Open Office documents, then this implementation will have different functionality. I don't object to implement this idea with Desktop.</p>
</blockquote>
<p>Having a different behavior is OK, if it is a better approach for the user. But we tried using <code>Desktop</code> and it caused a hang in Swing. See #1815-25.</p>
<p>Also, there is the case where <code>isDesktopSupported()</code> is <code>false</code> in which case the <code>Desktop</code> class cannot be used.</p>
<p>If the <code>Desktop</code> class will work properly, then I am OK with using it in the Swing client. But we must have a standard fall-back approach that always works.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=603672018-04-10T20:18:32ZSergey Ivanovskiy
<ul></ul><blockquote>
<p>MSG_OPEN_MIME_RESOURCE message handler in p2j.socket.js doesn't handle absolute urls,<br />buildOpenResourceUrl always prepends p2j.webRoot to the provided path.</p>
</blockquote>
<p>If the resource is streamed, then it is downloaded from the web client. If it is not streamed, then the template document with absolute url is downloaded<br />from the web client. Don't understand what is incorrect. Please explain.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=603702018-04-10T20:43:09ZHynek Cihlar
<ul></ul><p>Sergey Ivanovskiy wrote:</p>
<blockquote><blockquote>
<p>MSG_OPEN_MIME_RESOURCE message handler in p2j.socket.js doesn't handle absolute urls,<br />buildOpenResourceUrl always prepends p2j.webRoot to the provided path.</p>
</blockquote>
<p>If the resource is streamed, then it is downloaded from the web client. If it is not streamed, then the template document with absolute url is downloaded<br />from the web client. Don't understand what is incorrect. Please explain.</p>
</blockquote>
<p>If I interpret the program logic correctly, the variable <code>id</code> in <code>case types.MSG_OPEN_MIME_RESOURCE:</code> in <code>p2j.socket.js</code> can be an absolute URL (<a class="external" href="http://example.com">http://example.com</a>). So when not <code>embedding</code> and <code>local</code> the resulting url in <code>buildOpenResourceUrl</code> is calculated as <code>p2j.webRoot + "/print/" + "http://example.com";</code>.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=603712018-04-10T20:47:33ZSergey Ivanovskiy
<ul></ul><p>Hynek Cihlar wrote:</p>
<blockquote>
<p>Sergey Ivanovskiy wrote:</p>
<blockquote><blockquote>
<p>MSG_OPEN_MIME_RESOURCE message handler in p2j.socket.js doesn't handle absolute urls,<br />buildOpenResourceUrl always prepends p2j.webRoot to the provided path.</p>
</blockquote>
<p>If the resource is streamed, then it is downloaded from the web client. If it is not streamed, then the template document with absolute url is downloaded<br />from the web client. Don't understand what is incorrect. Please explain.</p>
</blockquote>
<p>If I interpret the program logic correctly, the variable <code>id</code> in <code>case types.MSG_OPEN_MIME_RESOURCE:</code> in <code>p2j.socket.js</code> can be an absolute URL (<a class="external" href="http://example.com">http://example.com</a>). So when not <code>embedding</code> and <code>local</code> the resulting url in <code>buildOpenResourceUrl</code> is calculated as <code>p2j.webRoot + "/print/" + "http://example.com";</code>.</p>
</blockquote>
<p>This url is not local because only file resources can be local.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=603722018-04-10T20:48:18ZHynek Cihlar
<ul></ul><p>Also I think <code>path</code> in <code>url += "/open/resource/?path=" + path;</code> in <code>buildOpenResourceUrl</code> should be url encoded.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=603732018-04-10T20:51:58ZSergey Ivanovskiy
<ul></ul><p>Hynek Cihlar wrote:</p>
<blockquote>
<p>Also I think <code>path</code> in <code>url += "/open/resource/?path=" + path;</code> in <code>buildOpenResourceUrl</code> should be url encoded.</p>
</blockquote>
<p>Yes, agree.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=603752018-04-10T20:54:17ZHynek Cihlar
<ul></ul><p>Sergey Ivanovskiy wrote:</p>
<blockquote>
<p>Hynek Cihlar wrote:</p>
<blockquote>
<p>Sergey Ivanovskiy wrote:</p>
<blockquote><blockquote>
<p>MSG_OPEN_MIME_RESOURCE message handler in p2j.socket.js doesn't handle absolute urls,<br />buildOpenResourceUrl always prepends p2j.webRoot to the provided path.</p>
</blockquote>
<p>If the resource is streamed, then it is downloaded from the web client. If it is not streamed, then the template document with absolute url is downloaded<br />from the web client. Don't understand what is incorrect. Please explain.</p>
</blockquote>
<p>If I interpret the program logic correctly, the variable <code>id</code> in <code>case types.MSG_OPEN_MIME_RESOURCE:</code> in <code>p2j.socket.js</code> can be an absolute URL (<a class="external" href="http://example.com">http://example.com</a>). So when not <code>embedding</code> and <code>local</code> the resulting url in <code>buildOpenResourceUrl</code> is calculated as <code>p2j.webRoot + "/print/" + "http://example.com";</code>.</p>
</blockquote>
<p>This url is not local because only file resources can be local.</p>
</blockquote>
<p>Anyway, <code>buildOpenResourceUrl</code> always prepends the url with the webRoot as already mentioned. When not local the expression will be <code>p2j.webRoot + "/open/resource/?path=" + "http://example.com"</code>.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=603762018-04-10T20:56:04ZHynek Cihlar
<ul></ul><p>Hynek Cihlar wrote:</p>
<blockquote>
<p>Anyway, <code>buildOpenResourceUrl</code> always prepends the url with the webRoot as already mentioned. When not local the expression will be <code>p2j.webRoot + "/open/resource/?path=" + "http://example.com"</code>.</p>
</blockquote>
<p>The requirement was to use such url directly: window.location = "https://example.com".</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=603802018-04-11T04:10:52ZSergey Ivanovskiy
<ul></ul><p>Hynek Cihlar wrote:</p>
<blockquote>
<p>Hynek Cihlar wrote:</p>
<blockquote>
<p>Anyway, <code>buildOpenResourceUrl</code> always prepends the url with the webRoot as already mentioned. When not local the expression will be <code>p2j.webRoot + "/open/resource/?path=" + "http://example.com"</code>.</p>
</blockquote></blockquote>
<p>It is GET request to the application servlet and the servlet responds with the wrapped document with this <code>url = "http://example.com"</code>. The request is built according to the web client design, thus it starts from <code>webRoot</code> in this GET request.</p>
<blockquote>
<p>The requirement was to use such url directly: window.location = "https://example.com".</p>
</blockquote>
What do you propose? I see two variants:
<ol>
<li>The servlet responds with redirect responses.</li>
<li>The document loaded from this servlet makes this redirect via jscript on load.<br /><pre>
<script type="text/javascript">
function onLoad()
{
var config = {'isStreamed' : ${isStreamed} };
var el = document.getElementById("embeddedDocument");
if (config.isStreamed)
{
el.src = "https://" + window.location.host + "${webRoot}/${documentHandler}/${documentPath}";
}
else
{
if (not embedded document)
{
window.location = "${documentPath}";
}
else
{
el.src = "${documentPath}";
}
}
el.width = window.screen.availWidth;
el.height = window.screen.availHeight;
}
onLoad();
</script>
</pre></li>
</ol> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=603832018-04-11T07:43:46ZHynek Cihlar
<ul></ul><p>Sergey Ivanovskiy wrote:</p>
<blockquote>
<p>Hynek Cihlar wrote:</p>
<blockquote>
<p>Hynek Cihlar wrote:</p>
<blockquote>
<p>Anyway, <code>buildOpenResourceUrl</code> always prepends the url with the webRoot as already mentioned. When not local the expression will be <code>p2j.webRoot + "/open/resource/?path=" + "http://example.com"</code>.</p>
</blockquote></blockquote>
<p>It is GET request to the application servlet and the servlet responds with the wrapped document with this <code>url = "http://example.com"</code>. The request is built according to the web client design, thus it starts from <code>webRoot</code> in this GET request.</p>
<blockquote>
<p>The requirement was to use such url directly: window.location = "https://example.com".</p>
</blockquote>
<p>What do you propose? I see two variants:</p>
</blockquote>
<p>When not embedding and not streaming (i.e. having valid absolute url with domain) do <code>window.open(id, "_blank")</code>.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=603862018-04-11T08:52:57ZSergey Ivanovskiy
<ul></ul><p>OK, it is 3rd variant.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=603882018-04-11T11:58:10ZSergey Ivanovskiy
<ul></ul><p>Hynek, please note that your changes in this code<br /><pre>
=== modified file 'src/com/goldencode/p2j/ui/client/gui/driver/web/GuiWebDriver.java'
--- src/com/goldencode/p2j/ui/client/gui/driver/web/GuiWebDriver.java 2018-04-10 09:49:19 +0000
+++ src/com/goldencode/p2j/ui/client/gui/driver/web/GuiWebDriver.java 2018-04-10 17:42:14 +0000
@@ -172,7 +172,6 @@
import com.goldencode.p2j.cfg.*;
import com.goldencode.p2j.main.*;
-import com.goldencode.p2j.reporting.*;
import com.goldencode.p2j.ui.*;
import com.goldencode.p2j.ui.chui.ThinClient;
import com.goldencode.p2j.ui.client.*;
@@ -2140,7 +2139,7 @@
@Override
public void deliverDocumentOutput(Consumer<OutputStream> consumer,
Runnable finalizer,
- ReportOutputFormat format)
+ MediaType format)
{
UUID uuid = UUID.randomUUID();
DocumentOutput printOut = new DocumentOutput(consumer,
@@ -2184,6 +2183,7 @@
{
try(InputStream input = url.openStream())
{
+ input.reset();
ByteStreams.copy(input, output);
}
catch (IOException e)
</pre><br />are incorrect. I fixed this change due to exception java.lang.RuntimeException: java.io.IOException: Resetting to invalid mark.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=603892018-04-11T12:00:29ZSergey Ivanovskiy
<ul></ul><p>I see you already fixed it. Thank you.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=603902018-04-11T12:02:31ZSergey Ivanovskiy
<ul></ul><p>Greg Shah wrote:</p>
<blockquote><blockquote>
<p>If Desktop class helps to open Open Office documents, then this implementation will have different functionality. I don't object to implement this idea with Desktop.</p>
</blockquote>
<p>Having a different behavior is OK, if it is a better approach for the user. But we tried using <code>Desktop</code> and it caused a hang in Swing. See #1815-25.</p>
<p>Also, there is the case where <code>isDesktopSupported()</code> is <code>false</code> in which case the <code>Desktop</code> class cannot be used.</p>
<p>If the <code>Desktop</code> class will work properly, then I am OK with using it in the Swing client. But we must have a standard fall-back approach that always works.</p>
</blockquote>
<p>I checked that now using Desktop doesn't freeze the Swing client.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=603912018-04-11T12:04:02ZSergey Ivanovskiy
<ul></ul><p>Please review committed revision 11263.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=603922018-04-11T13:03:07ZGreg Shah
<ul></ul><p>Code Review Task Branch 3474a Revision 11263</p>
<p>I'm good with the changes.</p>
<p>Hynek: Do you have any objections?</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=603932018-04-11T13:22:19ZHynek Cihlar
<ul></ul><p>Code review 3474a revision 11263</p>
<p><code>SwingGuiDriver.openMimeResource()</code><br />The method will throw an unexpected exception when non-file uri scheme is given to it. The subjected line is <code>Desktop.getDesktop().open(new File(uri));</code>. Use <code>open(File)</code> only for file schemes, for the rest use <code>Desktop.browse</code>.</p>
<p>The uri string must be encoded in <code>buildOpenResourceUrl()</code> in all places where it is used as part of the webRoot url. Use <code>encodeURIComponent</code>. To decode the uri on the server, use <code>URLDecoder.decode(uri, "UTF-8")</code>. Remove <code>String id = uri.toASCIIString();</code> from <code>GuiWebDriver.openMimeResource()</code>.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=603952018-04-11T13:39:50ZSergey Ivanovskiy
<ul></ul><p>Hynek Cihlar wrote:</p>
<blockquote>
<p>Code review 3474a revision 11263</p>
<p><code>SwingGuiDriver.openMimeResource()</code><br />The method will throw an unexpected exception when non-file uri scheme is given to it. The subjected line is <code>Desktop.getDesktop().open(new File(uri));</code>. Use <code>open(File)</code> only for file schemes, for the rest use <code>Desktop.browse</code>.</p>
</blockquote>
<p>Yes, agree.</p>
<blockquote>
<p>The uri string must be encoded in <code>buildOpenResourceUrl()</code> in all places where it is used as part of the webRoot url. Use <code>encodeURIComponent</code>. To decode the uri on the server, use <code>URLDecoder.decode(uri, "UTF-8")</code>. Remove <code>String id = uri.toASCIIString();</code> from <code>GuiWebDriver.openMimeResource()</code>.</p>
</blockquote>
<p>It seems that <code>String id = uri.toASCIIString();</code> does what is required. Otherwise, it needs to do changes in two files.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=603992018-04-11T14:13:48ZSergey Ivanovskiy
<ul></ul><p>Hynek Cihlar wrote:</p>
<blockquote>
<p>Code review 3474a revision 11263</p>
<p><code>SwingGuiDriver.openMimeResource()</code><br />The method will throw an unexpected exception when non-file uri scheme is given to it. The subjected line is <code>Desktop.getDesktop().open(new File(uri));</code>. Use <code>open(File)</code> only for file schemes, for the rest use <code>Desktop.browse</code>.</p>
</blockquote>
<p>Committed revision 11264 fixed this issue.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=604012018-04-11T14:20:35ZHynek Cihlar
<ul></ul><p>Sergey Ivanovskiy wrote:</p>
<blockquote>
<p>Hynek Cihlar wrote:</p>
<blockquote>
<p>Code review 3474a revision 11263</p>
<p><code>SwingGuiDriver.openMimeResource()</code><br />The method will throw an unexpected exception when non-file uri scheme is given to it. The subjected line is <code>Desktop.getDesktop().open(new File(uri));</code>. Use <code>open(File)</code> only for file schemes, for the rest use <code>Desktop.browse</code>.</p>
</blockquote>
<p>Yes, agree.</p>
<blockquote>
<p>The uri string must be encoded in <code>buildOpenResourceUrl()</code> in all places where it is used as part of the webRoot url. Use <code>encodeURIComponent</code>. To decode the uri on the server, use <code>URLDecoder.decode(uri, "UTF-8")</code>. Remove <code>String id = uri.toASCIIString();</code> from <code>GuiWebDriver.openMimeResource()</code>.</p>
</blockquote>
<p>It seems that <code>String id = uri.toASCIIString();</code> does what is required. Otherwise, it needs to do changes in two files.</p>
</blockquote>
<p><code>toASCIIString()</code> only escapes non-ascii characters, but it doesn't produce valid <code>application/x-www-form-urlencoded</code> content. Consider unsafe characters such as '&' or '?'. These will break the resulting uri when put in a query parameter.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=604022018-04-11T14:27:52ZSergey Ivanovskiy
<ul></ul><p>Yes, understand now. Committed revision 11265 fixed this issue.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=604032018-04-11T14:36:22ZSergey Ivanovskiy
<ul></ul><p>Please review the committed revision 11265.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=604042018-04-11T14:48:37ZGreg Shah
<ul></ul><p>Code Review Task Branch 3474a Revision 11265</p>
<p>I'm good with the changes.</p>
<p>Hynek?</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=604052018-04-11T16:23:18ZSergey Ivanovskiy
<ul></ul><p>3474a rev 11266 is rebased over the current trunc rev 11245.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=604112018-04-11T19:09:52ZHynek Cihlar
<ul></ul><p>Code review 3474a revision 11266.</p>
<p>The changes look good. I have no more objections.</p>
<p>Sergey, also please test the different modes ((no)embedding, (no)streaming, (no)local, etc.) with file/path names having spaces, diacritical marks, unsafe uri characters (like ?, <span>, x%x</span>, etc.), etc.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=604172018-04-11T19:58:37ZGreg Shah
<ul></ul><p>Sergey: You can start ChUI regression testing on devsrv01.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=604222018-04-12T10:37:21ZSergey Ivanovskiy
<ul></ul><p>Hynek Cihlar wrote:</p>
<blockquote>
<p>Code review 3474a revision 11266.</p>
<p>The changes look good. I have no more objections.</p>
<p>Sergey, also please test the different modes ((no)embedding, (no)streaming, (no)local, etc.) with file/path names having spaces, diacritical marks, unsafe uri characters (like ?, <span>, x%x</span>, etc.), etc.</p>
</blockquote>
<p>Planning to add these tests in testcases.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=604232018-04-12T10:40:26ZSergey Ivanovskiy
<ul></ul><p>Greg Shah wrote:</p>
<blockquote>
<p>Sergey: You can start ChUI regression testing on devsrv01.</p>
</blockquote>
<p>3474a passed conversion regression tests. Now main regression tests are running.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=604352018-04-12T18:01:44ZSergey Ivanovskiy
<ul></ul><p>Please review committed revision 11267 that added <code>UTF-8</code> charset to <code>open-resource.html</code> in order <code>OPEN-MIME-RESOURCE</code> works properly with embedded html documents given by external urls expressed in native languages <br /><pre>
open-mime-resource "plain/html" "https://ru.wikipedia.org/wiki/Гагарин,_Юрий_Алексеевич" yes.
</pre></p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=604362018-04-12T18:11:40ZSergey Ivanovskiy
<ul></ul><p>The first round of main-regression tests passed with 3 failed tests. The second round is running now.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=604412018-04-12T19:31:47ZHynek Cihlar
<ul></ul><p>Code review 3474a revision 11267.</p>
<p>The change is OK.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=604452018-04-12T20:01:17ZSergey Ivanovskiy
<ul></ul><p>Sergey Ivanovskiy wrote:</p>
<blockquote>
<p>The first round of main-regression tests passed with 3 failed tests. The second round is running now.</p>
</blockquote>
<p>In two runs there are 2 common failed tests. But they are false negative. Planning to run them separately.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=604492018-04-12T20:55:34ZSergey Ivanovskiy
<ul></ul><p>These 2 failed tests passed in 2 single runs.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=604512018-04-12T21:02:13ZEric Faulhaber
<ul></ul><p>Please wait for task branch 3434a to be merged to trunk, then rebase and merge 3474a to trunk. Please confirm that 3474a builds cleanly after the rebase, but it is not necessary to re-run regression testing.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=604592018-04-12T22:09:51ZSergey Ivanovskiy
<ul></ul><p>Rev 11268 was rebased over current trunc rev 11246. Committed revision 11269 fixed related to this branch javadoc warnings. The task branch was built successfully.<br />Now OpenJDK can help to detect only 2 javadoc warnings in these files <code>src/com/goldencode/graphdb/GraphDB.java</code> and <code>src/com/goldencode/p2j/util/EnvironmentOps.java</code>.<br />Can rev 11269 be merged to trunc?</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=604612018-04-12T22:19:44ZSergey Ivanovskiy
<ul></ul><p>Planning to merge rev 11269.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=604622018-04-12T22:23:09ZGreg Shah
<ul></ul><p>Yes, please do.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=604632018-04-12T22:34:19ZSergey Ivanovskiy
<ul></ul><p>3474a has been merged into the trunk as bzr revision 11247 and archived.</p> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=605092018-04-16T02:29:36ZEric Faulhaber
<ul><li><strong>% Done</strong> changed from <i>0</i> to <i>100</i></li><li><strong>Status</strong> changed from <i>Review</i> to <i>Closed</i></li></ul> User Interface - Feature #3474: OPEN-MIME-RESOURCEhttps://proj.goldencode.com/issues/3474?journal_id=733332019-05-08T17:47:28ZGreg Shah
<ul><li><strong>Related to</strong> <i><a class="issue tracker-2 status-5 priority-4 priority-default closed" href="/issues/4077">Feature #4077</a>: add option to OPEN-MIME-RESOURCE to delete the original source file when the send is complete</i> added</li></ul>