Exemple #1
0
  public static void renderJsResource(ImtWebContext imtWebContext) throws IOException {
    imtWebContext.setJavaScriptContentType();

    int pos = imtWebContext.getUrl().indexOf("/js");
    String path = imtWebContext.getUrl().substring(pos);

    InputStream is = null;
    BufferedReader in = null;
    try {
      is = ImtPageGen.class.getResourceAsStream(path);
      in = new BufferedReader(new InputStreamReader(is));

      String line = "";
      while ((line = in.readLine()) != null) {
        imtWebContext.render(line);
      }
    } finally {
      if (null != is) {
        try {
          is.close();
        } catch (IOException e) {
        }
      }
      if (null != in) {
        try {
          in.close();
        } catch (IOException e) {
        }
      }
    }
  }
Exemple #2
0
 public static void renderMethodInvoke(ImtWebContext imtWebContext) throws IOException {
   imtWebContext.setHtmlContentType();
   Object ret =
       imtWebContext
           .getInterfaceManagementTool()
           .invoke(
               imtWebContext.getKey(), imtWebContext.getAdditionalData(), imtWebContext.getArgs());
   imtWebContext.render(JSON.toJSONString(ret));
 }
Exemple #3
0
  public static void renderCssResource(ImtWebContext context) throws IOException {
    context.setCssContentType();

    int pos = context.getUrl().indexOf("/css");
    String path = context.getUrl().substring(pos);
    context.put("url", context.getUrl().substring(0, pos));
    context.put("encoding", context.getEncoding());

    context.render(merge(context, path));
  }
Exemple #4
0
 public static void renderPage(ImtWebContext imtWebContext) throws IOException {
   imtWebContext.setHtmlContentType();
   imtWebContext.render(merge(imtWebContext, "/vm/page.vm"));
 }