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


Java ByteChunk.toString方法代码示例

本文整理汇总了Java中org.apache.tomcat.util.buf.ByteChunk.toString方法的典型用法代码示例。如果您正苦于以下问题:Java ByteChunk.toString方法的具体用法?Java ByteChunk.toString怎么用?Java ByteChunk.toString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.tomcat.util.buf.ByteChunk的用法示例。


在下文中一共展示了ByteChunk.toString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: bug54241a

import org.apache.tomcat.util.buf.ByteChunk; //导入方法依赖的package包/类
@Test
public void bug54241a() throws Exception {
    Tomcat tomcat = getTomcatInstance();

    File appDir = new File("test/webapp-3.0");
    tomcat.addWebapp(null, "/test", appDir.getAbsolutePath());

    tomcat.start();

    ByteChunk res = new ByteChunk();

    int rc = getUrl("http://localhost:" + getPort() +
            "/test/bug5nnnn/bug54241a.jsp", res, null);

    Assert.assertEquals(HttpServletResponse.SC_OK, rc);

    String body = res.toString();
    Assert.assertTrue(body.contains("01: null"));
    Assert.assertTrue(body.contains("02: null"));
}
 
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:21,代码来源:TestJspWriterImpl.java

示例2: testTldVersions30

import org.apache.tomcat.util.buf.ByteChunk; //导入方法依赖的package包/类
@Test
public void testTldVersions30() throws Exception {
    Tomcat tomcat = getTomcatInstance();

    File appDir =
        new File("test/webapp-3.0");
    // app dir is relative to server home
    tomcat.addWebapp(null, "/test", appDir.getAbsolutePath());

    tomcat.start();

    ByteChunk res = getUrl("http://localhost:" + getPort() +
            "/test/tld-versions.jsp");

    String result = res.toString();

    assertTrue(result.indexOf("<p>00-hello world</p>") > 0);
    assertTrue(result.indexOf("<p>#{'01-hello world'}</p>") > 0);
    assertTrue(result.indexOf("<p>02-hello world</p>") > 0);
    assertTrue(result.indexOf("<p>#{'03-hello world'}</p>") > 0);
    assertTrue(result.indexOf("<p>04-hello world</p>") > 0);
    assertTrue(result.indexOf("<p>#{'05-hello world'}</p>") > 0);
    assertTrue(result.indexOf("<p>06-hello world</p>") > 0);
}
 
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:25,代码来源:TestValidator.java

示例3: doBug56501

import org.apache.tomcat.util.buf.ByteChunk; //导入方法依赖的package包/类
private void doBug56501(String deployPath, String requestPath, String expected)
        throws Exception {

    // Setup Tomcat instance
    Tomcat tomcat = getTomcatInstance();

    // No file system docBase required
    Context ctx = tomcat.addContext(deployPath, null);

    Tomcat.addServlet(ctx, "servlet", new Bug56501Servelet());
    ctx.addServletMapping("/*", "servlet");

    tomcat.start();

    ByteChunk res = getUrl("http://localhost:" + getPort() + requestPath);
    String resultPath = res.toString();
    if (resultPath == null) {
        resultPath = "";
    }
    assertEquals(expected, resultPath);
}
 
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:22,代码来源:TestRequest.java

示例4: testBug53257c

import org.apache.tomcat.util.buf.ByteChunk; //导入方法依赖的package包/类
@Test
public void testBug53257c() throws Exception {
    Tomcat tomcat = getTomcatInstance();

    File appDir = new File("test/webapp-3.0");
    tomcat.addWebapp(null, "/test", appDir.getAbsolutePath());
    tomcat.start();

    // foo#bar.jsp
    ByteChunk res = getUrl("http://localhost:" + getPort() +
            "/test/bug53257/foo%23bar.jsp");

    // Check request completed
    String result = res.toString();
    assertEcho(result, "OK");
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:17,代码来源:TestCompiler.java

示例5: testDefaultBufferSize

import org.apache.tomcat.util.buf.ByteChunk; //导入方法依赖的package包/类
@Test
public void testDefaultBufferSize() throws Exception {
    Tomcat tomcat = getTomcatInstance();

    File appDir = new File("test/webapp-3.0");
    // app dir is relative to server home
    Context ctx = tomcat.addWebapp(null, "/test", appDir.getAbsolutePath());

    // Add the Servlet
    Tomcat.addServlet(ctx, "bug56010", new Bug56010());
    ctx.addServletMapping("/bug56010", "bug56010");

    tomcat.start();

    ByteChunk res = getUrl("http://localhost:" + getPort() + "/test/bug56010");

    String result = res.toString();
    Assert.assertTrue(result.contains("OK"));
}
 
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:20,代码来源:TestPageContextImpl.java

示例6: testBug56612

import org.apache.tomcat.util.buf.ByteChunk; //导入方法依赖的package包/类
@Test
public void testBug56612() throws Exception {
    Tomcat tomcat = getTomcatInstance();

    File appDir = new File("test/webapp-3.0");
    // app dir is relative to server home
    tomcat.addWebapp(null, "/test", appDir.getAbsolutePath());

    tomcat.start();

    ByteChunk res = getUrl("http://localhost:" + getPort() +
            "/test/bug5nnnn/bug56612.jsp");

    String result = res.toString();
    Assert.assertTrue(result.contains("00-''"));
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:17,代码来源:TestELInJsp.java

示例7: testBug49726a

import org.apache.tomcat.util.buf.ByteChunk; //导入方法依赖的package包/类
@Test
public void testBug49726a() throws Exception {
    Tomcat tomcat = getTomcatInstance();

    File appDir = new File("test/webapp-3.0");
    tomcat.addWebapp(null, "/test", appDir.getAbsolutePath());
    tomcat.start();

    ByteChunk res = new ByteChunk();
    Map<String,List<String>> headers = new HashMap<String,List<String>>();

    getUrl("http://localhost:" + getPort() + "/test/bug49nnn/bug49726a.jsp",
            res, headers);

    // Check request completed
    String result = res.toString();
    assertEcho(result, "OK");

    // Check content type
    assertTrue(headers.get("Content-Type").get(0).startsWith("text/html"));
}
 
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:22,代码来源:TestCompiler.java

示例8: testBug56029

import org.apache.tomcat.util.buf.ByteChunk; //导入方法依赖的package包/类
@Test
public void testBug56029() throws Exception {
    Tomcat tomcat = getTomcatInstance();

    File appDir = new File("test/webapp-3.0");
    // app dir is relative to server home
    StandardContext ctxt = (StandardContext) tomcat.addWebapp(
            null, "/test", appDir.getAbsolutePath());

    // This test needs the JSTL libraries
    File lib = new File("webapps/examples/WEB-INF/lib");
    ctxt.setAliases("/WEB-INF/lib=" + lib.getCanonicalPath());

    tomcat.start();

    ByteChunk res = getUrl("http://localhost:" + getPort() +
            "/test/bug5nnnn/bug56029.jspx");

    String result = res.toString();

    Assert.assertTrue(result.contains("[1]:[1]"));
}
 
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:23,代码来源:TestELInJsp.java

示例9: testBug45511

import org.apache.tomcat.util.buf.ByteChunk; //导入方法依赖的package包/类
@Test
public void testBug45511() throws Exception {
    Tomcat tomcat = getTomcatInstance();

    File appDir =
        new File("test/webapp-3.0");
    // app dir is relative to server home
    tomcat.addWebapp(null, "/test", appDir.getAbsolutePath());

    tomcat.start();

    ByteChunk res = getUrl("http://localhost:" + getPort() +
            "/test/bug45nnn/bug45511.jsp");

    String result = res.toString();
    assertEcho(result, "00-true");
    assertEcho(result, "01-false");
}
 
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:19,代码来源:TestELInJsp.java

示例10: testBug52335

import org.apache.tomcat.util.buf.ByteChunk; //导入方法依赖的package包/类
@Test
public void testBug52335() throws Exception {
    Tomcat tomcat = getTomcatInstance();

    File appDir =
        new File("test/webapp-3.0");
    // app dir is relative to server home
    tomcat.addWebapp(null, "/test", appDir.getAbsolutePath());

    tomcat.start();

    ByteChunk res = getUrl("http://localhost:" + getPort() +
            "/test/bug5nnnn/bug52335.jsp");

    String result = res.toString();
    // Beware of the differences between escaping in JSP attributes and
    // in Java Strings
    assertEcho(result, "00 - \\% \\\\% <%");
    assertEcho(result, "01 - <b><%</b>");
    assertEcho(result, "02 - <p>Foo</p><%");
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:22,代码来源:TestParser.java

示例11: testBug48627

import org.apache.tomcat.util.buf.ByteChunk; //导入方法依赖的package包/类
@Test
public void testBug48627() throws Exception {
    Tomcat tomcat = getTomcatInstance();

    File appDir =
        new File("test/webapp-3.0");
    // app dir is relative to server home
    tomcat.addWebapp(null, "/test", appDir.getAbsolutePath());

    tomcat.start();

    ByteChunk res = getUrl("http://localhost:" + getPort() +
            "/test/bug48nnn/bug48627.jsp");

    String result = res.toString();
    // Beware of the differences between escaping in JSP attributes and
    // in Java Strings
    assertEcho(result, "00-\\");
    assertEcho(result, "01-\\");
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:21,代码来源:TestParserNoStrictWhitespace.java

示例12: testBug53257d

import org.apache.tomcat.util.buf.ByteChunk; //导入方法依赖的package包/类
@Test
public void testBug53257d() throws Exception {
    Tomcat tomcat = getTomcatInstance();

    File appDir = new File("test/webapp-3.0");
    tomcat.addWebapp(null, "/test", appDir.getAbsolutePath());
    tomcat.start();

    // foo%bar.jsp
    ByteChunk res = getUrl("http://localhost:" + getPort() +
            "/test/bug53257/foo%25bar.jsp");

    // Check request completed
    String result = res.toString();
    assertEcho(result, "OK");
}
 
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:17,代码来源:TestCompiler.java

示例13: testDoForward

import org.apache.tomcat.util.buf.ByteChunk; //导入方法依赖的package包/类
@Test
public void testDoForward() throws Exception {
    Tomcat tomcat = getTomcatInstance();

    File appDir = new File("test/webapp-3.0");
    tomcat.addWebapp(null, "/test", appDir.getAbsolutePath());

    tomcat.start();

    ByteChunk res = new ByteChunk();

    int rc = getUrl("http://localhost:" + getPort() +
            "/test/bug5nnnn/bug53545.jsp", res, null);

    Assert.assertEquals(HttpServletResponse.SC_OK, rc);

    String body = res.toString();
    Assert.assertTrue(body.contains("OK"));
    Assert.assertFalse(body.contains("FAIL"));
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:21,代码来源:TestPageContextImpl.java

示例14: testBug49799

import org.apache.tomcat.util.buf.ByteChunk; //导入方法依赖的package包/类
@Test
public void testBug49799() throws Exception {

    String[] expected = { "<p style=\"color:red\">00-Red</p>",
                          "<p>01-Not Red</p>",
                          "<p style=\"color:red\">02-Red</p>",
                          "<p>03-Not Red</p>",
                          "<p style=\"color:red\">04-Red</p>",
                          "<p>05-Not Red</p>"};

    Tomcat tomcat = getTomcatInstance();

    File appDir = new File("test/webapp-3.0");
    tomcat.addWebapp(null, "/test", appDir.getAbsolutePath());
    tomcat.start();

    ByteChunk res = new ByteChunk();
    Map<String,List<String>> headers = new HashMap<String,List<String>>();

    getUrl("http://localhost:" + getPort() + "/test/bug49nnn/bug49799.jsp",
            res, headers);

    // Check request completed
    String result = res.toString();
    String[] lines = result.split("\n|\r|\r\n");
    int i = 0;
    for (String line : lines) {
        if (line.length() > 0) {
            assertEquals(expected[i], line);
            i++;
        }
    }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:34,代码来源:TestGenerator.java

示例15: assertPageContains

import org.apache.tomcat.util.buf.ByteChunk; //导入方法依赖的package包/类
private void assertPageContains(String pageUrl, String expectedBody,
        int expectedStatus) throws IOException {
    ByteChunk res = new ByteChunk();
    int sc = getUrl("http://localhost:" + getPort() + pageUrl, res, null);

    Assert.assertEquals(expectedStatus, sc);

    if (expectedStatus == HttpServletResponse.SC_OK) {
        String result = res.toString();
        Assert.assertTrue(result, result.indexOf(expectedBody) > -1);
    }
}
 
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:13,代码来源:TestContextConfig.java


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