Survivant 00 wrote:
> the webcontainer that I checked were : jetty and tomcat. they load a
> default web.xml and append it to all the webapps deployed. I need the
> have the same behavior if I want to add JSP support.
> '
Yes but I think the way you configure GWS is incorrect, e.g if you get
the source, I suspect it is because nothing has been mapped tp "/", so
you are getting the "default" Adapter, which only serve static
resources. If you map *.php to your PHPAdapter, with alias '*.php", I
suspect it will works, right?
Thanks!
--Jeanfrancois
>
>
> if I look at Jetty etc/webdefault.xml
>
>
> <servlet id="jsp">
> <servlet-name>jsp</servlet-name>
> <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
> <init-param>
> <param-name>logVerbosityLevel</param-name>
> <param-value>DEBUG</param-value>
> </init-param>
> <init-param>
> <param-name>fork</param-name>
> <param-value>false</param-value>
> </init-param>
> <init-param>
> <param-name>xpoweredBy</param-name>
> <param-value>false</param-value>
> </init-param>
> <!--
> <init-param>
> <param-name>classpath</param-name>
> <param-value>?</param-value>
> </init-param>
> -->
> <load-on-startup>0</load-on-startup>
> </servlet>
>
> <servlet-mapping>
> <servlet-name>jsp</servlet-name>
> <url-pattern>*.jsp</url-pattern>
> <url-pattern>*.jspf</url-pattern>
> <url-pattern>*.jspx</url-pattern>
> <url-pattern>*.xsp</url-pattern>
> <url-pattern>*.JSP</url-pattern>
> <url-pattern>*.JSPF</url-pattern>
> <url-pattern>*.JSPX</url-pattern>
> <url-pattern>*.XSP</url-pattern>
> </servlet-mapping>
>
>
>
> Tomcat /conf/web.xml
>
> <servlet>
> <servlet-name>jsp</servlet-name>
> <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
> <init-param>
> <param-name>logVerbosityLevel</param-name>
> <param-value>WARNING</param-value>
> </init-param>
> <init-param>
> <param-name>fork</param-name>
> <param-value>false</param-value>
> </init-param>
> <load-on-startup>3</load-on-startup>
> </servlet>
>
> <!-- The mapping for the JSP servlet -->
> <servlet-mapping>
> <servlet-name>jsp</servlet-name>
> <url-pattern>*.jsp</url-pattern>
> </servlet-mapping>
>
>
>
> 2009/5/11 Jeanfrancois Arcand <Jeanfrancois.Arcand_at_sun.com
> <mailto:Jeanfrancois.Arcand_at_sun.com>>
>
>
>
> Survivant 00 wrote:
>
> for me a alias = "*.jsp" or "/*.jsp" would mean that all the
> .jsp will be handle.. in all context.
>
> like how the web container do that.
>
>
> Hum, Web Container are not doing the following?
>
> /a/*.jsp != /*.jsp ?
>
> Which Container have you tested?
>
> Thanks
>
> -- Jeanfrancois
>
>
>
>
>
>
> 2009/5/11 Jeanfrancois Arcand <Jeanfrancois.Arcand_at_sun.com
> <mailto:Jeanfrancois.Arcand_at_sun.com>
> <mailto:Jeanfrancois.Arcand_at_sun.com
> <mailto:Jeanfrancois.Arcand_at_sun.com>>>
>
>
> Salut,
>
>
> Survivant 00 wrote:
>
> thanks JF for the multipath fix.. but now I'm running another
> test that failed.
>
> I have a php page index.php in
>
> C:/source/grizzly/modules/http-servlet-deployer/war_php/joomla/index.php
>
>
> and when I run this testcase.. I received a 200.. but
> also the
> content of index.php, not compiled by the servlet.
>
>
>
> Should the alias in the PHP case be:
>
> war_php/joomla
>
> The PHP files gets serviced because the file is under /, but the
> alias for the PHP ServletAdapter is was_php/joomla.
>
> Thanks!
>
> -- Jeanfrancois
>
>
>
> there is something that I missed ?
>
> I have the same problem with JSP
>
> public void testDeployAutoServletPHP2() throws IOException {
> System.out.println("testPHP");
> try {
> startGrizzlyWebServer(PORT);
> String[] aliases = new String[] { "*.php" };
> String context = "/";
> String servletPath = "war_php/joomla";
> //String rootFolder = ".";
> String rootFolder =
> "C:/source/grizzly/modules/http-servlet-deployer/war_php/";
> // loadons les jars dans le classpath
> GrizzlyWebServerDeployer deployer = new
> GrizzlyWebServerDeployer();
>
> deployer.setLibraryPath("C:/source/grizzly/modules/http-servlet-deployer/lib_autodeploy");
> deployer.appendWarContentToClassPath(null);
> ServletAdapter adapter = new
> ServletAdapter();
> Servlet servlet = (Servlet)
>
> ClassLoaderUtil.load("com.caucho.quercus.servlet.QuercusServlet");
> adapter.setServletInstance(servlet);
> adapter.setContextPath(context);
> adapter.setServletPath(servletPath);
> adapter.setRootFolder(rootFolder);
> gws.addGrizzlyAdapter(adapter, aliases);
> gws.start();
> //WINNER
> //
> http://localhost:18901/war_autodeploy/php_test/index.php
> String url = context + servletPath +
> "/index.php";
> HttpURLConnection conn = getConnection(url);
> assertEquals(HttpServletResponse.SC_OK,
> getResponseCodeFromAlias(conn));
> System.out.println(readResponse(conn));
> //assertEquals(url, );
> } finally {
> stopGrizzlyWebServer();
> }
> }
>
>
> testPHP
> [main] Fri May 08 20:35:23 EDT 2009 [LE PLUS FIN]
>
> com.sun.grizzly.http.servlet.deployer.GrizzlyWebServerDeployer
> appendWarContentToClassPath:Classpath
>
> contains=file:/file:/C:/sources/grizzly/code/modules/http-servlet-deployer/webapps/
>
> [main] Fri May 08 20:35:23 EDT 2009 [LE PLUS FIN]
>
> com.sun.grizzly.http.servlet.deployer.GrizzlyWebServerDeployer
> appendWarContentToClassPath:Classpath
>
> contains=file:/file:/C:/sources/grizzly/code/modules/http-servlet-deployer/war_php/
>
> [main] Fri May 08 20:35:23 EDT 2009 [FIN]
> com.sun.grizzly.http.SelectorThread initAlgorithm:Using
> Algorithm: com.sun.grizzly.http.algorithms.NoParsingAlgorithm
>
> [main] Fri May 08 20:35:23 EDT 2009 [FIN]
> com.sun.grizzly.Controller autoConfigureCore:Controller
> auto-configured with 2 ReadController based on underlying
> cores/processors, with a Thread Pool of maximum size 10
>
> [main] Fri May 08 20:35:23 EDT 2009 [INFO]
> com.sun.grizzly.http.PHPGrizzlyWebServerTest
> getConnection:sending request to /joomla/index.php
>
> [http18901-WorkerThread(0)] Fri May 08 20:35:23 EDT 2009
> [FIN]
> com.sun.grizzly.SelectorHandlerRunner dolog:OP_ACCEPT on
> sun.nio.ch.SelectionKeyImpl_at_fe64b9 attachment: null
>
> [main] Fri May 08 20:35:23 EDT 2009 [FIN]
> sun.net.www.protocol.http.HttpURLConnection
> writeRequests:sun.net.www.MessageHeader_at_19616c75 pairs: {GET
> /joomla/index.php HTTP/1.1: null}{User-Agent:
> Java/1.6.0_13}{Host: localhost:18901}{Accept: text/html,
> image/gif, image/jpeg, *; q=.2, */*; q=.2}{Connection:
> keep-alive}
>
> [http18901-WorkerThread(0)] Fri May 08 20:35:23 EDT 2009
> [FIN]
> com.sun.grizzly.SelectorHandlerRunner dolog:OP_READ on
> sun.nio.ch.SelectionKeyImpl_at_b166b5 attachment: 1241829323758
>
> [http18901-WorkerThread(0)] Fri May 08 20:35:23 EDT 2009
> [FIN]
> com.sun.grizzly.tcp.StaticResourcesAdapter service:File not
> found .\joomla\index.php
>
> [http18901-WorkerThread(0)] Fri May 08 20:35:27 EDT 2009 [LE
> PLUS FIN] com.sun.grizzly.http.SocketChannelOutputBuffer
> flushChannel:flushChannel isAsyncHttpWriteEnabled=false
> bb=java.nio.HeapByteBuffer[pos=0 lim=166 cap=131072]
>
> [main] Fri May 08 20:35:27 EDT 2009 [FIN]
> sun.net.www.protocol.http.HttpURLConnection
> getInputStream:sun.net.www.MessageHeader_at_e1899b5 pairs:
> {null:
> HTTP/1.1 404 Not Found}{server: grizzly/1.9.16}{Content-Type:
> text/plain; charset=iso-8859-1}{Transfer-Encoding:
> chunked}{Date: Sat, 09 May 2009 00:35:27 GMT}
>
> [http18901-WorkerThread(1)] Fri May 08 20:35:28 EDT 2009
> [FIN]
> com.sun.grizzly.BaseSelectionKeyHandler$1
> locallyClosed:sun.nio.ch.SelectionKeyImpl_at_fe64b9 is being
> locally cancelled
>
> [http18901-WorkerThread(1)] Fri May 08 20:35:28 EDT 2009
> [FIN]
> com.sun.grizzly.BaseSelectionKeyHandler$1
> locallyClosed:sun.nio.ch.SelectionKeyImpl_at_b166b5 is being
> locally cancelled
>
>
>
> here JSP
>
> public void testComplexAliasMapping() throws IOException {
> System.out.println("testComplexAliasMapping");
> try {
> startGrizzlyWebServer(PORT);
> String[] aliases = new String[] { "/*.jsp" };
> String context = "/test";
> String servletPath = "/servlet";
> String rootFolder = ".";
> //debug
> GrizzlyWebServerDeployer deployer = new
> GrizzlyWebServerDeployer();
>
> deployer.setLibraryPath("C:/sources/grizzly/code/modules/http-servlet-deployer/lib_autodeploy");
>
> deployer.appendWarContentToClassPath("C:/sources/grizzly/code/modules/http-servlet-deployer/");
> ServletAdapter adapter = new
> ServletAdapter();
> Servlet servlet = (Servlet)
> ClassLoaderUtil.load("org.apache.jasper.servlet.JspServlet");
> adapter.setServletInstance(servlet);
> adapter.setContextPath(context);
> adapter.setServletPath(servletPath);
> adapter.setRootFolder(rootFolder);
> adapter.addInitParameter("fork",
> "false");
> adapter.addInitParameter("classpath",
> "C:/sources/grizzly/code/modules/http-servlet-deployer/");
> gws.addGrizzlyAdapter(adapter,
> aliases);
> gws.start();
>
> //special test
> String url = context + servletPath + "/index.jsp";
> HttpURLConnection conn = getConnection(url);
> assertEquals(HttpServletResponse.SC_OK,
> getResponseCodeFromAlias(conn));
> assertEquals(url, readResponse(conn));
> } finally {
> stopGrizzlyWebServer();
> }
> }
>
> I received : allo toi <%=request.getParameter("id")%>
>
> instead of : allo toi /test/servlet/index.jsp
>
> here the log
>
> testComplexAliasMapping
> 2009-05-08 20:49:38
> com.sun.grizzly.http.JSPGrizzlyWebServerTest2 getConnection
> INFO: sending request to /test/servlet/index.jsp
> 2009-05-08 20:49:38
> com.sun.grizzly.http.JSPGrizzlyWebServerTest2 readResponse
> INFO: received line allo toi <%=request.getParameter("id")%>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_grizzly.dev.java.net
> <mailto:dev-unsubscribe_at_grizzly.dev.java.net>
> <mailto: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>
> <mailto: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
> <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>
>
>