Commit 56a4cd89 authored by Jerome Chauveau's avatar Jerome Chauveau
Browse files

code 404 pour ressource non trouvée - fixes #118

parent a7eb747c
Loading
Loading
Loading
Loading
+0 −15
Original line number Diff line number Diff line
@@ -355,18 +355,3 @@ declare %private function max:invokePluginXQueries($project, $routeDoc, $id){
        catch * {max:max-error("Erreur code " || $err:code, $err:description,$err:module, $err:line-number)}
};
(:declare:)
(:%rest:GET:)
(:%rest:path("/{$projectId}/test/fop"):)
(:%rest:produces("application/pdf"):)
(:function max:testFOP($projectId){:)
(:    let $xml := (doc('fop/exemple.xml')/*)[1]:)
(:    let $pdf := max.util:xml2pdf($xml, max.util:getProjectFoXsl($projectId)):)
(:    return:)
(:        (<rest:response>:)
(:            <http:response status="200">:)
(:                <http:header name="content-type" value="application/pdf"/>:)
(:            </http:response>:)
(:        </rest:response>,:)
(:        $pdf):)
(:};:)
 No newline at end of file
+3 −2
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@ module namespace max.file = 'pddn/max/file';
import module namespace max.util = 'pddn/max/util' at 'util.xqm';
import module namespace max.cons = 'pddn/max/cons' at 'cons.xqm';


(:
Project's UI file: css, js, image ...
:)
@@ -17,7 +18,7 @@ function max.file:projectUIFile(
    return if (file:exists($path))
    then
         max.util:rawFile($path)
    else ()
    else max.util:error404()
};

(:
@@ -31,7 +32,7 @@ function max.file:UIFile(
    return if (file:exists($path))
    then
         max.util:rawFile($path)
    else ()
    else max.util:error404()
};

(:
+13 −0
Original line number Diff line number Diff line
@@ -341,4 +341,17 @@ declare function max.util:getDefaultTextXSL($project as xs:string) as xs:string{
    return max.util:maxHome() || "/ui/xsl/" || $env || "/" || $env || ".xsl"
};

(:
Returns 404 response
:)
declare %output:method("text") %rest:path("") function max.util:error404() {
    <rest:response>
        <http:response status="404">
            <http:header name="Content-Language" value="en"/>
            <http:header name="Content-Type" value="text/plain; charset=utf-8"/>
        </http:response>
    </rest:response>,
    "The requested resource is not available."
};