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

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

本文整理了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

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

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

  1. public void testParseKVP() throws Exception {
  2. URL url = getClass().getResource("applicationContext.xml");
  3. FileSystemXmlApplicationContext context =
  4. new FileSystemXmlApplicationContext(url.toString());
  5. Dispatcher dispatcher = (Dispatcher) context.getBean("dispatcher");
  6. MockHttpServletRequest request = new MockHttpServletRequest();
  7. request.setContextPath("/geoserver");
  8. request.addParameter("service", "hello");
  9. request.addParameter("request", "Hello");
  10. request.addParameter("message", "Hello world!");
  11. request.setQueryString("service=hello&request=hello&message=Hello World!");
  12. Request req = new Request();
  13. req.setHttpRequest(request);
  14. dispatcher.parseKVP(req);
  15. Message message = (Message) dispatcher.parseRequestKVP(Message.class, req);
  16. assertEquals(new Message("Hello world!"), message);
  17. }

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

  1. protected void setUp() throws Exception {
  2. super.setUp();
  3. HelloWorld helloWorld = new HelloWorld();
  4. Service service =
  5. new Service(
  6. "hello",
  7. helloWorld,
  8. new Version("1.0.0"),
  9. Collections.singletonList("hello"));
  10. request =
  11. new MockHttpServletRequest() {
  12. public int getServerPort() {
  13. return 8080;
  14. }
  15. };
  16. request.setScheme("http");
  17. request.setServerName("localhost");
  18. request.setContextPath("geoserver");
  19. response = new MockHttpServletResponse();
  20. handler = new DefaultServiceExceptionHandler();
  21. requestInfo = new Request();
  22. requestInfo.setHttpRequest(request);
  23. requestInfo.setHttpResponse(response);
  24. requestInfo.setService("hello");
  25. requestInfo.setVersion("1.0.0");
  26. }

代码示例来源:origin: org.geoserver/gs-gwc

  1. request.setHttpRequest(
  2. new VirtualServiceRequest(
  3. request.getHttpRequest(),
  4. layerName));
  5. } else if (localPublished != null) {
  6. request.setHttpRequest(
  7. new VirtualServiceRequest(
  8. request.getHttpRequest(), localPublished.getName(), null, null));

代码示例来源:origin: org.geoserver.extension/control-flow

  1. Request buildRequest(String gsCookieValue) {
  2. Request request = new Request();
  3. MockHttpServletRequest httpRequest = new MockHttpServletRequest();
  4. request.setHttpRequest(httpRequest);
  5. request.setHttpResponse(new MockHttpServletResponse());
  6. if(gsCookieValue != null) {
  7. httpRequest.addCookie(new Cookie(UserFlowController.COOKIE_NAME, gsCookieValue));
  8. }
  9. return request;
  10. }
  11. }

代码示例来源:origin: org.geoserver.extension/control-flow

  1. Request buildRequest(String ipAddress, String proxyIp) {
  2. Request request = new Request();
  3. MockHttpServletRequest httpRequest = new MockHttpServletRequest();
  4. request.setHttpRequest(httpRequest);
  5. request.setHttpResponse(new MockHttpServletResponse());
  6. if (ipAddress != null && !ipAddress.equals("")) {
  7. httpRequest.setRemoteAddr(ipAddress);
  8. } else {
  9. httpRequest.setRemoteAddr("127.0.0.1");
  10. }
  11. if (!proxyIp.equals("")) {
  12. httpRequest.setHeader("x-forwarded-for", proxyIp + ", " + ipAddress);
  13. }
  14. return request;
  15. }

相关文章