当前位置: 首页>>代码示例>>Java>>正文


Java IO.toString方法代码示例

本文整理汇总了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;
}
 
开发者ID:eirbjo,项目名称:jetty-console,代码行数:13,代码来源:StartStopScriptPlugin.java

示例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);
}
 
开发者ID:elastisys,项目名称:scale.commons,代码行数:11,代码来源:MessageServlet.java

示例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);
}
 
开发者ID:elastisys,项目名称:scale.commons,代码行数:11,代码来源:EchoServlet.java

示例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!");
}
 
开发者ID:elastisys,项目名称:scale.commons,代码行数:9,代码来源:HelloWorldServlet.java

示例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;
}
 
开发者ID:elastisys,项目名称:scale.commons,代码行数:10,代码来源:SilentServlet.java

示例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;
}
 
开发者ID:elastisys,项目名称:scale.commons,代码行数:10,代码来源:SilentServlet.java

示例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();
}
 
开发者ID:elastisys,项目名称:scale.commons,代码行数:12,代码来源:WebhookServlet.java

示例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);
}
 
开发者ID:elastisys,项目名称:scale.commons,代码行数:16,代码来源:RequestLoggingHttpServer.java


注:本文中的org.eclipse.jetty.util.IO.toString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。