コード例 #1
0
 private JSONObject makeJson() {
   response.setContentType("text/json");
   JSONObject jsonObject = new JSONObject();
   String attributes[] =
       new String[] {
         TEST.toString(),
         PropertySEARCH,
         PropertyEDIT,
         PropertyPROPERTIES,
         PropertyVERSIONS,
         PropertyREFACTOR,
         PropertyWHERE_USED,
         PropertyRECENT_CHANGES,
         SUITE.toString(),
         PropertyPRUNE,
         PropertySECURE_READ,
         PropertySECURE_WRITE,
         PropertySECURE_TEST,
         PropertyFILES
       };
   for (String attribute : attributes) addJsonAttribute(jsonObject, attribute);
   if (pageData.hasAttribute(PropertyHELP)) {
     jsonObject.put(PropertyHELP, pageData.getAttribute(PropertyHELP));
   }
   if (pageData.hasAttribute(PropertySUITES)) {
     JSONArray tags = new JSONArray();
     for (String tag : pageData.getAttribute(PropertySUITES).split(",")) {
       if (StringUtils.isNotBlank(tag)) {
         tags.put(tag.trim());
       }
     }
     jsonObject.put(PropertySUITES, tags);
   }
   return jsonObject;
 }
コード例 #2
0
ファイル: RssResponder.java プロジェクト: fkleijne/fitnesse
 public SimpleResponse asResponse() throws Exception {
   byte[] bytes = toByteArray(document);
   SimpleResponse response = new SimpleResponse();
   response.setContent(bytes);
   response.setContentType("text/xml");
   return response;
 }
コード例 #3
0
  private Response makePageHistoryXmlResponse(Request request) {
    VelocityContext velocityContext = new VelocityContext();
    velocityContext.put("pageHistory", pageHistory);

    response.setContentType("text/xml");
    response.setContent(context.pageFactory.render(velocityContext, "pageHistoryXML.vm"));
    return response;
  }
コード例 #4
0
 private Response generateXMLResponse(File file) {
   try {
     response.setContent(FileUtil.getFileContent(file));
   } catch (IOException e) {
     response.setContent("Error: Unable to read file '" + file.getName() + "'\n");
   }
   response.setContentType(Format.XML);
   return response;
 }
コード例 #5
0
  private JSONObject makeJson() {
    response.setContentType("text/json");
    JSONObject jsonObject = new JSONObject();
    String attributes[] =
        new String[] {
          TEST.toString(),
          PropertySEARCH,
          PropertyEDIT,
          PropertyPROPERTIES,
          PropertyVERSIONS,
          PropertyREFACTOR,
          PropertyWHERE_USED,
          PropertyRECENT_CHANGES,
          SUITE.toString(),
          PropertyPRUNE,
          PropertySECURE_READ,
          PropertySECURE_WRITE,
          PropertySECURE_TEST
        };
    for (String attribute : attributes) addJsonAttribute(jsonObject, attribute);

    return jsonObject;
  }