ok.. I didn't see this one .It's bug 556.
I think I lost lot of time because of this :(
I'll continue to create unit test.. I hope to save time with that :)
2009/4/28 Richard Corsale <igf1_at_yahoo.com>
>
> I filed a bug for this the other day . It's when you load the servlet at
> context / it anwsers all requests for everything
>
> Sent from my iPhone
>
> On Apr 28, 2009, at 8:31 AM, Survivant 00 <survivant00_at_gmail.com> wrote:
>
> Can someone confirm that this is a bug.
>
> I was trying to test the mapping for a helloworld servlet.. but even when I
> enter a invalid URL.. the HelloWorld was return.
>
> so I create another test.
>
> I took the com.sun.grizzly.http.MappingTest
>
> and add this test
>
> public void testWrongMapping2() throws IOException {
> System.out.println("testWrongMapping2");
> try {
> startGrizzlyWebServer(PORT);
> String alias = "/*.a";
> addAdapter(alias);
> HttpURLConnection conn = getConnection("/aaa.html");
> assertEquals(HttpServletResponse.SC_NOT_FOUND,
> getResponseCodeFromAlias(conn));
> } finally {
> stopGrizzlyWebServer();
> }
> }
>
> I receive a 200 code return instead of a 404.
>
> my helloworld test was something like this:
>
> public void testHelloWorld() throws Exception {
> System.out.println("testHelloWorld");
> try {
> startGrizzlyWebServer(PORT);
> String[] aliases = new String[] { "/*.hello" };
>
> String context = "/";
> String servletPath = "";
> String rootFolder = ".";
>
> ServletAdapter adapter =
> getServletAdapter("servlet.HelloServlet", context, servletPath, rootFolder);
>
> gws.addGrizzlyAdapter(adapter, aliases);
>
> gws.start();
>
> String url = context + servletPath + "/index.php"; // not
> suppose the return a 200.
> HttpURLConnection conn = getConnection(url);
> assertEquals(HttpServletResponse.SC_OK,
> getResponseCodeFromAlias(conn));
>
> System.out.println(readResponse(conn));
>
> //assertEquals(url, );
>
> } finally {
> stopGrizzlyWebServer();
> }
> }
>
> I receive a HelloWorld :(
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_grizzly.dev.java.net
> For additional commands, e-mail: dev-help_at_grizzly.dev.java.net
>
>