Skip to content

Commit

Permalink
Updates from PR review
Browse files Browse the repository at this point in the history
Updated previous changes based on dcassel's suggestions.
Tested using the sample SJS requests and test.sjs in marklogic-community#640.
  • Loading branch information
Preston McGowan committed Oct 20, 2016
1 parent cc69316 commit 0a8f568
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 1 deletion.
7 changes: 7 additions & 0 deletions deploy/default.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@
#
xquery.dir=${basedir}/src

#
# What type of language is the default for the controllers?
# sjs - Serverside JavaScript
# xqy - XQuery (default)
#
controller-ext=xqy

#
# MarkLogic application servers exist inside a group. ML Instances start off
# with a group called "Default".
Expand Down
12 changes: 12 additions & 0 deletions src/app/config/config.xqy
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,18 @@ declare variable $c:ROXY-ROUTES :=
}
</routes>;

(:
: ***********************************************
: What is the default language of the controllers defined in the <request>
: sjs - Serverside JavaScript
: xqy - XQuery (default)
:
: Override this setting in the build.properties with the "controller-ext" key value pair.
:
: ***********************************************
:)
declare variable $c:CTRL-EXT := ("@ml.controller-ext", $def:CTRL-EXT)[1];

(:
: ***********************************************
: A decent place to put your appservices search config
Expand Down
5 changes: 5 additions & 0 deletions src/roxy/config/defaults.xqy
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ declare variable $ROXY-ROUTES :=
<request uri="^.+$"/>
</routes>;

(:
: Default controller language
:)
declare variable $CTRL-EXT := "xqy";

(:
: ***********************************************
: A decent place to put your appservices search config
Expand Down
2 changes: 1 addition & 1 deletion src/roxy/router.xqy
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import module namespace u = "http://marklogic.com/roxy/util" at "/roxy/lib/util.
declare option xdmp:mapping "false";

declare variable $controller as xs:QName := req:get("controller", "type=xs:QName");
declare variable $language as xs:string := req:get("language", "xqy", "type=xs:string");
declare variable $language as xs:string := req:get("language", $config:CTRL-EXT, "type=xs:string");
declare variable $controller-path as xs:string := fn:concat("/app/controllers/", $controller, ".", $language);
declare variable $controller-ns as xs:string :=
if ($language eq "xqy") then
Expand Down

0 comments on commit 0a8f568

Please sign in to comment.