dev@grizzly.java.net

Re: bug with alias mapping

From: Survivant 00 <survivant00_at_gmail.com>
Date: Tue, 28 Apr 2009 10:38:24 -0400

it's bug 556.

I'll add this sample to the issue.

2009/4/28 Jeanfrancois Arcand <Jeanfrancois.Arcand_at_sun.com>

> Salut,
>
> file an issue with the code below and I will look at it.
>
> Thanks!
>
> -- Jeanfrancois
>
> Survivant 00 wrote:
>
>>
>> I think it's not just with the "/" I try with this.. and it return 200
>> too and I see a nice "Hello World !" in the console :(
>>
>> try {
>> startGrizzlyWebServer(PORT);
>> String[] aliases = new String[] { "/test/a.hello" };
>>
>> String context = "/test";
>> String servletPath = "/test2";
>> String rootFolder = ".";
>> ServletAdapter adapter =
>> getServletAdapter("servlet.HelloServlet", context, servletPath, rootFolder);
>>
>> gws.addGrizzlyAdapter(adapter, aliases);
>>
>> gws.start();
>> String url = context + servletPath + "/index.php";
>> HttpURLConnection conn = getConnection(url);
>> assertEquals(HttpServletResponse.SC_OK,
>> getResponseCodeFromAlias(conn));
>> System.out.println("");
>> System.out.println(readResponse(conn));
>>
>>
>>
>>
>>
>> 2009/4/28 Survivant 00 <survivant00_at_gmail.com <mailto:
>> survivant00_at_gmail.com>>
>>
>> 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 <mailto: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
>> <mailto: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
>> <mailto:dev-unsubscribe_at_grizzly.dev.java.net>
>> For additional commands, e-mail: dev-help_at_grizzly.dev.java.net
>> <mailto:dev-help_at_grizzly.dev.java.net>
>>
>>
>>
>>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_grizzly.dev.java.net
> For additional commands, e-mail: dev-help_at_grizzly.dev.java.net
>
>