You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Bernhard Huemer (JIRA)" <de...@myfaces.apache.org> on 2007/08/13 23:49:30 UTC

[jira] Issue Comment Edited: (MYFACES-1694) Myfaces 1.2 doesn't start without web.xml

    [ https://issues.apache.org/jira/browse/MYFACES-1694?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12519535 ] 

bhuemer edited comment on MYFACES-1694 at 8/13/07 2:47 PM:
-------------------------------------------------------------------

Currently MyFaces needs the mapping for the FacesServlet because of the url-pattern. MyFaces' ViewHandler calculates view IDs and action URLs based on this url-pattern, but I've attempted a different approach. The parts of the request URI (context path, servlet path and path info) provide more than enough information to calculate view IDs and action URLs. For example, if the path info is not null, the FacesServlet has been definitely mapped using prefix mapping and the servlet path indicates the url-pattern in this case.

Additionally, thanks to refactoring of a small amount of code, you're now able to turn off validation. I'll attach a sample application that shows how to do that. Don't bother with the exceptions being thrown as that's just because I haven't written any JSPs. I'd appreciate if you could test my patch using your unit tests.

I've already tested my patch using the MyFaces Tomahawk examples.

(It seems that the Maven Exec Plug-In has a bug concerning the Maven build lifecycle. If you want to execute the sample, you have to run "mvn compile exec:java". "mvn exec:java" leads to a NPE.)

      was (Author: bhuemer):
    Currently MyFaces needs the mapping for the FacesServlet because of the url-pattern. MyFaces' ViewHandler calculates view IDs and action URLs based on this url-pattern, but I've attempted a different approach. The parts of the request URI (context path, servlet path and path info) provide more than enough information to calculate view IDs and action URLs. For example, if the path info is not null, the FacesServlet has been definitely mapped using prefix mapping and the servlet path indicates the url-pattern in this case.

Additionally, thanks to refactoring of a small amount of code, you're now able to turn off validation. I'll attach a sample application that shows how to do that. Don't bother with the exceptions being thrown as that's just because I haven't written any JSPs. I'd appreciate if you could test my patch using your unit tests.

(It seems that the Maven Exec Plug-In has a bug concerning the Maven build lifecycle. If you want to execute the sample, you have to run "mvn compile exec:java". "mvn exec:java" leads to a NPE.)
  
> Myfaces 1.2 doesn't start without web.xml
> -----------------------------------------
>
>                 Key: MYFACES-1694
>                 URL: https://issues.apache.org/jira/browse/MYFACES-1694
>             Project: MyFaces Core
>          Issue Type: Improvement
>          Components: JSR-252
>    Affects Versions:  1.2.0
>            Reporter: Achim Hügen
>            Priority: Minor
>         Attachments: jetty-embedded.zip, MYFACES-1694.patch
>
>
> Myfaces 1.2 fails with one of these messages if no web.xml can be found or no mapping for the FacesServlet is defined:
> "Couldn't find web.xml. Abort initializing MyFaces."
> "No mappings of FacesServlet found. Abort initializing MyFaces."
> That's a quite strict interpretation of the spec which says 
> 'Implementations may check for the presence of a servlet-class definition of class
> javax.faces.webapp.FacesServlet in the web application deployment descriptor
> as a means to abort the configuration process and reduce startup time for applications that do
> not use JavaServer Faces Technology.'
> It would be helpful for unit tests if the web.xml and a servlet-mapping is not mandatory (maybe configurable?).
> In my unit tests I start an embedded jetty server whose configuration is build programmatically:
> Server jettyServer = new Server();
> Context webappContext = new Context(jettyServer, contextPath, Context.SESSIONS);
> webappContext.addEventListener(new StartupServletContextListener());
> ServletHolder facesServletHolder = new ServletHolder(new FacesServlet());
> webappContext.addServlet(facesServletHolder, "*.faces");
> webappContext.getServer().start();
> That code is working fine with Myfaces 1.1 but broken with 1.2.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.