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

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

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

Request.<init>介绍

[英]Copy constructor
[中]复制构造函数

代码示例

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

public void testParseXML() throws Exception {
  URL url = getClass().getResource("applicationContext.xml");
  FileSystemXmlApplicationContext context =
      new FileSystemXmlApplicationContext(url.toString());
  Dispatcher dispatcher = (Dispatcher) context.getBean("dispatcher");
  String body = "<Hello service=\"hello\" message=\"Hello world!\"/>";
  File file = File.createTempFile("geoserver", "req");
  try {
    FileOutputStream output = new FileOutputStream(file);
    output.write(body.getBytes());
    output.flush();
    output.close();
    BufferedReader input =
        new BufferedReader(new InputStreamReader(new FileInputStream(file)));
    input.mark(8192);
    Request req = new Request();
    req.setInput(input);
    Object object = dispatcher.parseRequestXML(null, input, req);
    assertEquals(new Message("Hello world!"), object);
  } finally {
    file.delete();
  }
}

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

@Before
public void initCallback() {
  this.callback = new LocalWorkspaceCallback(getGeoServer());
  this.request = new Request();
}

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

@Test
  public void testRequest()
      throws InterruptedException, ExecutionException, SecurityException,
          NoSuchFieldException {
    // setup the state
    final Request request = new Request();
    Dispatcher.REQUEST.set(request);
    // test it's transferred properly using the base class machinery
    testThreadLocalTransfer(
        new ThreadLocalTransferCallable(
            new PublicThreadLocalTransfer(Dispatcher.class, "REQUEST")) {

          @Override
          void assertThreadLocalCleaned() {
            assertNull(Dispatcher.REQUEST.get());
          }

          @Override
          void assertThreadLocalApplied() {
            assertSame(request, Dispatcher.REQUEST.get());
          }
        });
  }
}

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

@Test
public void testThreadLocalTransfer() throws InterruptedException, ExecutionException {
  final Request request = new Request();
  Dispatcher.REQUEST.set(request);
  final LayerInfo layer = new LayerInfoImpl();

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

Operation opDescriptor = new Operation("concat", service, method, parameters);
Object result = dispatcher.execute(new Request(), opDescriptor);
assertEquals("p1p2", result);
assertTrue(invokeDirectCalled.get());

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

Request request = new Request();

代码示例来源: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 testReadOpContext() 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);
  Map map = dispatcher.readOpContext(req);
  assertEquals("hello", map.get("service"));
  request = new MockHttpServletRequest();
  request.setContextPath("/geoserver");
  request.setRequestURI("/geoserver/foobar/hello");
  request.setMethod("get");
  map = dispatcher.readOpContext(req);
  assertEquals("hello", map.get("service"));
  request = new MockHttpServletRequest();
  request.setContextPath("/geoserver");
  request.setRequestURI("/geoserver/foobar/hello/");
  request.setMethod("get");
  map = dispatcher.readOpContext(req);
  assertEquals("hello", map.get("service"));
}

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

Request request = new Request();
request.setService("WMS");
request.setRequest("GetCapabilities");

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

Request request = new Request();
request.setService("WMS");
request.setRequest("GetCapabilities");

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

public void testReadContextAndPath() throws Exception {
  Dispatcher dispatcher = new Dispatcher();
  MockHttpServletRequest request = new MockHttpServletRequest();
  request.setContextPath("/geoserver");
  request.setRequestURI("/geoserver/hello");
  request.setMethod("get");
  Request req = new Request();
  req.httpRequest = request;
  dispatcher.init(req);
  assertNull(req.context);
  assertEquals("hello", req.path);
  request.setRequestURI("/geoserver/foo/hello");
  dispatcher.init(req);
  assertEquals("foo", req.context);
  assertEquals("hello", req.path);
  request.setRequestURI("/geoserver/foo/baz/hello/");
  dispatcher.init(req);
  assertEquals("foo/baz", req.context);
  assertEquals("hello", req.path);
}

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

Request request = new Request();
request.setService("WMS");
request.setRequest("GetCapabilities");

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

protected void setupRequestThreadLocal(String service) {
  Request request = new Request();
  request.setService(service);
  Dispatcher.REQUEST.set(request);
}

代码示例来源: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/gs-monitor-core

@Test
public void testWFSLockFeature() throws Exception {
  LockFeatureType lf = WfsFactory.eINSTANCE.createLockFeatureType();
  LockType l = WfsFactory.eINSTANCE.createLockType();
  l.setTypeName(new QName("http://acme.org", "foo", "acme"));
  lf.getLock().add(l);
  Operation op = op("LockFeature", "WFS", "1.0.0", lf);
  callback.operationDispatched(new Request(), op);
  assertEquals("acme:foo", data.getResources().get(0));
}

代码示例来源:origin: org.geoserver.extension/gs-monitor-core

@Test
public void testBasic() throws Exception {
  callback.operationDispatched(new Request(), op("foo", "bar", "1.2.3", null));
  assertEquals("BAR", data.getService());
  assertEquals("foo", data.getOperation());
  assertEquals("1.2.3", data.getOwsVersion());
}

相关文章