MCPcopy Create free account
hub / github.com/BaseXdb/basex / restxq

Method restxq

basex-api/src/main/java/org/basex/http/web/WebModules.java:112–133  ·  view source on GitHub ↗

Returns a RESTXQ function that matches the current request or the specified error code best. @param conn HTTP connection @param error error code (assigned if error function is to be called) @return function, or null if no function matches @throws QueryException query exception @throws IOExce

(final HTTPConnection conn, final QNm error)

Source from the content-addressed store, hash-verified

110 * @throws IOException I/O exception
111 */
112 public RestXqFunction restxq(final HTTPConnection conn, final QNm error)
113 throws QueryException, IOException {
114
115 // collect all function candidates
116 final List<RestXqFunction> funcs = find(conn, error, false);
117 if(funcs.isEmpty()) return null;
118
119 // multiple functions: check specifity
120 if(funcs.size() > 1) bestSpec(funcs);
121 // multiple functions: check quality factors
122 if(funcs.size() > 1) bestQf(funcs, conn);
123 // multiple functions: check consume filter
124 if(funcs.size() > 1) bestConsume(funcs, conn);
125
126 final RestXqFunction first = funcs.get(0);
127 if(funcs.size() == 1) return first;
128
129 // show error if we are left with multiple function candidates
130 throw first.path == null ?
131 first.error(ERROR_CONFLICT_X_X, error, toString(funcs)) :
132 first.error(PATH_CONFLICT_X_X, first.path, toString(funcs));
133 }
134
135 /**
136 * Returns RESTXQ and permissions functions that match the current request.

Callers 1

runMethod · 0.95

Calls 9

findMethod · 0.95
bestSpecMethod · 0.95
bestQfMethod · 0.95
bestConsumeMethod · 0.95
errorMethod · 0.95
toStringMethod · 0.95
sizeMethod · 0.65
getMethod · 0.65
isEmptyMethod · 0.45

Tested by

no test coverage detected