Ejemplo n.º 1
0
  /** JaggeryMethod responsible of writing to the output stream */
  public static void print(Context cx, Scriptable thisObj, Object[] args, Function funObj)
      throws ScriptException {
    if (!isWebSocket) {
      JaggeryContext jaggeryContext = CommonManager.getJaggeryContext();

      // If the script itself havent set the content type we set the default content type to be
      // text/html
      HttpServletResponse servletResponse =
          (HttpServletResponse) jaggeryContext.getProperty(SERVLET_RESPONSE);
      if (servletResponse.getContentType() == null) {
        servletResponse.setContentType(DEFAULT_CONTENT_TYPE);
      }

      if (servletResponse.getCharacterEncoding() == null) {
        servletResponse.setCharacterEncoding(DEFAULT_CHAR_ENCODING);
      }

      CommonManager.print(cx, thisObj, args, funObj);
    }
  }
Ejemplo n.º 2
0
  /** JaggeryMethod responsible of writing to the output stream */
  public static void print(Context cx, Scriptable thisObj, Object[] args, Function funObj)
      throws ScriptException {
    if (!isWebSocket) {
      JaggeryContext jaggeryContext = CommonManager.getJaggeryContext();

      // If the script itself havent set the content type we set the default content type to be
      // text/html
      if (((WebAppContext) jaggeryContext).getServletResponse().getContentType() == null) {
        ((WebAppContext) CommonManager.getJaggeryContext())
            .getServletResponse()
            .setContentType(DEFAULT_CONTENT_TYPE);
      }

      if (((WebAppContext) jaggeryContext).getServletResponse().getCharacterEncoding() == null) {
        ((WebAppContext) CommonManager.getJaggeryContext())
            .getServletResponse()
            .setCharacterEncoding(DEFAULT_CHAR_ENCODING);
      }

      CommonManager.print(cx, thisObj, args, funObj);
    }
  }