org.h2.server.web.WebServer.trace()方法的使用及代码示例

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

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

WebServer.trace介绍

[英]Write trace information if trace is enabled.
[中]如果启用了跟踪,则写入跟踪信息。

代码示例

代码示例来源:origin: com.h2database/h2

private void trace(String s) {
    server.trace(s);
  }
}

代码示例来源:origin: com.h2database/h2

private void trace(String s) {
  server.trace(s);
}

代码示例来源:origin: com.h2database/h2

/**
 * Read the given file from the file system or from the resources.
 *
 * @param file the file name
 * @return the data
 */
byte[] getFile(String file) throws IOException {
  trace("getFile <" + file + ">");
  byte[] data = Utils.getResource("/org/h2/server/web/res/" + file);
  if (data == null) {
    trace(" null");
  } else {
    trace(" size=" + data.length);
  }
  return data;
}

代码示例来源:origin: com.h2database/h2

/**
 * Get the web session object for the given session id.
 *
 * @param sessionId the session id
 * @return the web session or null
 */
WebSession getSession(String sessionId) {
  long now = System.currentTimeMillis();
  if (lastTimeoutCheck + SESSION_TIMEOUT < now) {
    for (String id : new ArrayList<>(sessions.keySet())) {
      WebSession session = sessions.get(id);
      if (session.lastAccess + SESSION_TIMEOUT < now) {
        trace("timeout for " + id);
        sessions.remove(id);
      }
    }
    lastTimeoutCheck = now;
  }
  WebSession session = sessions.get(sessionId);
  if (session != null) {
    session.lastAccess = System.currentTimeMillis();
  }
  return session;
}

代码示例来源:origin: com.h2database/h2

@Override
public void listen() {
  this.listenerThread = Thread.currentThread();
  try {
    while (serverSocket != null) {
      Socket s = serverSocket.accept();
      WebThread c = new WebThread(s, this);
      running.add(c);
      c.start();
    }
  } catch (Exception e) {
    trace(e.toString());
  }
}

代码示例来源:origin: com.h2database/h2

/**
 * Read the translation for this language and save them in the 'text'
 * property of this session.
 *
 * @param session the session
 * @param language the language
 */
void readTranslations(WebSession session, String language) {
  Properties text = new Properties();
  try {
    trace("translation: "+language);
    byte[] trans = getFile("_text_"+language+".prop");
    trace("  "+new String(trans));
    text = SortedProperties.fromLines(new String(trans, StandardCharsets.UTF_8));
    // remove starting # (if not translated yet)
    for (Entry<Object, Object> entry : text.entrySet()) {
      String value = (String) entry.getValue();
      if (value.startsWith("#")) {
        entry.setValue(value.substring(1));
      }
    }
  } catch (IOException e) {
    DbException.traceThrowable(e);
  }
  session.put("text", new HashMap<>(text));
}

代码示例来源:origin: org.wowtools/h2

private void trace(String s) {
    server.trace(s);
  }
}

代码示例来源:origin: com.eventsourcing/h2

private void trace(String s) {
    server.trace(s);
  }
}

代码示例来源:origin: org.wowtools/h2

private void trace(String s) {
  server.trace(s);
}

代码示例来源:origin: com.eventsourcing/h2

private void trace(String s) {
  server.trace(s);
}

代码示例来源:origin: com.h2database/com.springsource.org.h2

byte[] getFile(String file) throws IOException {
  trace("getFile <" + file + ">");
  byte[] data = Resources.get("/org/h2/server/web/res/" + file);
  if (data == null) {
    trace(" null");
  } else {
    trace(" size=" + data.length);
  }
  return data;
}

代码示例来源:origin: com.eventsourcing/h2

/**
 * Read the given file from the file system or from the resources.
 *
 * @param file the file name
 * @return the data
 */
byte[] getFile(String file) throws IOException {
  trace("getFile <" + file + ">");
  byte[] data = Utils.getResource("/org/h2/server/web/res/" + file);
  if (data == null) {
    trace(" null");
  } else {
    trace(" size=" + data.length);
  }
  return data;
}

代码示例来源:origin: org.wowtools/h2

/**
 * Read the given file from the file system or from the resources.
 *
 * @param file the file name
 * @return the data
 */
byte[] getFile(String file) throws IOException {
  trace("getFile <" + file + ">");
  byte[] data = Utils.getResource("/org/h2/server/web/res/" + file);
  if (data == null) {
    trace(" null");
  } else {
    trace(" size=" + data.length);
  }
  return data;
}

代码示例来源:origin: com.h2database/com.springsource.org.h2

public void listen() {
  this.listenerThread = Thread.currentThread();
  try {
    while (serverSocket != null) {
      Socket s = serverSocket.accept();
      WebThread c = new WebThread(s, this);
      running.add(c);
      c.start();
    }
  } catch (Exception e) {
    trace(e.toString());
  }
}

代码示例来源:origin: org.wowtools/h2

@Override
public void listen() {
  this.listenerThread = Thread.currentThread();
  try {
    while (serverSocket != null) {
      Socket s = serverSocket.accept();
      WebThread c = new WebThread(s, this);
      running.add(c);
      c.start();
    }
  } catch (Exception e) {
    trace(e.toString());
  }
}

代码示例来源:origin: com.eventsourcing/h2

@Override
public void listen() {
  this.listenerThread = Thread.currentThread();
  try {
    while (serverSocket != null) {
      Socket s = serverSocket.accept();
      WebThread c = new WebThread(s, this);
      running.add(c);
      c.start();
    }
  } catch (Exception e) {
    trace(e.toString());
  }
}

代码示例来源:origin: com.h2database/com.springsource.org.h2

WebSession getSession(String sessionId) {
  long now = System.currentTimeMillis();
  if (lastTimeoutCheck + SESSION_TIMEOUT < now) {
    Object[] list = sessions.keySet().toArray();
    for (int i = 0; i < list.length; i++) {
      String id = (String) list[i];
      WebSession session = (WebSession) sessions.get(id);
      Long last = (Long) session.get("lastAccess");
      if (last != null && last.longValue() + SESSION_TIMEOUT < now) {
        trace("timeout for " + id);
        sessions.remove(id);
      }
    }
    lastTimeoutCheck = now;
  }
  WebSession session = (WebSession) sessions.get(sessionId);
  if (session != null) {
    session.lastAccess = System.currentTimeMillis();
  }
  return session;
}

代码示例来源:origin: com.h2database/com.springsource.org.h2

public void readTranslations(WebSession session, String language) {
  Properties text = new Properties();
  try {
    trace("translation: "+language);
    byte[] trans = getFile("_text_"+language+".properties");
    trace("  "+new String(trans));
    text.load(new ByteArrayInputStream(trans));
    // remove starting # (if not translated yet)
    for (Iterator it = text.entrySet().iterator(); it.hasNext();) {
      Entry entry = (Entry) it.next();
      String value = (String) entry.getValue();
      if (value.startsWith("#")) {
        entry.setValue(value.substring(1));
      }
    }
  } catch (IOException e) {
    TraceSystem.traceThrowable(e);
  }
  session.put("text", new HashMap(text));
}

代码示例来源:origin: com.h2database/com.springsource.org.h2

private String adminSave() {
  try {
    server.setPort(MathUtils.decodeInt((String) attributes.get("port")));
    server.setAllowOthers(Boolean.valueOf((String) attributes.get("allowOthers")).booleanValue());
    server.setSSL(Boolean.valueOf((String) attributes.get("ssl")).booleanValue());
    server.saveSettings();
  } catch (Exception e) {
    server.trace(e.toString());
  }
  return admin();
}

代码示例来源:origin: com.h2database/com.springsource.org.h2

private String logout() {
  try {
    Connection conn = session.getConnection();
    session.setConnection(null);
    session.remove("conn");
    session.remove("result");
    session.remove("tables");
    session.remove("user");
    session.remove("tool");
    if (conn != null) {
      conn.close();
    }
  } catch (Exception e) {
    server.trace(e.toString());
  }
  return "index.do";
}

相关文章