Skip to content
This repository has been archived by the owner on Nov 9, 2022. It is now read-only.

#640: Support SJS with a language property #673

Merged
merged 2 commits into from
Oct 20, 2016

Conversation

prestonmcgowan
Copy link

Add sjs to your request
definition to make use of a SJS controller.
More comments added to Issue #640.

Add <uri-param name="language">sjs</uri-param> to your request
definition to make use of a SJS controller.
Issue marklogic-community#640.
@dmcassel
Copy link
Collaborator

This requires adding the parameter on every call -- feels error prone. I like including this, but also controlling the default (xquery vs sjs). To do that, we would:

  1. add a "controller-ext" property to default.properties, with a default value of "xqy"
  2. add declare variable $c:CTRL-EXT := ("@ml.controller-ext", $def:CTRL-EXT)[1]; to src/app/config/config.xqy
  3. add declare variable $CTRL-EXT := "xqy"; to src/roxy/config/defaults.xqy
  4. in src/roxy/router.xqy: `declare variable $language as xs:string := req:get("language", $config:CTRL-EXT, "type=xs:string");

I'd have to test to make sure that's right, but I think that will do it. Then you could add

controller-ext=sjs

to your build.properties and default to SJS controllers, but still override if needed. Want me to send that change to your PR, or would you like to make that update?

Updated previous changes based on dcassel's suggestions.
Tested using the sample SJS requests and test.sjs in marklogic-community#640.
@prestonmcgowan
Copy link
Author

Changes made and committed.
Updated sample code on #640.
Please review.

@dmcassel
Copy link
Collaborator

Looks great. Thanks for the PR!

@dmcassel dmcassel merged commit 6889b69 into marklogic-community:dev Oct 20, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants