本文整理汇总了Java中org.eclipse.jetty.util.IO.toString方法的典型用法代码示例。如果您正苦于以下问题:Java IO.toString方法的具体用法?Java IO.toString怎么用?Java IO.toString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jetty.util.IO
的用法示例。
在下文中一共展示了IO.toString方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: produceStartScript
import org.eclipse.jetty.util.IO; //导入方法依赖的package包/类
private String produceStartScript(String serviceName) {
final URL startStopResource = getClass().getResource("startstop.sh");
String ss = null;
try {
ss = IO.toString(startStopResource.openStream());
} catch (IOException e) {
throw new RuntimeException(e);
}
ss = String.format(ss, serviceName, getWarLocation().getAbsolutePath());
return ss;
}
示例2: doGet
import org.eclipse.jetty.util.IO; //导入方法依赖的package包/类
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String body = IO.toString(request.getInputStream(), Charsets.UTF_8.displayName());
logger.debug("received {} request: {}\n Body: '{}'", request.getMethod(), request.getRequestURI(), body);
response.setContentType("text/html;charset=utf-8");
response.setStatus(HttpServletResponse.SC_OK);
response.getWriter().print(this.message);
}
示例3: doGet
import org.eclipse.jetty.util.IO; //导入方法依赖的package包/类
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String body = IO.toString(request.getInputStream(), Charsets.UTF_8.displayName());
logger.debug("received {} request: {}\n Body: '{}'", request.getMethod(), request.getRequestURI(), body);
response.setContentType("text/html;charset=utf-8");
response.setStatus(HttpServletResponse.SC_OK);
response.getWriter().println(body);
}
示例4: handleRequest
import org.eclipse.jetty.util.IO; //导入方法依赖的package包/类
private void handleRequest(HttpServletRequest request, HttpServletResponse response) throws IOException {
String body = IO.toString(request.getInputStream(), Charsets.UTF_8.displayName());
logger.debug("received {} request: {}\n Body: '{}'", request.getMethod(), request.getRequestURI(), body);
response.setContentType("text/html;charset=utf-8");
response.setStatus(HttpServletResponse.SC_OK);
response.getWriter().print("Hello World!");
}
示例5: doGet
import org.eclipse.jetty.util.IO; //导入方法依赖的package包/类
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String body = IO.toString(request.getInputStream(), Charsets.UTF_8.displayName());
logger.debug("received {} request: {}\n Body: '{}'", request.getMethod(), request.getRequestURI(), body);
response.setStatus(HttpServletResponse.SC_NO_CONTENT);
return;
}
示例6: doPost
import org.eclipse.jetty.util.IO; //导入方法依赖的package包/类
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String body = IO.toString(request.getInputStream(), Charsets.UTF_8.displayName());
logger.debug("received {} request: {}\n Body: '{}'", request.getMethod(), request.getRequestURI(), body);
response.setStatus(HttpServletResponse.SC_NO_CONTENT);
return;
}
示例7: doPost
import org.eclipse.jetty.util.IO; //导入方法依赖的package包/类
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String body = IO.toString(request.getInputStream(), Charsets.UTF_8.displayName());
logger.debug("received {} request: {}\n Body: '{}'", request.getMethod(), request.getRequestURI(), body);
this.receivedAlerts.add(JsonUtils.toObject(JsonUtils.parseJsonString(body), Alert.class));
response.setContentType("text/html;charset=utf-8");
response.setStatus(this.responseCode);
response.getWriter().close();
}
示例8: handle
import org.eclipse.jetty.util.IO; //导入方法依赖的package包/类
@Override
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException {
String receivedMessage = IO.toString(request.getInputStream(), Charsets.UTF_8.displayName());
logger.debug("received {} request: {}\n Body: '{}'", request.getMethod(), request.getRequestURI(),
receivedMessage);
this.postedMessages.add(receivedMessage);
response.setContentType("text/html;charset=utf-8");
response.setStatus(HttpServletResponse.SC_OK);
baseRequest.setHandled(true);
String responseMessage = "This is the response";
response.getWriter().println(responseMessage);
}