org.geoserver.wms.WMS.getGeoServer()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(8.1k)|赞(0)|评价(0)|浏览(224)

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

WMS.getGeoServer介绍

暂无

代码示例

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

public GetMapKvpRequestReader(WMS wms) {
  super(GetMapRequest.class);
  this.wms = wms;
  this.entityResolverProvider = new EntityResolverProvider(wms.getGeoServer());
}

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

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

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

private JAIInfo getJaiInfo() {
  GeoServer geoServer = getGeoServer();
  GeoServerInfo global = geoServer.getGlobal();
  return global.getJAI();
}

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

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

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

public String getProxyBaseUrl() {
  GeoServer geoServer = getGeoServer();
  return geoServer.getSettings().getProxyBaseUrl();
}

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

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

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

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

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

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

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

private void writeJSONP(OutputStream out, DescribeLayerModel layers) throws IOException {
  // prepare to write out
  OutputStreamWriter osw = null;
  Writer outWriter = null;
  try {
    osw = new OutputStreamWriter(out, wms.getGeoServer().getSettings().getCharset());
    outWriter = new BufferedWriter(osw);
    outWriter.write(getCallbackFunction() + "(");
    writeJSON(outWriter, layers);
    outWriter.write(")");
    outWriter.flush();
  } finally {
    IOUtils.closeQuietly(outWriter);
    IOUtils.closeQuietly(osw);
  }
}

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

public long getUpdateSequence() {
  GeoServerInfo global = getGeoServer().getGlobal();
  return global.getUpdateSequence();
}

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

public int getNumDecimals() {
  return getGeoServer().getSettings().getNumDecimals();
}

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

/** Actually write the passed DescribeLayerModel on the OutputStream */
public void write(DescribeLayerModel layers, DescribeLayerRequest request, OutputStream output)
    throws ServiceException, IOException {
  switch (type) {
    case JSON:
      OutputStreamWriter osw = null;
      Writer outWriter = null;
      try {
        osw =
            new OutputStreamWriter(
                output, wms.getGeoServer().getSettings().getCharset());
        outWriter = new BufferedWriter(osw);
        writeJSON(outWriter, layers);
      } finally {
        IOUtils.closeQuietly(outWriter);
        IOUtils.closeQuietly(osw);
      }
    case JSONP:
      writeJSONP(output, layers);
  }
}

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

/**
 * Writes a Json (or Jsonp) response on the passed output stream
 *
 * @see {@link GetFeatureInfoOutputFormat#write(FeatureCollectionType, GetFeatureInfoRequest,
 *     OutputStream)}
 */
@Override
public void write(
    FeatureCollectionType features, GetFeatureInfoRequest fInfoReq, OutputStream out)
    throws IOException {
  GeoJSONGetFeatureResponse format =
      new GeoJSONGetFeatureResponse(wms.getGeoServer(), getContentType());
  format.write(features, out, null);
}

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

public void setSvgRenderer(String svgRendererHint) {
  WMSInfo serviceInfo = getServiceInfo();
  serviceInfo.getMetadata().put("svgRenderer", svgRendererHint);
  getGeoServer().save(serviceInfo);
}

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

/**
   * Takes the <code>FeatureResult</code>s generated by the <code>execute</code> method in the
   * superclass and constructs a <code>DescribeLayerResult</code> which is passed to a <code>
   * GML2FeatureResponseDelegate</code>.
   *
   * @see AbstractFeatureInfoResponse#writeTo(OutputStream)
   */
  @Override
  public void write(DescribeLayerModel results, DescribeLayerRequest request, OutputStream out)
      throws ServiceException, IOException {
    DescribeLayerTransformer transformer;
    transformer = new DescribeLayerTransformer(request.getBaseUrl());
    Charset encoding = wms.getCharSet();
    transformer.setEncoding(encoding);
    if (wms.getGeoServer().getSettings().isVerbose()) {
      transformer.setIndentation(2);
    }

    try {
      transformer.transform(request, out);
      out.flush();
    } catch (TransformerException e) {
      throw new ServiceException(e);
    }
  }
}

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

public void testSldDisabled() throws Exception {
  HashMap kvp = new HashMap();
  URL url = GetMapKvpRequestReader.class.getResource("BasicPolygonsLibraryDefault.sld");
  String decoded = URLDecoder.decode(url.toExternalForm(), "UTF-8");
  kvp.put("sld", decoded);
  kvp.put(
      "layers",
      MockData.BASIC_POLYGONS.getPrefix() + ":" + MockData.BASIC_POLYGONS.getLocalPart());
  WMS wms = new WMS(getGeoServer());
  WMSInfo oldInfo = wms.getGeoServer().getService(WMSInfo.class);
  WMSInfo info = new WMSInfoImpl();
  info.setDynamicStylingDisabled(Boolean.TRUE);
  getGeoServer().remove(oldInfo);
  getGeoServer().add(info);
  reader = new GetMapKvpRequestReader(wms);
  GetMapRequest request = (GetMapRequest) reader.createRequest();
  boolean error = false;
  try {
    request = (GetMapRequest) reader.read(request, parseKvp(kvp), kvp);
  } catch (ServiceException e) {
    error = true;
  }
  getGeoServer().remove(info);
  getGeoServer().add(oldInfo);
  assertTrue(error);
}

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

protected String getFeatureTypeURL(KmlEncodingContext context) throws IOException {
    GeoServer gs = context.getWms().getGeoServer();
    Catalog catalog = gs.getCatalog();
    Layer layer = context.getCurrentLayer();
    FeatureSource featureSource = layer.getFeatureSource();
    Name typeName = featureSource.getSchema().getName();
    String nsUri = typeName.getNamespaceURI();
    NamespaceInfo ns = catalog.getNamespaceByURI(nsUri);
    String featureTypeName = typeName.getLocalPart();
    GetMapRequest request = context.getRequest();
    String baseURL = request.getBaseUrl();
    String prefix = ns.getPrefix();
    return buildURL(baseURL, appendPath("rest", prefix, featureTypeName), null,
        URLType.SERVICE);
  }
}

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

public void testSldBodyDisabled() throws Exception {
  HashMap kvp = new HashMap();
  kvp.put("sld_body", STATES_SLD);
  kvp.put(
      "layers",
      MockData.BASIC_POLYGONS.getPrefix() + ":" + MockData.BASIC_POLYGONS.getLocalPart());
  WMS wms = new WMS(getGeoServer());
  WMSInfo oldInfo = wms.getGeoServer().getService(WMSInfo.class);
  WMSInfo info = new WMSInfoImpl();
  info.setDynamicStylingDisabled(Boolean.TRUE);
  getGeoServer().remove(oldInfo);
  getGeoServer().add(info);
  reader = new GetMapKvpRequestReader(wms);
  GetMapRequest request = (GetMapRequest) reader.createRequest();
  boolean error = false;
  try {
    request = (GetMapRequest) reader.read(request, parseKvp(kvp), kvp);
  } catch (ServiceException e) {
    error = true;
  }
  getGeoServer().remove(info);
  getGeoServer().add(oldInfo);
  assertTrue(error);
}

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

public void testSldBodyDisabled() throws Exception {
    HashMap kvp = new HashMap();
    kvp.put("sld_body", STATES_SLD);
    kvp.put(
        "layers",
        MockData.BASIC_POLYGONS.getPrefix() + ":" + MockData.BASIC_POLYGONS.getLocalPart());

    WMS wms = new WMS(getGeoServer());
    WMSInfo oldInfo = wms.getGeoServer().getService(WMSInfo.class);
    WMSInfo info = new WMSInfoImpl();
    info.setDynamicStylingDisabled(Boolean.TRUE);
    getGeoServer().remove(oldInfo);
    getGeoServer().add(info);
    reader = new GetFeatureInfoKvpReader(wms);
    GetFeatureInfoRequest request = (GetFeatureInfoRequest) reader.createRequest();
    boolean error = false;
    try {
      request = (GetFeatureInfoRequest) reader.read(request, parseKvp(kvp), kvp);
    } catch (ServiceException e) {
      error = true;
    }
    getGeoServer().remove(info);
    getGeoServer().add(oldInfo);
    assertTrue(error);
  }
}

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

public void testAllowDynamicStyles() throws Exception {
  GetMapRequest request = (GetMapRequest) reader.createRequest();
  BufferedReader input = getResourceInputStream("WMSPostLayerGroupNonDefaultStyle.xml");
  WMS wms = new WMS(getGeoServer());
  WMSInfo oldInfo = wms.getGeoServer().getService(WMSInfo.class);
  WMSInfo info = new WMSInfoImpl();
  info.setDynamicStylingDisabled(Boolean.TRUE);
  getGeoServer().remove(oldInfo);
  getGeoServer().add(info);
  GetMapXmlReader reader = new GetMapXmlReader(wms);
  boolean error = false;
  try {
    request = (GetMapRequest) reader.read(request, input, new HashMap());
  } catch (ServiceException e) {
    error = true;
  }
  getGeoServer().remove(info);
  getGeoServer().add(oldInfo);
  assertTrue(error);
}

相关文章