org.geoserver.ows.Request.setHttpRequest()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(3.3k)|赞(0)|评价(0)|浏览(236)

本文整理了Java中org.geoserver.ows.Request.setHttpRequest方法的一些代码示例,展示了Request.setHttpRequest的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Request.setHttpRequest方法的具体详情如下:
包路径:org.geoserver.ows.Request
类名称:Request
方法名:setHttpRequest

Request.setHttpRequest介绍

[英]Allows callbacks to override the http request
[中]允许回调重写http请求

代码示例

代码示例来源:origin: geoserver/geoserver

request.setHttpRequest(httpRequest);
request.setHttpResponse(httpResponse);

代码示例来源:origin: geoserver/geoserver

public void testParseKVP() throws Exception {
  URL url = getClass().getResource("applicationContext.xml");
  FileSystemXmlApplicationContext context =
      new FileSystemXmlApplicationContext(url.toString());
  Dispatcher dispatcher = (Dispatcher) context.getBean("dispatcher");
  MockHttpServletRequest request = new MockHttpServletRequest();
  request.setContextPath("/geoserver");
  request.addParameter("service", "hello");
  request.addParameter("request", "Hello");
  request.addParameter("message", "Hello world!");
  request.setQueryString("service=hello&request=hello&message=Hello World!");
  Request req = new Request();
  req.setHttpRequest(request);
  dispatcher.parseKVP(req);
  Message message = (Message) dispatcher.parseRequestKVP(Message.class, req);
  assertEquals(new Message("Hello world!"), message);
}

代码示例来源: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: org.geoserver/gs-gwc

request.setHttpRequest(
      new VirtualServiceRequest(
          request.getHttpRequest(),
          layerName));
} else if (localPublished != null) {
  request.setHttpRequest(
      new VirtualServiceRequest(
          request.getHttpRequest(), localPublished.getName(), null, null));

代码示例来源: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;
}

相关文章