users@grizzly.java.net

Re: [Issue 457] [http-servlet] httprequest return "" for request.getPathInfo(); and request.getServletPath();

From: Survivant 00 <survivant00_at_gmail.com>
Date: Wed, 25 Feb 2009 09:09:48 -0500

ok.. just to be sure that I get it right


suppose that I have a test.war

it will be deploy in /test folder

so the servletpath will be "/test"

in the web.xml

I have 2 servlets : servlet1 and servlet2

the servlet-mapping are

servlet1 = /*.jsp

servlet2 = /subpath/*.jsp


so the result should be


ServletAdapter sa1 = new ServletAdapter();
sa1.setContextPath("/*.jsp");
sa2.setServletPath("/test");

ServletAdapter sa2 = new ServletAdapter();
sa1.setContextPath("/subpath/*.jsp");
sa2.setServletPath("/test");

 ws.addGrizzlyAdapter(sa1, new String[]{alias});
 ws.addGrizzlyAdapter(sa2, new String[]{alias});

but what will be the ALIAS value ?





2009/2/24 jfarcand <jfarcand_at_dev.java.net>

> https://grizzly.dev.java.net/issues/show_bug.cgi?id=457
>
>
>
> User jfarcand changed the following:
>
> What |Old value |New value
>
> ================================================================================
> Status|NEW |RESOLVED
>
> --------------------------------------------------------------------------------
> Resolution| |WORKSFORME
>
> --------------------------------------------------------------------------------
>
>
>
>
> ------- Additional comments from jfarcand_at_dev.java.net Wed Feb 25 02:18:44
> +0000 2009 -------
> OK the GrizzlyWebServer is not smart enough to make the difference between
> a
> ServletAdapter and a GrizzlyAdapter extension, hence you must configure
> yourself
> the context path and server path like the test I've added under:
>
> http-servlet/src/test/java/com/sun/grizzly/http/servlet/BasicServletTest:
>
> public void testPathInfo() throws IOException {
> System.out.println("testPathInfo");
> try {
> newGWS(PORT);
> String alias = "/contextPath/servletPath/";
> ServletAdapter servletAdapter = addAdapter(alias);
> servletAdapter.setContextPath("/contextPath");
> servletAdapter.setServletPath("/servletPath");
> gws.start();
> HttpURLConnection conn =
> getConnection("/contextPath/servletPath/pathInfo");
> String s = conn.getHeaderField("Path-Info");
> assertEquals(s, "/pathInfo");
> } finally {
> stopGrizzlyWebServer();
> }
>
> Closing as worksforme. Re-open if I didn't get it right :-)
>
> }
>