本文整理了Java中org.geoserver.ows.Request.getKvp
方法的一些代码示例,展示了Request.getKvp
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Request.getKvp
方法的具体详情如下:
包路径:org.geoserver.ows.Request
类名称:Request
方法名:getKvp
[英]The parsed key value pair map
[中]已解析的键值对映射
代码示例来源:origin: geoserver/geoserver
/**
* Returns an eventual filter included among the parsed kvp map of the current request. Will
* work for CQL_FILTER, FILTER and FEATURE_ID
*/
public static Filter getRequestFilter() {
Request request = Dispatcher.REQUEST.get();
if (request == null) {
return null;
}
Object filter = request.getKvp().get("FILTER");
if (!(filter instanceof Filter)) {
filter = request.getKvp().get("CQL_FILTER");
if (filter instanceof List) {
List list = (List) filter;
if (list.size() > 0) {
filter = list.get(0);
}
}
}
if (!(filter instanceof Filter)) {
filter = request.getKvp().get("FEATURE_ID");
}
if (filter instanceof Filter) {
return (Filter) filter;
} else {
return null;
}
}
代码示例来源:origin: geoserver/geoserver
public Request init(Request request) {
// see if we have an env map already parsed in the request
Object obj = request.getKvp().get("env");
Map<String, Object> envVars = null;
if (obj instanceof Map) {
envVars = (Map) obj;
}
// inject the current user in it
Authentication auth = SecurityContextHolder.getContext().getAuthentication();
if (auth != null && !(auth instanceof AnonymousAuthenticationToken)) {
String name = auth.getName();
if (envVars == null) {
envVars = new HashMap<String, Object>();
}
envVars.put("GSUSER", name);
}
// set it into the EnvFunction
if (envVars != null) {
EnvFunction.setLocalValues(envVars);
}
return request;
}
代码示例来源:origin: geoserver/geoserver
void parseKVP(Request req) throws ServiceException {
preParseKVP(req);
parseKVP(req, req.getKvp());
}
代码示例来源:origin: geoserver/geoserver
return xmlReader.read(requestBean, input, request.getKvp());
代码示例来源:origin: geoserver/geoserver
Object parseRequestKVP(Class type, Request request) throws Exception {
KvpRequestReader kvpReader = findKvpRequestReader(type);
if (kvpReader != null) {
// check for http request awareness
if (kvpReader instanceof HttpServletRequestAware) {
((HttpServletRequestAware) kvpReader).setHttpRequest(request.getHttpRequest());
}
Object requestBean = kvpReader.createRequest();
if (requestBean != null) {
requestBean = kvpReader.read(requestBean, request.getKvp(), request.getRawKvp());
}
return requestBean;
}
return null;
}
代码示例来源:origin: geoserver/geoserver
if (!exists && req.getKvp().get("request") != null) {
req.setRequest(normalize(KvpUtils.getSingleValue(req.getKvp(), "request")));
exists = operationExists(req, serviceDescriptor);
boolean xmlParsed = false;
if (req.getKvp() != null && req.getKvp().size() > 0) {
代码示例来源:origin: geoserver/geoserver
Service service(Request req) throws Exception {
if (req.getKvp() != null) {
req.setService(normalize(KvpUtils.getSingleValue(req.getKvp(), "service")));
req.setVersion(
normalizeVersion(normalize(KvpUtils.getSingleValue(req.getKvp(), "version"))));
req.setRequest(normalize(KvpUtils.getSingleValue(req.getKvp(), "request")));
req.setOutputFormat(normalize(KvpUtils.getSingleValue(req.getKvp(), "outputFormat")));
代码示例来源:origin: org.geoserver.community/gs-nsg-wfs-profile
@Override
@SuppressWarnings("unchecked")
public Request init(Request request) {
Object resultType = request.getKvp().get(RESULT_TYPE_PARAMETER);
if (resultType != null && resultType.toString().equals(RESULT_TYPE_INDEX)) {
request.getKvp().put(RESULT_TYPE_PARAMETER, ResultTypeType.HITS);
request.getKvp().put(RESULT_TYPE_INDEX_PARAMETER, true);
}
return super.init(request);
}
代码示例来源:origin: org.geoserver/gs-wfs
private String getCallbackFunction() {
Request request = Dispatcher.REQUEST.get();
if (request == null) {
return JSONType.CALLBACK_FUNCTION;
}
return JSONType.getCallbackFunction(request.getKvp());
}
代码示例来源:origin: org.geoserver/gs-wfs
private String getCallbackFunction() {
Request request = Dispatcher.REQUEST.get();
if (request == null) {
return JSONType.CALLBACK_FUNCTION;
}
return JSONType.getCallbackFunction(request.getKvp());
}
代码示例来源:origin: org.geoserver/gs-wfs
private String getIdOption() {
// include fid?
String id_option = null; // null - default, "" - none, or "property"
Request request = Dispatcher.REQUEST.get();
if (request != null) {
id_option = JSONType.getIdPolicy(request.getKvp());
}
return id_option;
}
代码示例来源:origin: org.geoserver/gs-wms
private static String getCallbackFunction() {
Request request = Dispatcher.REQUEST.get();
if (request == null) {
return JSONType.CALLBACK_FUNCTION;
} else {
return JSONType.getCallbackFunction(request.getKvp());
}
}
代码示例来源:origin: org.geoserver.community/gs-nsg-wfs-profile
@Override
public Response responseDispatched(
Request request, Operation operation, Object result, Response response) {
Response newResponse = response;
if (request.getKvp().get(RESULT_TYPE_INDEX_PARAMETER) != null
&& (Boolean) request.getKvp().get(RESULT_TYPE_INDEX_PARAMETER)) {
IndexOutputFormat r = new IndexOutputFormat(this.gs, this.indexConfiguration);
r.setRequest(request);
newResponse = r;
}
return super.responseDispatched(request, operation, result, newResponse);
}
}
代码示例来源:origin: org.geoserver/gs-wfs
private static void writeJsonpException(
ServiceException exception,
Request request,
OutputStream out,
String charset,
boolean verbose)
throws IOException {
OutputStreamWriter outWriter = new OutputStreamWriter(out, charset);
final String callback;
if (request == null) {
callback = JSONType.CALLBACK_FUNCTION;
} else {
callback = JSONType.getCallbackFunction(request.getKvp());
}
outWriter.write(callback + "(");
writeJsonException(exception, request, outWriter, verbose);
outWriter.write(")");
outWriter.flush();
IOUtils.closeQuietly(outWriter);
}
代码示例来源:origin: org.geoserver.community/gs-nsg-wfs-profile
@Override
public Service serviceDispatched(Request request, Service service) throws ServiceException {
Object req = request.getKvp().get("REQUEST");
if ("wfs".equals(service.getId().toLowerCase()) && PAGE_RESULTS.equals(req)) {
// allow the request to be successfully parsed as a GetFeature (needs at least a
// typename or a featureId)
request.getKvp().put("featureId", Collections.singletonList("dummy"));
// replace the service
return new Service(
service.getId(), this.service, service.getVersion(), service.getOperations());
}
return service;
}
代码示例来源:origin: org.geoserver.community/gs-wfs3
/**
* Returns the WFS3 featureId, or null if it's missing or the request is not a WFS3 one
*
* @return
*/
private String getWFS3FeatureId() {
Request dr = Dispatcher.REQUEST.get();
String featureId = null;
if (dr != null && (new Version(dr.getVersion()).getMajor().equals(3))) {
Object featureIdValue = dr.getKvp().get("featureId");
if (featureIdValue instanceof List) {
featureId = (String) ((List) featureIdValue).get(0);
}
}
return featureId;
}
代码示例来源:origin: org.geoserver/gs-wms
@Override
public TemplateModel wrap(Object object) throws TemplateModelException {
if (object instanceof FeatureCollection) {
SimpleHash map = (SimpleHash) super.wrap(object);
map.put("request", Dispatcher.REQUEST.get().getKvp());
map.put("environment", new EnvironmentVariablesTemplateModel());
return map;
}
return super.wrap(object);
}
});
代码示例来源:origin: org.geoserver.extension/gs-wps-core
/**
* Simulates what the Dispatcher is doing when parsing a KVP request
*
* @param href
* @param reader
*/
protected Object kvpParse(String href, KvpRequestReader reader) throws Exception {
Map original = new KvpMap(KvpUtils.parseQueryString(href));
KvpUtils.normalize(original);
Map parsed = new KvpMap(original);
List<Throwable> errors = KvpUtils.parse(parsed);
if (errors.size() > 0) {
throw new WPSException("Failed to parse KVP request", errors.get(0));
}
// hack to allow wcs filters to work... we should really upgrade the WCS models instead...
Request r = Dispatcher.REQUEST.get();
if (r != null) {
Map kvp = new HashMap(r.getKvp());
r.setKvp(new CaseInsensitiveMap(parsed));
}
return reader.read(reader.createRequest(), parsed, original);
}
代码示例来源:origin: org.geoserver.extension/wps-core
/**
* Simulates what the Dispatcher is doing when parsing a KVP request
*
* @param href
* @param reader
* @return
*/
Object kvpParse(String href, KvpRequestReader reader) throws Exception {
Map original = new KvpMap(KvpUtils.parseQueryString(href));
KvpUtils.normalize(original);
Map parsed = new KvpMap(original);
List<Throwable> errors = KvpUtils.parse(parsed);
if (errors.size() > 0) {
throw new WPSException("Failed to parse KVP request", errors.get(0));
}
// hack to allow wcs filters to work... we should really upgrade the WCS models instead...
Request r = Dispatcher.REQUEST.get();
if (r != null) {
Map kvp = new HashMap(r.getKvp());
r.setKvp(new CaseInsensitiveMap(parsed));
}
return reader.read(reader.createRequest(), parsed, original);
}
代码示例来源:origin: org.geoserver/gs-wfs
/** Encodes a ogc:ServiceExceptionReport to output. */
public void handleServiceException(ServiceException exception, Request request) {
boolean verbose = gs.getSettings().isVerboseExceptions();
String charset = gs.getSettings().getCharset();
// first of all check what kind of exception handling we must perform
final String exceptions;
try {
exceptions = (String) request.getKvp().get("EXCEPTIONS");
if (exceptions == null) {
// use default
handleDefault(exception, request, charset, verbose);
return;
}
} catch (Exception e) {
// width and height might be missing
handleDefault(exception, request, charset, verbose);
return;
}
if (JSONType.isJsonMimeType(exceptions)) {
// use Json format
JSONType.handleJsonException(LOGGER, exception, request, charset, verbose, false);
} else if (JSONType.useJsonp(exceptions)) {
// use JsonP format
JSONType.handleJsonException(LOGGER, exception, request, charset, verbose, true);
} else {
handleDefault(exception, request, charset, verbose);
}
}
内容来源于网络,如有侵权,请联系作者删除!