org.geoserver.config.GeoServer.getSettings()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(8.3k)|赞(0)|评价(0)|浏览(190)

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

GeoServer.getSettings介绍

[英]Returns the global settings configuration.

This method will return GeoServerInfo#getSettings() unless a local workspace is set. In that case the settings for that workspace will be checked via #getSettings(WorkspaceInfo), and if one exists will be returned. If local workspace settings do not exist the global settings ( GeoServerInfo#getSettings()) are returned.
[中]返回全局设置配置。
除非设置了本地工作区,否则此方法将返回GeoServerInfo#getSettings()。在这种情况下,将通过#getSettings(WorkspaceInfo)检查该工作区的设置,如果存在,将返回设置。如果本地工作区设置不存在,则返回全局设置(GeoServerInfo#getSettings())。

代码示例

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

/**
   * Returns the mime type that should be exposed to the client when sending the exception
   * message.
   *
   * <p>Defaults to <code>geoserver.getMimeType()</code>
   */
  public String getMimeType(GeoServer geoserver) {
    return "text/xml; charset=" + geoserver.getSettings().getCharset();
  }
}

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

private boolean useNameDequalifyingProxy() {
  WorkspaceInfo workspaceInfo = LocalWorkspace.get();
  if (workspaceInfo == null) {
    return false;
  }
  return geoServer == null || !geoServer.getSettings().isLocalWorkspaceIncludesPrefix();
}

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

String url = geoserver.getSettings().getProxyBaseUrl();

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

String url = ((geoserver != null) ? geoserver.getSettings().getProxyBaseUrl() : null);

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

void createAppContext(String proxyBaseUrl) {
  SettingsInfo settings = createNiceMock(SettingsInfo.class);
  expect(settings.getProxyBaseUrl()).andReturn(proxyBaseUrl).anyTimes();
  replay(settings);
  GeoServer geoServer = createNiceMock(GeoServer.class);
  expect(geoServer.getGlobal()).andReturn(new GeoServerInfoImpl());
  expect(geoServer.getSettings()).andReturn(settings).anyTimes();
  replay(geoServer);
  ProxifyingURLMangler mangler = new ProxifyingURLMangler(geoServer);
  ApplicationContext appContext = createNiceMock(ApplicationContext.class);
  expect(appContext.getBeanNamesForType(URLMangler.class))
      .andReturn(new String[] {"mangler"});
  expect(appContext.getBean("mangler")).andReturn(mangler).anyTimes();
  replay(appContext);
  GeoServerExtensionsHelper.init(appContext);
}

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

public void mangleURL(
    StringBuilder baseURL, StringBuilder path, Map<String, String> kvp, URLType type) {
  // first check the system property, then fall back to configuration
  String proxyBase =
      (GeoServerExtensions.getProperty(Requests.PROXY_PARAM) != null)
          ? GeoServerExtensions.getProperty(Requests.PROXY_PARAM)
          : this.geoServer.getSettings().getProxyBaseUrl();
  // Mangles the URL base in different ways based on a flag
  // (for two reasons: a) speed; b) to make the admin aware of
  // possible security liabilities)
  baseURL =
      (this.geoServer.getGlobal().isUseHeadersProxyURL() == true && proxyBase != null)
          ? this.mangleURLHeaders(baseURL, proxyBase)
          : this.mangleURLFixedURL(baseURL, proxyBase);
}

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

private void assertPrefixInclusion(
    boolean includePrefix, boolean setLocalWorkspace, boolean createGeoServer) {
  if (createGeoServer) {
    SettingsInfo settings = createNiceMock(SettingsInfo.class);
    expect(settings.isLocalWorkspaceIncludesPrefix()).andReturn(includePrefix).anyTimes();
    replay(settings);
    GeoServer geoServer = createNiceMock(GeoServer.class);
    expect(geoServer.getSettings()).andReturn(settings).anyTimes();
    replay(geoServer);
    catalog.setGeoServer(geoServer);
  }
  if (setLocalWorkspace) {
    WorkspaceInfo workspaceByName = catalog.getWorkspaceByName("ws1");
    LocalWorkspace.set(workspaceByName);
  }
  checkLayerNamePrefixInclusion(includePrefix, catalog.getLayers().iterator());
  checkLayerNamePrefixInclusion(includePrefix, catalog.list(LayerInfo.class, Filter.INCLUDE));
}

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

replay(settings);
expect(geoServer.getSettings()).andReturn(settings).anyTimes();
replay(geoServer);

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

@Test
public void testModifySettings() throws Exception {
  testAddSettings();
  WorkspaceInfo ws = catalog.getWorkspaceByName("acme");
  SettingsInfo settings = getGeoServer().getSettings(ws);
  settings.setTitle("FOO");
  getGeoServer().save(settings);
  File f = catalog.getResourceLoader().find("workspaces", ws.getName(), "settings.xml");
  assertNotNull(f);
  Document dom = dom(f);
  assertXpathEvaluatesTo("FOO", "/settings/title", dom);
}

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

@Test
public void testRemoveSettings() throws Exception {
  testAddSettings();
  WorkspaceInfo ws = catalog.getWorkspaceByName("acme");
  File f = catalog.getResourceLoader().find("workspaces", ws.getName(), "settings.xml");
  assertNotNull(f);
  SettingsInfo settings = getGeoServer().getSettings(ws);
  getGeoServer().remove(settings);
  f = catalog.getResourceLoader().find("workspaces", ws.getName(), "settings.xml");
  assertNull(f);
}

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

@Test
public void testModifySettingsChangeWorkspace() throws Exception {
  testAddSettings();
  WorkspaceInfo ws1 = catalog.getWorkspaceByName("acme");
  WorkspaceInfo ws2 = catalog.getFactory().createWorkspace();
  ws2.setName("foo");
  catalog.add(ws2);
  SettingsInfo settings = getGeoServer().getSettings(ws1);
  settings.setWorkspace(ws2);
  getGeoServer().save(settings);
  File f = catalog.getResourceLoader().find("workspaces", ws1.getName(), "settings.xml");
  assertNull(f);
  f = catalog.getResourceLoader().find("workspaces", ws2.getName(), "settings.xml");
  assertNotNull(f);
  Document dom = dom(f);
  assertXpathEvaluatesTo(ws2.getId(), "/settings/workspace/id", dom);
}

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

SettingsInfo settings = ws != null ? geoServer.getSettings(ws) : global.getSettings();
if (settings == null) {
  settings = geoServer.getFactory().createSettings();

代码示例来源:origin: org.geoserver/restconfig

private boolean allowExisting() {
  String workspace = getAttribute("workspace");
  WorkspaceInfo ws = geoServer.getCatalog().getWorkspaceByName(workspace);
  if (ws != null) {
    return geoServer.getSettings(ws) != null;
  }
  return geoServer.getSettings(ws) == null;
}

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

@Override
  protected SettingsInfo load() {
    GeoServer gs = GeoServerApplication.get().getGeoServer();
    return gs.getSettings(wsModel.getObject());
  }
}

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

public Charset getCharSet() {
  GeoServer geoServer2 = getGeoServer();
  String charset = geoServer2.getSettings().getCharset();
  return Charset.forName(charset);
}

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

@DeleteMapping
public void localSetingsDelete(@PathVariable String workspaceName) {
  if (workspaceName != null) {
    WorkspaceInfo workspaceInfo = geoServer.getCatalog().getWorkspaceByName(workspaceName);
    SettingsInfo settingsInfo = geoServer.getSettings(workspaceInfo);
    geoServer.remove(settingsInfo);
  }
}

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

@Override
  public String getCharset() {
    return wms.getGeoServer().getSettings().getCharset();
  }
}

代码示例来源:origin: org.geoserver/restconfig

@Override
public void handleObjectDelete() throws Exception {
  String workspace = getAttribute("workspace");
  if (workspace != null) {
    WorkspaceInfo workspaceInfo = geoServer.getCatalog().getWorkspaceByName(workspace);
    SettingsInfo settingsInfo = geoServer.getSettings(workspaceInfo);
    geoServer.remove(settingsInfo);
  }
}

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

void write1_1(LockFeatureResponseType lockResponse, OutputStream output, Operation operation)
      throws IOException {
    Encoder encoder = new Encoder(configuration, configuration.schema());
    encoder.setEncoding(Charset.forName(getInfo().getGeoServer().getSettings().getCharset()));

    LockFeatureType req = (LockFeatureType) operation.getParameters()[0];

    encoder.setSchemaLocation(
        org.geoserver.wfs.xml.v1_1_0.WFS.NAMESPACE,
        buildSchemaURL(req.getBaseUrl(), "schemas/wfs/1.1.0/wfs.xsd"));

    encoder.encode(lockResponse, org.geoserver.wfs.xml.v1_1_0.WFS.LOCKFEATURERESPONSE, output);
    output.flush();
  }
}

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

protected void doWrite(
    FeatureTypeInfo[] featureTypeInfos, OutputStream output, Operation describeFeatureType)
    throws IOException {
  // create the schema
  Object request = describeFeatureType.getParameters()[0];
  DescribeFeatureTypeRequest req = DescribeFeatureTypeRequest.adapt(request);
  XSDSchema schema = schemaBuilder.build(featureTypeInfos, req.getBaseURL());
  // serialize
  schema.updateElement();
  final String encoding = gs.getSettings().getCharset();
  XSDResourceImpl.serialize(output, schema.getElement(), encoding);
}

相关文章