本文整理了Java中org.geoserver.ows.Request.setHttpResponse
方法的一些代码示例,展示了Request.setHttpResponse
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Request.setHttpResponse
方法的具体详情如下:
包路径:org.geoserver.ows.Request
类名称:Request
方法名:setHttpResponse
[英]Allows call backs to override the http response
[中]允许回调覆盖http响应
代码示例来源:origin: geoserver/geoserver
request.setHttpResponse(httpResponse);
代码示例来源:origin: geoserver/geoserver
public void testErrorSavedOnRequestOnGenericException() throws Exception {
MockHttpServletRequest request = new MockHttpServletRequest();
request.setContextPath("/geoserver");
request.setRequestURI("/geoserver/hello");
request.setMethod("get");
Dispatcher dispatcher = new Dispatcher();
Request req = new Request();
req.httpRequest = request;
dispatcher.init(req);
MockHttpServletResponse response = new MockHttpServletResponse();
req.setHttpResponse(response);
RuntimeException genericError = new RuntimeException("foo");
dispatcher.exception(genericError, null, req);
assertEquals("Exception did not get saved", genericError, req.error);
}
代码示例来源:origin: geoserver/geoserver
protected void setUp() throws Exception {
super.setUp();
HelloWorld helloWorld = new HelloWorld();
Service service =
new Service(
"hello",
helloWorld,
new Version("1.0.0"),
Collections.singletonList("hello"));
request =
new MockHttpServletRequest() {
public int getServerPort() {
return 8080;
}
};
request.setScheme("http");
request.setServerName("localhost");
request.setContextPath("geoserver");
response = new MockHttpServletResponse();
handler = new DefaultServiceExceptionHandler();
requestInfo = new Request();
requestInfo.setHttpRequest(request);
requestInfo.setHttpResponse(response);
requestInfo.setService("hello");
requestInfo.setVersion("1.0.0");
}
代码示例来源:origin: geoserver/geoserver
public void testNoErrorOn304ErrorCodeException() throws Exception {
MockHttpServletRequest request = new MockHttpServletRequest();
request.setContextPath("/geoserver");
request.setRequestURI("/geoserver/hello");
request.setMethod("get");
Dispatcher dispatcher = new Dispatcher();
Request req = new Request();
req.httpRequest = request;
dispatcher.init(req);
MockHttpServletResponse response = new MockHttpServletResponse();
req.setHttpResponse(response);
RuntimeException error = new HttpErrorCodeException(304, "Not Modified");
dispatcher.exception(error, null, req);
assertNull("Exception erroneously saved", req.error);
}
代码示例来源:origin: geoserver/geoserver
public void testErrorSavedOnRequestOnNon304ErrorCodeException() throws Exception {
MockHttpServletRequest request = new MockHttpServletRequest();
request.setContextPath("/geoserver");
request.setRequestURI("/geoserver/hello");
request.setMethod("get");
Dispatcher dispatcher = new Dispatcher();
Request req = new Request();
req.httpRequest = request;
dispatcher.init(req);
MockHttpServletResponse response = new MockHttpServletResponse();
req.setHttpResponse(response);
RuntimeException genericError = new HttpErrorCodeException(500, "Internal Server Error");
dispatcher.exception(genericError, null, req);
assertEquals("Exception did not get saved", genericError, req.error);
}
代码示例来源:origin: org.geoserver.community/gs-nsg-wfs-profile
@Override
public Operation operationDispatched(Request request, Operation operation) {
String version = request.getVersion();
String method = request.getRequest();
long timeout = getTimeoutMilliseconds(operation);
if ("WFS".equalsIgnoreCase(request.getService())
&& (version == null || V_20.compareTo(new Version(version)) <= 0)
&& method != null
&& (method.equalsIgnoreCase("GetFeature")
|| method.equalsIgnoreCase("GetFeatureWithLock")
|| method.equalsIgnoreCase("GetPropertyValue"))
&& timeout > 0
&& operation.getParameters().length > 0
&& operation.getParameters()[0] instanceof BaseRequestType) {
if (LOGGER.isLoggable(Level.FINE)) {
LOGGER.fine("Starting to track NSG timeout on this request");
}
// start tracking time
TimeoutVerifier timeoutVerifier =
new TimeoutVerifier((BaseRequestType) operation.getParameters()[0], timeout);
// need to wrap the http response and its output stream
request.setHttpResponse(
new TimeoutCancellingResponse(request.getHttpResponse(), timeoutVerifier));
// set in the thread local for later use
TIMEOUT_VERIFIER.set(timeoutVerifier);
}
return operation;
}
代码示例来源:origin: org.geoserver.extension/control-flow
Request buildRequest(String gsCookieValue) {
Request request = new Request();
MockHttpServletRequest httpRequest = new MockHttpServletRequest();
request.setHttpRequest(httpRequest);
request.setHttpResponse(new MockHttpServletResponse());
if(gsCookieValue != null) {
httpRequest.addCookie(new Cookie(UserFlowController.COOKIE_NAME, gsCookieValue));
}
return request;
}
}
代码示例来源:origin: org.geoserver.extension/control-flow
Request buildRequest(String ipAddress, String proxyIp) {
Request request = new Request();
MockHttpServletRequest httpRequest = new MockHttpServletRequest();
request.setHttpRequest(httpRequest);
request.setHttpResponse(new MockHttpServletResponse());
if (ipAddress != null && !ipAddress.equals("")) {
httpRequest.setRemoteAddr(ipAddress);
} else {
httpRequest.setRemoteAddr("127.0.0.1");
}
if (!proxyIp.equals("")) {
httpRequest.setHeader("x-forwarded-for", proxyIp + ", " + ipAddress);
}
return request;
}
内容来源于网络,如有侵权,请联系作者删除!