本文整理了Java中org.h2.server.web.WebServer.getFile()
方法的一些代码示例,展示了WebServer.getFile()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebServer.getFile()
方法的具体详情如下:
包路径:org.h2.server.web.WebServer
类名称:WebServer
方法名:getFile
[英]Read the given file from the file system or from the resources.
[中]从文件系统或资源中读取给定文件。
代码示例来源: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: com.h2database/h2
return;
byte[] bytes = server.getFile(file);
if (bytes == null) {
resp.sendError(HttpServletResponse.SC_NOT_FOUND);
代码示例来源:origin: com.h2database/h2
message = "HTTP/1.1 304 Not Modified\r\n";
} else {
bytes = server.getFile(file);
if (bytes == null) {
message = "HTTP/1.1 404 Not Found\r\n";
代码示例来源:origin: com.h2database/h2
String page = new String(server.getFile("result.jsp"), StandardCharsets.UTF_8);
int idx = page.indexOf("${result}");
代码示例来源:origin: com.h2database/com.springsource.org.h2
String getTextFile(String file) throws IOException {
byte[] bytes = getFile(file);
return new String(bytes);
}
代码示例来源: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.eventsourcing/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, Constants.UTF8));
// 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<Object, Object>(text));
}
代码示例来源:origin: org.wowtools/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, Constants.UTF8));
// 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<Object, Object>(text));
}
代码示例来源:origin: com.eventsourcing/h2
return;
byte[] bytes = server.getFile(file);
if (bytes == null) {
resp.sendError(HttpServletResponse.SC_NOT_FOUND);
代码示例来源:origin: org.wowtools/h2
return;
byte[] bytes = server.getFile(file);
if (bytes == null) {
resp.sendError(HttpServletResponse.SC_NOT_FOUND);
代码示例来源:origin: com.h2database/com.springsource.org.h2
return;
} else {
bytes = server.getFile(file);
代码示例来源:origin: org.wowtools/h2
message = "HTTP/1.1 304 Not Modified\r\n";
} else {
bytes = server.getFile(file);
if (bytes == null) {
message = "HTTP/1.1 404 Not Found\r\n";
代码示例来源:origin: com.eventsourcing/h2
message = "HTTP/1.1 304 Not Modified\r\n";
} else {
bytes = server.getFile(file);
if (bytes == null) {
message = "HTTP/1.1 404 Not Found\r\n";
代码示例来源:origin: com.eventsourcing/h2
String page = new String(server.getFile("result.jsp"), Constants.UTF8);
int idx = page.indexOf("${result}");
代码示例来源:origin: org.leapframework/jmms-engine
return;
byte[] bytes = server.getFile(file);
if (bytes == null) {
resp.sendError(HttpServletResponse.SC_NOT_FOUND);
代码示例来源:origin: org.wowtools/h2
String page = new String(server.getFile("result.jsp"), Constants.UTF8);
int idx = page.indexOf("${result}");
代码示例来源:origin: com.h2database/com.springsource.org.h2
message = "HTTP/1.1 304 Not Modified\n";
} else {
bytes = server.getFile(file);
if (bytes == null) {
message = "HTTP/1.0 404 Not Found\n";
内容来源于网络,如有侵权,请联系作者删除!