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 11:23:09 -0500

merci

but it not working exactly like I want yet


I'm deploying a servlet with a web.xml


I want the servlet to be in the context : "/"

and I want to handle all the *.ftl file (but in web.xml I have that for
the servlet-mapping : "/index.ftl" )


so I obtain that with registering the SA.

context=/
servletPath=/index.ftl
alias=/index.ftl


but I need to enter this URL to get it to work.

http://localhost:8080//index.ftl

you see the double "//"

which value should I remove the slash ? context, servletPath or alias ?


and suppose the same question for this example

demo.war that handle /*.jsp

I suppose it will be


context=/demo
servletPath=/*.jsp
alias=/demo/*.jsp


http:localhost:8080/demo/index.jsp





2009/2/25 Jeanfrancois Arcand <Jeanfrancois.Arcand_at_sun.com>

> Salut,
>
> Survivant 00 wrote:
>
>> 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"
>>
>
> The context-path 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");
>>
>
> servlet-path will be */jsp (the contrary).
>
>
>> 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 ?
>>
>
> /test/*.jsp
> /test/subpath
>
> Does it help?
>
> A+
>
> -- Jeanfrancois
>
>
>
>>
>>
>>
>>
>> 2009/2/24 jfarcand <jfarcand_at_dev.java.net <mailto: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
>> <mailto: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 :-)
>>
>> }
>>
>>
>>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>
>