Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,18 @@ public class ContentOutputFormat<VALUEOUT> extends
+ "return if (exists($f)) then $f() else ()";
// For HTTP Server
public static final String HEADER_QUERY =
"fn:exists(xdmp:get-request-header('x-forwarded-for'))";
"let $f := fn:function-lookup(xs:QName('xdmp:is-forwarded'),0)\n" +
"return if (exists($f)) then $f() " +
"else fn:exists(xdmp:get-request-header('x-forwarded-for'))";
// For XDBC Server
public static final String XDBC_HEADER_QUERY =
"let $f := fn:function-lookup(xs:QName('xdmp:is-forwarded'),0)\n" +
"return if (exists($f)) then $f() " +
"else (" +
Comment on lines +131 to +138
"let $xdbcHeaderf := " +
"fn:function-lookup(xs:QName('xdmp:get-xdbc-request-header'),1)\n" +
"return if (exists($xdbcHeaderf)) " +
"then fn:exists($xdbcHeaderf('x-forwarded-for')) else false()";
"then fn:exists($xdbcHeaderf('x-forwarded-for')) else false())";

protected AssignmentManager am = AssignmentManager.getInstance();
protected boolean fastLoad;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,8 @@ public List<InputSplit> getSplits(JobContext jobContext) throws IOException,
StringBuilder buf = new StringBuilder();
buf.append("xquery version \"1.0-ml\";\n");
if (getForwardHeader) {
buf.append("fn:exists(xdmp:get-request-header('x-forwarded-for'));\n");
buf.append(ContentOutputFormat.HEADER_QUERY).append(";\n");
buf.append(ContentOutputFormat.XDBC_HEADER_QUERY).append(";\n");
}
buf.append("import module namespace hadoop = ");
buf.append("\"http://marklogic.com/xdmp/hadoop\" at ");
Expand Down Expand Up @@ -402,6 +403,8 @@ public List<InputSplit> getSplits(JobContext jobContext) throws IOException,
if (getForwardHeader) {
forwardHeaderExists = item.asString().equals("true");
item = result.next();
forwardHeaderExists |= item.asString().equals("true");
item = result.next();
Comment on lines 403 to +407
if (forwardHeaderExists) {
restrictHosts = true;
jobConf.setBoolean(INPUT_RESTRICT_HOSTS, true);
Expand Down
Loading