本文整理了Java中org.geoserver.ows.Request.getHttpRequest
方法的一些代码示例,展示了Request.getHttpRequest
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Request.getHttpRequest
方法的具体详情如下:
包路径:org.geoserver.ows.Request
类名称:Request
方法名:getHttpRequest
[英]Returns the raw http request being handled by the Dispatcher
[中]返回由调度器处理的原始http请求
代码示例来源:origin: geoserver/geoserver
void preParseKVP(Request req) throws ServiceException {
HttpServletRequest request = req.getHttpRequest();
// unparsed kvp set
Map kvp = request.getParameterMap();
if (kvp == null || kvp.isEmpty()) {
req.setKvp(new HashMap());
// req.kvp = null;
return;
}
// track parsed kvp and unparsd
Map parsedKvp = KvpUtils.normalize(kvp);
Map rawKvp = new KvpMap(parsedKvp);
req.setKvp(parsedKvp);
req.setRawKvp(rawKvp);
}
代码示例来源:origin: geoserver/geoserver
HttpServletRequest owsRequest = Dispatcher.REQUEST.get().getHttpRequest();
Arrays.asList(Headers.values())
.forEach(
代码示例来源:origin: geoserver/geoserver
Request init(Request request) throws ServiceException, IOException {
HttpServletRequest httpRequest = request.getHttpRequest();
代码示例来源:origin: geoserver/geoserver
((HttpServletRequestAware) xmlReader).setHttpRequest(request.getHttpRequest());
代码示例来源: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
baseURL(request.getHttpRequest()), "ows/1.0.0/owsExceptionReport.xsd");
encoder.setSchemaLocation(org.geoserver.ows.xml.v1_0.OWS.NAMESPACE, schemaLocation);
代码示例来源:origin: geoserver/geoserver
buildSchemaURL(baseURL(request.getHttpRequest()), "ows/1.1.0/owsAll.xsd");
encoder.setSchemaLocation(OWS.NAMESPACE, schemaLocation);
代码示例来源:origin: geoserver/geoserver
String msg =
"Could not determine geoserver request from http request "
+ req.getHttpRequest();
throw new ServiceException(msg, "MissingParameterValue", "request");
parameters[i] = req.getHttpRequest();
} else if (parameterType.isAssignableFrom(HttpServletResponse.class)) {
parameters[i] = req.getHttpResponse();
parameters[i] = req.getHttpRequest().getInputStream();
} else if (parameterType.isAssignableFrom(OutputStream.class)) {
parameters[i] = req.getHttpResponse().getOutputStream();
if (setBaseUrl != null) {
setBaseUrl.invoke(
requestBean, new String[] {RequestUtils.baseURL(req.getHttpRequest())});
代码示例来源:origin: geoserver/geoserver
expect(request.getHttpRequest())
.andReturn(
new HttpServletRequestWrapper(new MockHttpServletRequest()) {
代码示例来源:origin: geoserver/geoserver
if (req.getInput() != null && "POST".equalsIgnoreCase(req.getHttpRequest().getMethod())) {
Map xml = readOpPost(req.getInput());
if (xml.get("service") != null) {
代码示例来源:origin: org.geoserver.community/gs-params-extractor
private void forwardOriginalUri(Request request, StringBuilder path) {
String requestUri = request.getHttpRequest().getRequestURI();
if (request.getHttpRequest() instanceof RequestWrapper) {
requestUri = ((RequestWrapper) request.getHttpRequest()).getOriginalRequestURI();
}
Matcher matcher = URI_PATTERN.matcher(requestUri);
if (!matcher.matches()) {
return;
}
path.delete(0, path.length());
path.append(matcher.group(2));
}
代码示例来源:origin: org.geoserver.extension/control-flow
@Override
boolean matchesRequest(Request request) {
final String incomingIp = IpFlowController.getRemoteAddr(request.getHttpRequest());
boolean matches = ip.equals(incomingIp);
return matches;
}
代码示例来源:origin: org.geoserver.extension/wps-core
/**
* Given a file inside the root storage directory returns a URL to retrieve it via the file
* publisher
*
* @param file
* @return
* @throws MalformedURLException
*/
public URL getURL(File file) throws MalformedURLException {
// initialize default value for testing
String baseURL = "http://geoserver/fakeroot";
if (Dispatcher.REQUEST.get() != null) {
baseURL = ResponseUtils.baseURL(Dispatcher.REQUEST.get().getHttpRequest());
}
String path = "temp/wps/" + storage.toURI().relativize(file.toURI()).getPath();
return new URL(ResponseUtils.buildURL(baseURL, path, null, URLType.RESOURCE));
}
代码示例来源:origin: org.geoserver/gs-wfs
/**
* Checks if the typeName default namespace is present in the original request, or it has been
* overridden by parser. If it's been overridden we can qualify with the given namespace.
*
* @param request
* @param ns
* @param typeName
*/
private QName checkOriginallyUnqualified(Request request, NamespaceInfo ns, QName typeName) {
Map<String, String[]> originalParams = request.getHttpRequest().getParameterMap();
for (String paramName : originalParams.keySet()) {
if (paramName.equalsIgnoreCase("TYPENAME")) {
for (String originalTypeName : originalParams.get(paramName)) {
if (originalTypeName.equals(typeName.getLocalPart())) {
// the original typeName was not
// qualified, we can qualify it
typeName = new QName(ns.getURI(), typeName.getLocalPart());
}
}
}
}
return typeName;
}
代码示例来源:origin: org.geoserver.csw/gs-csw-core
private void encodeGetEcho(Request request) {
// grab the full request url
HttpServletRequest httpRequest = request.getHttpRequest();
String fullRequest = httpRequest.getRequestURL().toString();
String queryString = httpRequest.getQueryString();
// odd check, used because the mock http request used for testing
// actually includes the query string in the request url
if (queryString != null && !fullRequest.contains("?")) {
fullRequest += "?" + queryString;
}
// build the ows:Get element
AttributesImpl attributes = new AttributesImpl();
addAttribute(attributes, "xlink:type", "simple");
addAttribute(attributes, "xlink:href", fullRequest);
element("ows:Get", null, attributes);
}
代码示例来源:origin: org.geoserver.community/gs-oseo-core
private String buildSelfUrl() {
String baseURL = baseURL(request.getHttpRequest());
return buildURL(baseURL, "oseo/description", null, URLType.SERVICE);
}
}
代码示例来源:origin: org.geoserver.csw/csw-core
private void encodeGetEcho(Request request) {
// grab the full request url
HttpServletRequest httpRequest = request.getHttpRequest();
String fullRequest = httpRequest.getRequestURL().toString();
String queryString = httpRequest.getQueryString();
// odd check, used because the mock http request used for testing
// actually includes the query string in the request url
if (queryString != null && !fullRequest.contains("?")) {
fullRequest += "?" + queryString;
}
// build the ows:Get element
AttributesImpl attributes = new AttributesImpl();
addAttribute(attributes, "xlink:type", "simple");
addAttribute(attributes, "xlink:href", fullRequest);
element("ows:Get", null, attributes);
}
代码示例来源:origin: org.geoserver.community/gs-geofence
private String retrieveCallerIpAddress() {
// is this an OWS request
Request owsRequest = Dispatcher.REQUEST.get();
if (owsRequest != null) {
HttpServletRequest httpReq = owsRequest.getHttpRequest();
String sourceAddress = getSourceAddress(httpReq);
if (sourceAddress == null) {
LOGGER.log(Level.WARNING, "Could not retrieve source address from OWSRequest");
}
return sourceAddress;
}
// try Spring
try {
HttpServletRequest request =
((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes())
.getRequest();
String sourceAddress = getSourceAddress(request);
if (sourceAddress == null) {
LOGGER.log(Level.WARNING, "Could not retrieve source address with Spring Request");
}
return sourceAddress;
} catch (IllegalStateException ex) {
LOGGER.log(
Level.WARNING,
"Error retrieving source address with Spring Request: " + ex.getMessage());
return null;
}
}
代码示例来源:origin: org.geoserver/gs-gwc
/**
* Gets the base URL of the server, this value is retrieved from the current HTTP request. If no
* HTTP request is in progress NULL is returned. Only the use cases where an OWS service or a
* REST end-point was target are handled.
*/
private static String baseUrl() {
// let's see if a OWS service was targeted
Request owsRequest = Dispatcher.REQUEST.get();
if (owsRequest != null) {
// retrieve the base URL from the dispatcher request
return RequestUtils.baseURL(Dispatcher.REQUEST.get().getHttpRequest());
}
// let's see if a REST end-point was targeted
RequestInfo restRequest = RequestInfo.get();
if (restRequest != null) {
// retrieve the base URL from REST request
return restRequest.getBaseURL();
}
// no HTTP request is in progress
return null;
}
}
代码示例来源:origin: org.geoserver.community/gs-params-extractor
@Override
public void mangleURL(
StringBuilder baseURL, StringBuilder path, Map<String, String> kvp, URLType type) {
Request request = Dispatcher.REQUEST.get();
if (request == null || !"GetCapabilities".equalsIgnoreCase(request.getRequest())) {
return;
}
forwardOriginalUri(request, path);
Map requestRawKvp = request.getRawKvp();
if (request.getHttpRequest() instanceof RequestWrapper) {
RequestWrapper requestWrapper = (RequestWrapper) request.getHttpRequest();
Map parameters = requestWrapper.getOriginalParameters();
requestRawKvp = new KvpMap(KvpUtils.normalize(parameters));
}
forwardParameters(requestRawKvp, kvp);
}
内容来源于网络,如有侵权,请联系作者删除!