org.n52.janmayen.Json.print()方法的使用及代码示例

x33g5p2x  于2022-01-22 转载在 其他  
字(6.9k)|赞(0)|评价(0)|浏览(134)

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

Json.print介绍

暂无

代码示例

代码示例来源:origin: org.n52.iceland/iceland

@Override
public void write(JsonNode t, OutputStream out, ResponseProxy responseProxy)
    throws IOException {
  Json.print(out, t);
}

代码示例来源:origin: org.n52.janmayen/janmayen

public static String print(JsonNode node) {
  try (StringWriter writer = new StringWriter()) {
    print(writer, node);
    writer.flush();
    return writer.toString();
  } catch (IOException ex) {
    // can not happen
    throw new Error(ex);
  }
}

代码示例来源:origin: org.n52.sensorweb.sos/admin-controller

private static String asJSONArray(
      Collection<String> coll) {
    return Json.print(Json.toJSON(new TreeSet<String>(coll)));
  }
}

代码示例来源:origin: org.n52.wps/service

@ResponseBody
@RequestMapping(
    method = RequestMethod.GET,
    produces = MediaType.APPLICATION_JSON_VALUE)
public String info() {
  return Json.print(Json.nodeFactory().objectNode().put(ENDPOINT, this.serviceURL).put(BRANCH, this.branch).put(
      COMMIT, this.commit).put(TIME, this.time).put(VERSION, this.version));
}

代码示例来源:origin: 52North/SOS

private static String asJSONArray(
      Collection<String> coll) {
    return Json.print(Json.toJSON(new TreeSet<String>(coll)));
  }
}

代码示例来源:origin: 52North/SOS

public static String mapToJson(@SuppressWarnings("rawtypes") Map map) {
  ObjectNode node = Json.nodeFactory().objectNode();
  for (Object key : map.keySet()) {
    node.put(key.toString(), String.valueOf(map.get(key)));
  }
  return Json.print(node);
}

代码示例来源:origin: org.n52.sensorweb.sos/admin-controller

@ResponseBody
@RequestMapping(value = ControllerConstants.Paths.ADMIN_CACHE_SUMMARY, method = RequestMethod.GET, produces = "application/json; charset=UTF-8")
public String getCacheSummary() {
  return Json.print(Json.toJSON(CacheSummaryHandler.getCacheValues()));
}

代码示例来源:origin: org.n52.sensorweb.sos/admin-controller

@ResponseBody
@RequestMapping(value = ControllerConstants.Paths.ADMIN_EXTENSIONS_JSON_ENDPOINT, method = RequestMethod.GET, produces = ControllerConstants.MEDIA_TYPE_APPLICATION_JSON)
public String getAll() throws JSONException, ConnectionProviderException {
  ObjectNode node = Json.nodeFactory().objectNode();
  node.set(JSONConstants.EXTENDED_CAPABILITIES_EXTENSION_KEY, getExtendedCapabilitiesExtensions());
  node.set(JSONConstants.OFFERING_EXTENSION_EXTENSION_KEY, getOfferingExtensionExtensions());
  return Json.print(node);
}

代码示例来源:origin: org.n52.sensorweb.sos/admin-controller

@ResponseBody
@RequestMapping(value = ControllerConstants.Paths.ADMIN_ENCODINGS_JSON_ENDPOINT, method = RequestMethod.GET, produces = ControllerConstants.MEDIA_TYPE_APPLICATION_JSON)
public String getAll() {
  ObjectNode node = Json.nodeFactory().objectNode();
  node.set(JSONConstants.OBSERVATION_ENCODINGS_KEY, getObservationEncodings());
  node.set(JSONConstants.PROCEDURE_ENCODINGS_KEY, getProcedureEncodings());
  return Json.print(node);
}

代码示例来源:origin: 52North/SOS

@ResponseBody
@RequestMapping(value = ControllerConstants.Paths.ADMIN_CACHE_SUMMARY, method = RequestMethod.GET, produces = "application/json; charset=UTF-8")
public String getCacheSummary() {
  return Json.print(Json.toJSON(CacheSummaryHandler.getCacheValues()));
}

代码示例来源:origin: 52North/SOS

@ResponseBody
@RequestMapping(value = ControllerConstants.Paths.ADMIN_EXTENSIONS_JSON_ENDPOINT, method = RequestMethod.GET, produces = ControllerConstants.MEDIA_TYPE_APPLICATION_JSON)
public String getAll() throws JSONException, ConnectionProviderException {
  ObjectNode node = Json.nodeFactory().objectNode();
  node.set(JSONConstants.EXTENDED_CAPABILITIES_EXTENSION_KEY, getExtendedCapabilitiesExtensions());
  node.set(JSONConstants.OFFERING_EXTENSION_EXTENSION_KEY, getOfferingExtensionExtensions());
  return Json.print(node);
}

代码示例来源:origin: org.n52.sensorweb.sos/admin-controller

@ResponseBody
@RequestMapping(value = ControllerConstants.Paths.ADMIN_CACHE_LOADING, method = RequestMethod.GET, produces = "application/json; charset=UTF-8")
public String getCacheLoadingStatus() throws JSONException, UnavailableException {
  checkConfiguratorAvailability();
  return Json.print(Json.nodeFactory().objectNode().put("loading", cacheIsLoading()));
}

代码示例来源:origin: 52North/SOS

@ResponseBody
@RequestMapping(value = ControllerConstants.Paths.ADMIN_CACHE_LOADING, method = RequestMethod.GET, produces = "application/json; charset=UTF-8")
public String getCacheLoadingStatus() throws JSONException, UnavailableException {
  checkConfiguratorAvailability();
  return Json.print(Json.nodeFactory().objectNode().put("loading", cacheIsLoading()));
}

代码示例来源:origin: org.n52.sensorweb.sos/admin-controller

@ResponseBody
@ResponseStatus(HttpStatus.OK)
@RequestMapping(method = RequestMethod.GET,
        produces = ControllerConstants.MEDIA_TYPE_APPLICATION_JSON)
public String get()
    throws NoImplementationFoundException, JSONException,
        OwsExceptionReport {
  Iterable<T> i18n = getDao().getMetadata();
  return Json.print(encoder.encode(i18n));
}

代码示例来源:origin: 52North/SOS

@ResponseBody
@ResponseStatus(HttpStatus.OK)
@RequestMapping(method = RequestMethod.GET,
        produces = ControllerConstants.MEDIA_TYPE_APPLICATION_JSON)
public String get()
    throws NoImplementationFoundException, JSONException,
        OwsExceptionReport {
  Iterable<T> i18n = getDao().getMetadata();
  return Json.print(encoder.encode(i18n));
}

代码示例来源:origin: org.n52.arctic-sea/svalbard-json-common

public String encode(ProcessingReport report, JsonNode instance) {
  ObjectNode objectNode = Json.nodeFactory().objectNode();
  objectNode.set(JSONConstants.INSTANCE, instance);
  ArrayNode errors = objectNode.putArray(JSONConstants.ERRORS);
  for (ProcessingMessage m : report) {
    errors.add(m.asJson());
  }
  return Json.print(objectNode);
}

代码示例来源:origin: 52North/SOS

@ResponseBody
@RequestMapping(method = RequestMethod.GET, produces = "application/json; charset=UTF-8")
public String get(HttpSession session) throws JSONException {
  return Json.print(encode(getSettings(session), getDatasources()));
}

代码示例来源:origin: org.n52.sensorweb.sos/admin-controller

private String getSettingsJsonString()
    throws ConfigurationError, JSONException,
        ConnectionProviderException {
  return Json.print(encodeValues(settingsManager.getSettings()));
}

代码示例来源:origin: org.n52.sensorweb.sos/install-controller

protected Map<String, Object> toModel(InstallationConfiguration c) throws ConfigurationError, JSONException {
  Map<String, Object> model = new HashMap<>(4);
  model.put(ControllerConstants.SETTINGS_MODEL_ATTRIBUTE, Json.print(encodeValues(c.getSettings())));
  model.put(ControllerConstants.DATABASE_SETTINGS_MODEL_ATTRIBUTE, c.getDatabaseSettings());
  model.put(ControllerConstants.ADMIN_USERNAME_REQUEST_PARAMETER, c.getUsername());
  model.put(ControllerConstants.ADMIN_PASSWORD_REQUEST_PARAMETER, c.getPassword());
  return model;
}

代码示例来源:origin: org.n52.sensorweb.sos/profile-coding

@Override
public void persist() {
  ProfileWriter pw = new ProfileWriter();
  for (File file : loadFiles()) {
    try (FileOutputStream fio = new FileOutputStream(file)) {
      Json.print(fio, pw.write(getAvailableProfiles().values()));
    } catch (IOException e) {
      LOGGER.error("Error while storing profile to file!", e);
    }
  }
}

相关文章

微信公众号

最新文章

更多