daisy / pipeline-ui

A user interface for the DAISY Pipeline 2
MIT License
6 stars 2 forks source link

improve configuration for braille-outputting scripts #198

Closed marisademeglio closed 5 months ago

marisademeglio commented 7 months ago

In these cases, the job submission process will be two steps: submit the content and then after the engine analyzes the content, set some options.

See https://github.com/daisy/pipeline/issues/750

Also relevant: https://daisy-dev.slack.com/archives/C064GB8U9/p1708360756773949

NPavie commented 7 months ago

Putting back here the request prototype :

 <_ xmlns="http://www.daisy.org/ns/pipeline/data">
    <media value="embossed AND (width:40) AND (height:25) "/>
    <userStylesheets>
        <file href="user-stylesheet.scss"/>
    </userStylesheets>
    <sourceDocument>
        <file href="source.html"/>
    </sourceDocument>
</_>

(the name of the root element does not matter) calling it like this: curl --location 'http://localhost:8181/ws/stylesheet-parameters' --form 'stylesheet-parameters-request=@"request.xml"' --form 'stylesheet-parameters-data=@"data.zip"' Response

<?xml version="1.0" encoding="UTF-8"?>
<parameters xmlns="http://www.daisy.org/ns/pipeline/data">
<parameter name="foo" nicename="..." description="..."
type="integer" default="0" required="false"
sequence="false" ordered="false"/>
</parameters>

(required, sequence and ordered will always be false)

bertfrees commented 7 months ago

@NPavie I've pushed my latest snapshots to Sonatype. If you update the version of modules-bom to 1.14.24-SNAPSHOT, you should be able to try out the /stylesheet-parameters API.

NPavie commented 7 months ago

Hi @bertfrees ok thanks i'll check it out.

I'm just having some doubt on how to use the api in the context of a job creation regarding step structuration : How are identified the script parameters available on first step in the endpoints of API (like the "media" tag and value of the example) ? Is there other parameters expected or Is it taken from the "stylesheet parameters" option of the script or somewhere else ?

On the api endpoint side, my implementation of the xml request constructor is quite basic :

/**
 * Convert script parameters (filled within a new job) to an "parameters"
 * request xml string that can be sent to pipeline on the
 * "stylesheet-parameters".
 * @param {Job} j the property to update
 * @returns {string} an xml string that can be sent to a DP2 1.14.17+ engine for property
 * update
 */
function jobToStylesheetParametersXml(j: Job): string {
    const stylesheet = j.jobRequest.options.filter(
        (option) => option.name === 'stylesheet'
    )[0]
    return `<parameters xmlns="http://www.daisy.org/ns/pipeline/data">
    ${j.jobRequest.options
        .filter((option) => option.name !== 'stylesheet')
        .map((option) => `<${option.name} value="${option.value}"/>`)
        .join('\n\t')}
    ${
        stylesheet !== undefined &&
        `<userStylesheets><file href="${stylesheet.value}"/></userStylesheets>`
    }
    <sourceDocument>
        ${j.jobRequest.inputs
            .filter((input) => input.isFile && !input.name.endsWith('.scss'))
            .map((input) => `<file href="${input.value}"/>`)
            .join('')}
    </sourceDocument>
</parameters>`
}

(And i send this XML directly to the endpoint as a body, like the other requests)

For now, the way I imagine the updated job creation process is that if i have a "stylesheet" option in the list of available options in the script, job creation process become a two step process with a first form where the input, stylesheet, and some parameters to be tagged as available in first step, and the "Run" button become a "Next" button that trigger the api endpoint. On endpoint data received, a new form with the matching parameters replaces the first form ( possibly with the first form displayed as "read-only" before), button "Next" becomes 2 buttons "Back" and "Run" which respectively goes back to the previous form and run the job request as usual with all the script parameters.

An other doubt I have is what is going on if the user does not have (or want to provide) a stylesheet in the endpoint ?

bertfrees commented 6 months ago

@NPavie Good questions!

The job creation process that you describe sounds very good. For dtbook-to-pef, html-to-pef and epub3-to-pef, the first form should have at least the following options:

Required:

Optional:

This will be used to create the stylesheet-paramaters request document. This is the schema of the request document:

default namespace = "http://www.daisy.org/ns/pipeline/data"
start =
   element * {
      element media {
         attribute value { text }
      }?
      & element userStylesheets {
         file*
      }?
      & element sourceDocument {
         file
      }?
   }
file =
   element file {
      attribute href { xsd:anyURI }
   }

media should be set to embossed AND (width:X) AND (height:Y) (replace X and Y with the corresponding values set by the user, or the default values). For scripts that don't output PEF, it should of course not be embossed, but currently dtbook-to-pef, html-to-pef and epub3-to-pef are the only scripts that have a "stylesheet-parameters" option. zedai-to-pef, epub3-to-epub3, dtbook-to-daisyy, dtbook-to-epub3, zedai-to-epub3 and epub-to-daisy do have a "stylesheet" option, but no "stylesheet-parameters".

sourceDocument should contain the source file.

userStylesheets should contain zero or one file, depending on whether the user selected a style sheet or not.

The second form will have all the options from the response of the /stylesheet-parameters call.

The values of these options will then be used to construct the value of the "stylesheet-parameters" option, which should be hidden from the user.

Most of the other options should probably go in the second form, but some might be better in the first form:

NPavie commented 5 months ago

@NPavie Testing it now. It does not seem to work when an input XML is given (with a style element in its head), but no style sheets. Is that because of a bug in the engine, or is it because of the UI?

Other observations:

  • When I set the style sheets option to "https://raw.githubusercontent.com/daisy/pipeline-modules/master/scripts/html-to-pef/src/main/resources/css/_definition-lists.scss", the next button does not do anything. When I set it to a local file that includes @import url(https://raw.githubusercontent.com/daisy/pipeline-modules/master/scripts/html-to-pef/src/main/resources/css/_definition-lists.scss);, it does work. Not sure whether this is an issue in the engine or UI.
  • The "_definition-lists.scss" style sheet gives me 3 options:

    • Group dt dd
    • Dt suffix
    • Dt separator

    These are auto-generated nice-names. Obviously the descriptions would be better if the Sass variables would have Doxygen comments. What is surprising to me is that the expanded description of these options is "Definition lists" in the three cases. I've spotted a bug in the engine that explains this.

Originally posted by @bertfrees in https://github.com/daisy/pipeline-ui/issues/213#issuecomment-2047135807

NPavie commented 5 months ago

I need to rework the error handling.

For the "https://raw.githubusercontent.com/daisy/pipeline-modules/master/scripts/html-to-pef/src/main/resources/css/_definition-lists.scss" issue in stylesheet parameter, engine is actually reporting this

"Error: Could not parse XML for parameters (see parsedText field):<?xml version="1.0" encoding="UTF-8"?><error xmlns="http://www.daisy.org/ns/pipeline/data" query="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1"><description>Input not found: expected an absolute file or a relative path, but got: https://raw.githubusercontent.com/daisy/pipeline-modules/master/scripts/html-to-pef/src/main/resources/css/_definition-lists.scss</description><trace>java.lang.Throwable: Input not found: expected an absolute file or a relative path, but got: https://raw.githubusercontent.com/daisy/pipeline-modules/master/scripts/html-to-pef/src/main/resources/css/_definition-lists.scss&#xD;
    at org.daisy.pipeline.webservice.restlet.GenericResource.getErrorRepresentation(GenericResource.java:81)&#xD;
    at org.daisy.pipeline.css.impl.StylesheetParametersResource.badRequest(StylesheetParametersResource.java:291)&#xD;
    at org.daisy.pipeline.css.impl.StylesheetParametersResource.getResource(StylesheetParametersResource.java:153)&#xD;
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)&#xD;
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)&#xD;
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)&#xD;
    at java.base/java.lang.reflect.Method.invoke(Method.java:568)&#xD;
    at org.restlet.resource.ServerResource.doHandle(ServerResource.java:503)&#xD;
    at org.restlet.resource.ServerResource.post(ServerResource.java:1215)&#xD;
    at org.restlet.resource.ServerResource.doHandle(ServerResource.java:592)&#xD;
    at org.restlet.resource.ServerResource.doNegotiatedHandle(ServerResource.java:649)&#xD;
    at org.restlet.resource.ServerResource.doConditionalHandle(ServerResource.java:348)&#xD;
    at org.restlet.resource.ServerResource.handle(ServerResource.java:951)&#xD;
    at org.restlet.resource.Finder.handle(Finder.java:246)&#xD;
    at org.restlet.routing.Filter.doHandle(Filter.java:159)&#xD;
    at org.restlet.routing.Filter.handle(Filter.java:206)&#xD;
    at org.restlet.routing.Router.doHandle(Router.java:431)&#xD;
    at org.restlet.routing.Router.handle(Router.java:648)&#xD;
    at org.restlet.routing.Filter.doHandle(Filter.java:159)&#xD;
    at org.restlet.routing.Filter.handle(Filter.java:206)&#xD;
    at org.restlet.routing.Filter.doHandle(Filter.java:159)&#xD;
    at org.restlet.routing.Filter.handle(Filter.java:206)&#xD;
    at org.restlet.routing.Filter.doHandle(Filter.java:159)&#xD;
    at org.restlet.engine.application.StatusFilter.doHandle(StatusFilter.java:155)&#xD;
    at org.restlet.routing.Filter.handle(Filter.java:206)&#xD;
    at org.restlet.routing.Filter.doHandle(Filter.java:159)&#xD;
    at org.restlet.routing.Filter.handle(Filter.java:206)&#xD;
    at org.restlet.engine.CompositeHelper.handle(CompositeHelper.java:211)&#xD;
    at org.restlet.engine.application.ApplicationHelper.handle(ApplicationHelper.java:84)&#xD;
    at org.restlet.Application.handle(Application.java:381)&#xD;
    at org.restlet.routing.Filter.doHandle(Filter.java:159)&#xD;
    at org.restlet.routing.Filter.handle(Filter.java:206)&#xD;
    at org.restlet.routing.Router.doHandle(Router.java:431)&#xD;
    at org.restlet.routing.Router.handle(Router.java:648)&#xD;
    at org.restlet.routing.Filter.doHandle(Filter.java:159)&#xD;
    at org.restlet.routing.Filter.handle(Filter.java:206)&#xD;
    at org.restlet.routing.Router.doHandle(Router.java:431)&#xD;
    at org.restlet.routing.Router.handle(Router.java:648)&#xD;
    at org.restlet.routing.Filter.doHandle(Filter.java:159)&#xD;
    at org.restlet.engine.application.StatusFilter.doHandle(StatusFilter.java:155)&#xD;
    at org.restlet.routing.Filter.handle(Filter.java:206)&#xD;
    at org.restlet.routing.Filter.doHandle(Filter.java:159)&#xD;
    at org.restlet.routing.Filter.handle(Filter.java:206)&#xD;
    at org.restlet.engine.CompositeHelper.handle(CompositeHelper.java:211)&#xD;
    at org.restlet.Component.handle(Component.java:392)&#xD;
    at org.restlet.Server.handle(Server.java:516)&#xD;
    at org.restlet.engine.ServerHelper.handle(ServerHelper.java:72)&#xD;
    at org.restlet.engine.adapter.HttpServerHelper.handle(HttpServerHelper.java:152)&#xD;
    at org.restlet.ext.jetty.JettyServerHelper$WrappedServer.handle(JettyServerHelper.java:170)&#xD;
    at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:452)&#xD;
    at org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:894)&#xD;
    at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:948)&#xD;
    at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:851)&#xD;
    at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)&#xD;
    at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:77)&#xD;
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:622)&#xD;
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:46)&#xD;
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:603)&#xD;
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:538)&#xD;
    at java.base/java.lang.Thread.run(Thread.java:833)&#xD;
</trace></error>"
bertfrees commented 5 months ago

OK thanks, I'll check what's wrong.

bertfrees commented 5 months ago

Issue solved.

NPavie commented 5 months ago

@bertfrees i have updated the form to retrieve and display errors reported by the stylesheet-parameters endpoint : In case of errors, the error description is displayed on top level of the script form and also under the stylesheet input field.

I wanted to enable the webview validation tooltip on retrieving the error but the call to the endpoint and update of the underlying job triggers a partial rerender so the validation tooltip message cannot be displayed at first. But if the user try to click next again without changing the field value in error, it will trigger the validation message with the tooltip displayed.

NPavie commented 5 months ago

When you first said

It does not seem to work when an input XML is given (with a style element in its head), but no style sheets

Do you mean it does not trigger the second page, or it was not displaying or updating some additionnal it was supposed to display ?

bertfrees commented 5 months ago

In case of errors, the error description is displayed on top level of the script form and also under the stylesheet input field.

Nice.

Do you mean it does not trigger the second page, or it was not displaying or updating some additionnal it was supposed to display ?

It goes to the second page, but it does not show the options that are defined within the style element of the source document.

NPavie commented 5 months ago

Oups my bad : i deactivated the request endpoint on empty stylesheet setting.

I pushed a fix to both re-enable the request for source only, and fixed a bug in building the request with multiple css file provided.

NPavie commented 5 months ago

I did the following tests:

bertfrees commented 5 months ago

@NPavie Thanks for testing!

invalid remote URI for stylesheet: no error is returned, engine responded with <parameters xmlns="http://www.daisy.org/ns/pipeline/data"/> (not sure what is the expected behaviour here, but I would assume similar behavior as file uri tests, @bertfrees what do you think ?)

The difference in behavior is explained by the fact that the resolving of remote URIs vs. file URIs is implemented differently.

File URIs are processed like job inputs, hence the error. Remote URIs are processed like @import rules in a CSS style sheet, hence the graceful behavior. But it is indeed not very consistent. Not sure what to do. What do you think?

no stylesheet as parameter and input without styles: the html file provided in pipeline-samples won't pass as input (the endpoint returns the file is not valid, it seems to expect xhtml and not html)

Oops, that is a bug. I will fix it, but in the next version.

In fact I think I will also support HTML input in BoundScript.Builder, which would also make it possible to pass HTML as script inputs.

marisademeglio commented 5 months ago

I'm getting an error with EPUB3 to braille, even when I don't include a stylesheet at all. The console output says:

fetching  http://127.0.0.1:49152/ws/stylesheet-parameters {"method":"POST","body":"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<parameters xmlns=\"http://www.daisy.org/ns/pipeline/data\">\n    <media value=\"embossed AND (width:40) AND (height:25)\"/>\n    <userStylesheets></userStylesheets>\n    <sourceDocument><file href=\"null\"/><file href=\"file:///Users/marisa/dev/pipeline-samples/epub3/accessible_epub_3.epub\"/></sourceDocument>\n</parameters>"}
[1] 13:32:33.146 › Result was {
[1]   type: 'JobRequestError',
[1]   description: 'The request is not valid',
[1]   trace: 'java.lang.Throwable: The request is not valid\n' +
[1]     '\tat org.daisy.pipeline.webservice.restlet.GenericResource.getErrorRepresentation(GenericResource.java:81)\n' +
[1]     '\tat org.daisy.pipeline.css.impl.StylesheetParametersResource.getResource(StylesheetParametersResource.java:137)\n' +
[1]     '\tat java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\n' +
[1]     '\tat java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)\n' +
[1]     '\tat java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\n' +
[1]     '\tat java.base/java.lang.reflect.Method.invoke(Method.java:568)\n' +
[1]     '\tat org.restlet.resource.ServerResource.doHandle(ServerResource.java:503)\n' +
[1]     '\tat org.restlet.resource.ServerResource.post(ServerResource.java:1215)\n' +
[1]     '\tat org.restlet.resource.ServerResource.doHandle(ServerResource.java:592)\n' +
[1]     '\tat org.restlet.resource.ServerResource.doNegotiatedHandle(ServerResource.java:649)\n' +
[1]     '\tat org.restlet.resource.ServerResource.doConditionalHandle(ServerResource.java:348)\n' +
[1]     '\tat org.restlet.resource.ServerResource.handle(ServerResource.java:951)\n' +
[1]     '\tat org.restlet.resource.Finder.handle(Finder.java:246)\n' +
[1]     '\tat org.restlet.routing.Filter.doHandle(Filter.java:159)\n' +
[1]     '\tat org.restlet.routing.Filter.handle(Filter.java:206)\n' +
[1]     '\tat org.restlet.routing.Router.doHandle(Router.java:431)\n' +
[1]     '\tat org.restlet.routing.Router.handle(Router.java:648)\n' +
[1]     '\tat org.restlet.routing.Filter.doHandle(Filter.java:159)\n' +
[1]     '\tat org.restlet.routing.Filter.handle(Filter.java:206)\n' +
[1]     '\tat org.restlet.routing.Filter.doHandle(Filter.java:159)\n' +
[1]     '\tat org.restlet.routing.Filter.handle(Filter.java:206)\n' +
[1]     '\tat org.restlet.routing.Filter.doHandle(Filter.java:159)\n' +
[1]     '\tat org.restlet.engine.application.StatusFilter.doHandle(StatusFilter.java:155)\n' +
[1]     '\tat org.restlet.routing.Filter.handle(Filter.java:206)\n' +
[1]     '\tat org.restlet.routing.Filter.doHandle(Filter.java:159)\n' +
[1]     '\tat org.restlet.routing.Filter.handle(Filter.java:206)\n' +
[1]     '\tat org.restlet.engine.CompositeHelper.handle(CompositeHelper.java:211)\n' +
[1]     '\tat org.restlet.engine.application.ApplicationHelper.handle(ApplicationHelper.java:84)\n' +
[1]     '\tat org.restlet.Application.handle(Application.java:381)\n' +
[1]     '\tat org.restlet.routing.Filter.doHandle(Filter.java:159)\n' +
[1]     '\tat org.restlet.routing.Filter.handle(Filter.java:206)\n' +
[1]     '\tat org.restlet.routing.Router.doHandle(Router.java:431)\n' +
[1]     '\tat org.restlet.routing.Router.handle(Router.java:648)\n' +
[1]     '\tat org.restlet.routing.Filter.doHandle(Filter.java:159)\n' +
[1]     '\tat org.restlet.routing.Filter.handle(Filter.java:206)\n' +
[1]     '\tat org.restlet.routing.Router.doHandle(Router.java:431)\n' +
[1]     '\tat org.restlet.routing.Router.handle(Router.java:648)\n' +
[1]     '\tat org.restlet.routing.Filter.doHandle(Filter.java:159)\n' +
[1]     '\tat org.restlet.engine.application.StatusFilter.doHandle(StatusFilter.java:155)\n' +
[1]     '\tat org.restlet.routing.Filter.handle(Filter.java:206)\n' +
[1]     '\tat org.restlet.routing.Filter.doHandle(Filter.java:159)\n' +
[1]     '\tat org.restlet.routing.Filter.handle(Filter.java:206)\n' +
[1]     '\tat org.restlet.engine.CompositeHelper.handle(CompositeHelper.java:211)\n' +
[1]     '\tat org.restlet.Component.handle(Component.java:392)\n' +
[1]     '\tat org.restlet.Server.handle(Server.java:516)\n' +
[1]     '\tat org.restlet.engine.ServerHelper.handle(ServerHelper.java:72)\n' +
[1]     '\tat org.restlet.engine.adapter.HttpServerHelper.handle(HttpServerHelper.java:152)\n' +
[1]     '\tat org.restlet.ext.jetty.JettyServerHelper$WrappedServer.handle(JettyServerHelper.java:170)\n' +
[1]     '\tat org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:452)\n' +
[1]     '\tat org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:894)\n' +
[1]     '\tat org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:948)\n' +
[1]     '\tat org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:851)\n' +
[1]     '\tat org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)\n' +
[1]     '\tat org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:77)\n' +
[1]     '\tat org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:622)\n' +
[1]     '\tat org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:46)\n' +
[1]     '\tat org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:603)\n' +
[1]     '\tat org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:538)\n' +
[1]     '\tat java.base/java.lang.Thread.run(Thread.java:833)'
[1] }
Screenshot 2024-04-17 at 13 32 37
marisademeglio commented 5 months ago

And DTBook to braille doesn't go to the next step when I click "Next". The input was a DTBook file with no stylesheet options. There are no errors on the console but the engine stops responding entirely and I can't access any endpoints, not even /alive.

 13:35:06.836 › fetching  http://127.0.0.1:49152/ws/stylesheet-parameters {"method":"POST","body":"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<parameters xmlns=\"http://www.daisy.org/ns/pipeline/data\">\n    <media value=\"embossed AND (width:40) AND (height:25)\"/>\n    <userStylesheets></userStylesheets>\n    <sourceDocument><file href=\"file:///Users/marisa/dev/pipeline-samples/dtbook/hauy_valid.xml\"/></sourceDocument>\n</parameters>"}
bertfrees commented 5 months ago

I'm getting an error with EPUB3 to braille

Ouch. Of course, how come I didn't think of that? The /stylesheet-parameters endpoint was written with an XML input in mind. So it should not be called with EPUB input. Can that still be changed in the UI? For EPUB 3 to braille, the request should only be made when <userStylesheets> is not empty, and <sourceDocument> should be left out. (By the way, where does the <file href=\"null\"/> come from?)

NPavie commented 5 months ago

Hi Marisa, I'm off for two days, but looking at the request, I probably have forgot a null check on input in the job to XML function. (I did it for the userStylesheet if I recall)

For the engine stopping, I see you are using the hauy XML file from the sample repo : I assume it is the dtbook file with sentences tagged in it. I think Bert mentioned at some point that dtbook with tagged sentences were not handled correctly by the engine.

Le mer. 17 avr. 2024, 22:36, Marisa DeMeglio @.***> a écrit :

I'm getting an error with EPUB3 to braille, even when I don't include a stylesheet at all. The console output says:

fetching http://127.0.0.1:49152/ws/stylesheet-parameters {"method":"POST","body":"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<parameters xmlns=\"http://www.daisy.org/ns/pipeline/data\">\n <media value=\"embossed AND (width:40) AND (height:25)\"/>\n \n <file href=\"null\"/><file href=\"file:///Users/marisa/dev/pipeline-samples/epub3/accessible_epub_3.epub\"/>\n"} [1] 13:32:33.146 › Result was { [1] type: 'JobRequestError', [1] description: 'The request is not valid', [1] trace: 'java.lang.Throwable: The request is not valid\n' + [1] '\tat org.daisy.pipeline.webservice.restlet.GenericResource.getErrorRepresentation(GenericResource.java:81)\n' + [1] '\tat org.daisy.pipeline.css.impl.StylesheetParametersResource.getResource(StylesheetParametersResource.java:137)\n' + [1] '\tat java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\n' + [1] '\tat java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)\n' + [1] '\tat java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\n' + [1] '\tat java.base/java.lang.reflect.Method.invoke(Method.java:568)\n' + [1] '\tat org.restlet.resource.ServerResource.doHandle(ServerResource.java:503)\n' + [1] '\tat org.restlet.resource.ServerResource.post(ServerResource.java:1215)\n' + [1] '\tat org.restlet.resource.ServerResource.doHandle(ServerResource.java:592)\n' + [1] '\tat org.restlet.resource.ServerResource.doNegotiatedHandle(ServerResource.java:649)\n' + [1] '\tat org.restlet.resource.ServerResource.doConditionalHandle(ServerResource.java:348)\n' + [1] '\tat org.restlet.resource.ServerResource.handle(ServerResource.java:951)\n' + [1] '\tat org.restlet.resource.Finder.handle(Finder.java:246)\n' + [1] '\tat org.restlet.routing.Filter.doHandle(Filter.java:159)\n' + [1] '\tat org.restlet.routing.Filter.handle(Filter.java:206)\n' + [1] '\tat org.restlet.routing.Router.doHandle(Router.java:431)\n' + [1] '\tat org.restlet.routing.Router.handle(Router.java:648)\n' + [1] '\tat org.restlet.routing.Filter.doHandle(Filter.java:159)\n' + [1] '\tat org.restlet.routing.Filter.handle(Filter.java:206)\n' + [1] '\tat org.restlet.routing.Filter.doHandle(Filter.java:159)\n' + [1] '\tat org.restlet.routing.Filter.handle(Filter.java:206)\n' + [1] '\tat org.restlet.routing.Filter.doHandle(Filter.java:159)\n' + [1] '\tat org.restlet.engine.application.StatusFilter.doHandle(StatusFilter.java:155)\n' + [1] '\tat org.restlet.routing.Filter.handle(Filter.java:206)\n' + [1] '\tat org.restlet.routing.Filter.doHandle(Filter.java:159)\n' + [1] '\tat org.restlet.routing.Filter.handle(Filter.java:206)\n' + [1] '\tat org.restlet.engine.CompositeHelper.handle(CompositeHelper.java:211)\n' + [1] '\tat org.restlet.engine.application.ApplicationHelper.handle(ApplicationHelper.java:84)\n' + [1] '\tat org.restlet.Application.handle(Application.java:381)\n' + [1] '\tat org.restlet.routing.Filter.doHandle(Filter.java:159)\n' + [1] '\tat org.restlet.routing.Filter.handle(Filter.java:206)\n' + [1] '\tat org.restlet.routing.Router.doHandle(Router.java:431)\n' + [1] '\tat org.restlet.routing.Router.handle(Router.java:648)\n' + [1] '\tat org.restlet.routing.Filter.doHandle(Filter.java:159)\n' + [1] '\tat org.restlet.routing.Filter.handle(Filter.java:206)\n' + [1] '\tat org.restlet.routing.Router.doHandle(Router.java:431)\n' + [1] '\tat org.restlet.routing.Router.handle(Router.java:648)\n' + [1] '\tat org.restlet.routing.Filter.doHandle(Filter.java:159)\n' + [1] '\tat org.restlet.engine.application.StatusFilter.doHandle(StatusFilter.java:155)\n' + [1] '\tat org.restlet.routing.Filter.handle(Filter.java:206)\n' + [1] '\tat org.restlet.routing.Filter.doHandle(Filter.java:159)\n' + [1] '\tat org.restlet.routing.Filter.handle(Filter.java:206)\n' + [1] '\tat org.restlet.engine.CompositeHelper.handle(CompositeHelper.java:211)\n' + [1] '\tat org.restlet.Component.handle(Component.java:392)\n' + [1] '\tat org.restlet.Server.handle(Server.java:516)\n' + [1] '\tat org.restlet.engine.ServerHelper.handle(ServerHelper.java:72)\n' + [1] '\tat org.restlet.engine.adapter.HttpServerHelper.handle(HttpServerHelper.java:152)\n' + [1] '\tat org.restlet.ext.jetty.JettyServerHelper$WrappedServer.handle(JettyServerHelper.java:170)\n' + [1] '\tat org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:452)\n' + [1] '\tat org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:894)\n' + [1] '\tat org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:948)\n' + [1] '\tat org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:851)\n' + [1] '\tat org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)\n' + [1] '\tat org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:77)\n' + [1] '\tat org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:622)\n' + [1] '\tat org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:46)\n' + [1] '\tat org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:603)\n' + [1] '\tat org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:538)\n' + [1] '\tat java.base/java.lang.Thread.run(Thread.java:833)' [1] }

Screenshot.2024-04-17.at.13.32.37.png (view on web) https://github.com/daisy/pipeline-ui/assets/734730/b35e3a87-1ba0-4c4e-af6c-01652d575a87

— Reply to this email directly, view it on GitHub https://github.com/daisy/pipeline-ui/issues/198#issuecomment-2062215092, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABL5VTGXEE6KQTWYBFHCKJDY53MLHAVCNFSM6AAAAABDPYYLASVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANRSGIYTKMBZGI . You are receiving this because you were mentioned.Message ID: @.***>

bertfrees commented 5 months ago

I think Bert mentioned at some point that dtbook with tagged sentences were not handled correctly by the engine.

No, that file shouldn't be a problem. I could run it without issues.

marisademeglio commented 5 months ago

Hi Marisa, I'm off for two days, but looking at the request, I probably have forgot a null check on input in the job to XML function. (I did it for the userStylesheet if I recall)

Yep there was a null check missing there.

Now I can run DTBook to braille. And EPUB3 to braille fails in a different way, related to what @bertfrees said about it requiring XML input.

org.xml.sax.SAXParseException; systemId: file:///Users/marisa/dev/pipeline-samples/epub3/accessible_epub_3.epub; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog.

Should we exclude sourceDocument entirely from the stylesheet parameters step? And would this workaround apply only to EPUB3 to braille?

bertfrees commented 5 months ago

Should we exclude sourceDocument entirely from the stylesheet parameters step? And would this workaround apply only to EPUB3 to braille?

Yes and yes.

marisademeglio commented 5 months ago

Ok it's working better now regarding the problems I found yesterday. Can someone have a look and see if anything else is required for this issue?

bertfrees commented 5 months ago

I tested the latest version. Looks good.

bertfrees commented 5 months ago

Ugh 😞 There is something I only noticed now 😳 . It's not good. The job request includes the parameters as separate <option>s instead of a single stylesheet-parameters option. The result is that the parameters are basically ignored.

I didn't notice before because apparently the web service doesn't complaint when you pass an unknown option. (I should change that.)

Now I noticed because I tried a CSS file that includes some variables with the same name as existing options, and I got an engine error about an unsupported value.