You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Mark Li (JIRA)" <de...@myfaces.apache.org> on 2010/03/29 02:51:27 UTC

[jira] Created: (MYFACES-2628) Facelets ResourceSolver cant work

Facelets ResourceSolver cant work
---------------------------------

                 Key: MYFACES-2628
                 URL: https://issues.apache.org/jira/browse/MYFACES-2628
             Project: MyFaces Core
          Issue Type: Bug
          Components: JSR-314
    Affects Versions: 2.0.0-beta-3
         Environment: tomcat 6.0.20, java 1.6(mac osx), 
            Reporter: Mark Li


In facelets 1.1.14, I can load page from classpath via ResourceSolver, 
by in myfaces 2.0.0-beta-3, I cant do this, because 'DefaultRestoreViewSupport.checkResourceExists' method check the resource exists using 'servletContext.getResource(path);', should do some delegate.

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


[jira] Commented: (MYFACES-2628) Facelets ResourceSolver cant work

Posted by "Mark Li (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/MYFACES-2628?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12850771#action_12850771 ] 

Mark Li commented on MYFACES-2628:
----------------------------------

I also find DefaultViewHandlerSupport.checkResourceExists has the same problem, after change these two method, facelets ResourceSolver can work properly.

> Facelets ResourceSolver cant work
> ---------------------------------
>
>                 Key: MYFACES-2628
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2628
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: JSR-314
>    Affects Versions: 2.0.0-beta-3
>         Environment: tomcat 6.0.20, java 1.6(mac osx), 
>            Reporter: Mark Li
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> In facelets 1.1.14, I can load page from classpath via ResourceSolver, 
> by in myfaces 2.0.0-beta-3, I cant do this, because 'DefaultRestoreViewSupport.checkResourceExists' method check the resource exists using 'servletContext.getResource(path);', should do some delegate.

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


[jira] Commented: (MYFACES-2628) Facelets ResourceSolver cant work

Posted by "Mark Li (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/MYFACES-2628?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12850783#action_12850783 ] 

Mark Li commented on MYFACES-2628:
----------------------------------

this is my suggestion:

orginal:
public final class ServletExternalContextImpl extends ExternalContext implements ReleaseableExternalContext
{
   .....

    @Override
    public URL getResource(final String path) throws MalformedURLException
    {
        checkNull(path, "path");
	return _servletContext.getResource(path);
    }

}

to 
public final class ServletExternalContextImpl extends ExternalContext implements ReleaseableExternalContext
{
   .....

    @Override
    public URL getResource(final String path) throws MalformedURLException
    {
        checkNull(path, "path");
        FaceletsResolver resolver = ....;
        URL url = resolver.resolveUrl(path);
	return url;
    }

}

Of cource, the DefaultFaceletsResolver class should not use context.getExternalContext().getResource(url) any more.


> Facelets ResourceSolver cant work
> ---------------------------------
>
>                 Key: MYFACES-2628
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2628
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: JSR-314
>    Affects Versions: 2.0.0-beta-3
>         Environment: tomcat 6.0.20, java 1.6(mac osx), 
>            Reporter: Mark Li
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> In facelets 1.1.14, I can load page from classpath via ResourceSolver, 
> by in myfaces 2.0.0-beta-3, I cant do this, because 'DefaultRestoreViewSupport.checkResourceExists' method check the resource exists using 'servletContext.getResource(path);', should do some delegate.

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


[jira] Commented: (MYFACES-2628) Facelets ResourceSolver cant work

Posted by "Bernd Bohmann (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/MYFACES-2628?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12894671#action_12894671 ] 

Bernd Bohmann commented on MYFACES-2628:
----------------------------------------

@Leonardo 
Why we need a standard way to get the current ResourceResolver? 

> Facelets ResourceSolver cant work
> ---------------------------------
>
>                 Key: MYFACES-2628
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2628
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: JSR-314
>    Affects Versions: 2.0.0-beta-3
>         Environment: tomcat 6.0.20, java 1.6(mac osx), 
>            Reporter: Mark Li
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> In facelets 1.1.14, I can load page from classpath via ResourceSolver, 
> by in myfaces 2.0.0-beta-3, I cant do this, because 'DefaultRestoreViewSupport.checkResourceExists' method check the resource exists using 'servletContext.getResource(path);', should do some delegate.

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


[jira] Commented: (MYFACES-2628) Facelets ResourceSolver cant work

Posted by "Leonardo Uribe (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/MYFACES-2628?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12854296#action_12854296 ] 

Leonardo Uribe commented on MYFACES-2628:
-----------------------------------------

I check this one and the conclusion was this one is a problem related to the spec. There is no standard way to get the current ResourceResolver instaces, but the is way to override it. We have to report this one to jsr-314-open mailing list.

> Facelets ResourceSolver cant work
> ---------------------------------
>
>                 Key: MYFACES-2628
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2628
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: JSR-314
>    Affects Versions: 2.0.0-beta-3
>         Environment: tomcat 6.0.20, java 1.6(mac osx), 
>            Reporter: Mark Li
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> In facelets 1.1.14, I can load page from classpath via ResourceSolver, 
> by in myfaces 2.0.0-beta-3, I cant do this, because 'DefaultRestoreViewSupport.checkResourceExists' method check the resource exists using 'servletContext.getResource(path);', should do some delegate.

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


[jira] Issue Comment Edited: (MYFACES-2628) Facelets ResourceSolver cant work

Posted by "Leonardo Uribe (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/MYFACES-2628?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12894800#action_12894800 ] 

Leonardo Uribe edited comment on MYFACES-2628 at 8/2/10 11:19 PM:
------------------------------------------------------------------

 There is no reason to expose it, but note ResourceResolver is part of the current api, and there is a web config param:

javax.faces.FACELETS_RESOURCE_RESOLVER

used to override it. This class is used by the vdl to retrieve facelet xhtml files and construct Facelet instances (in this case DefaultFacelet instances). My first idea looking this stuff is why there is a param for create an instance to an object that I can't retrieve from the place it could be useful?

Thinking more about it the problem is the vdl should be responsible to indicate if the viewId is valid or not, on in other words, if there is a source file that can generate a view with the viewId identifier. In jsp case it just should try to locate a .jsp file with the same name, in facelets case check this condition using the ResourceResolver instance (in the default case it does the same a jsp case but for xhtml files). Note FaceletViewDeclarationLanguage.createFaceletFactory creates an instance of ResourceResolver and pass it to DefaultFaceletFactory. Maybe we should send an email to jsr-314-open, so this could be included in jsf 2.1.

To solve this issue maybe we can hold a duplicate instance to ResourceResolver, one on facelets vdl (specifically on the factory) and the other one on RestoreViewSupport instance. After all, this class is expected to be stateless, so it will be no problem.

Suggestions are welcome.



      was (Author: lu4242):
     There is no any reason to expose it, but note ResourceResolver is part of the current api, and there is a web config param:

  
> Facelets ResourceSolver cant work
> ---------------------------------
>
>                 Key: MYFACES-2628
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2628
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: JSR-314
>    Affects Versions: 2.0.0-beta-3
>         Environment: tomcat 6.0.20, java 1.6(mac osx), 
>            Reporter: Mark Li
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> In facelets 1.1.14, I can load page from classpath via ResourceSolver, 
> by in myfaces 2.0.0-beta-3, I cant do this, because 'DefaultRestoreViewSupport.checkResourceExists' method check the resource exists using 'servletContext.getResource(path);', should do some delegate.

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


[jira] Commented: (MYFACES-2628) Facelets ResourceSolver cant work

Posted by "Leonardo Uribe (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/MYFACES-2628?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12894678#action_12894678 ] 

Leonardo Uribe commented on MYFACES-2628:
-----------------------------------------

Because to resolve suffix mapping when the view is resolved it is necessary to check if the resource exists or not. If a request receive something like /mypage.jsf, it is necessary to check if the resource is /myfaces.xhtml or /myfaces.jsp or /myfaces.jspx, and this is done checking if the resource file exists or not. Right now, if someone overrides the ResourceResolver, the current algorithm continues looking for the resources on the same locations, ignoring ResourceResolver interface.

Maybe we can use ResourceResolver.resolveUrl for this, if it returns null the resource does not exists otherwise it exists, but there is no standard way to expose the current ResourceResolver instance.

> Facelets ResourceSolver cant work
> ---------------------------------
>
>                 Key: MYFACES-2628
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2628
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: JSR-314
>    Affects Versions: 2.0.0-beta-3
>         Environment: tomcat 6.0.20, java 1.6(mac osx), 
>            Reporter: Mark Li
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> In facelets 1.1.14, I can load page from classpath via ResourceSolver, 
> by in myfaces 2.0.0-beta-3, I cant do this, because 'DefaultRestoreViewSupport.checkResourceExists' method check the resource exists using 'servletContext.getResource(path);', should do some delegate.

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


[jira] Commented: (MYFACES-2628) Facelets ResourceSolver cant work

Posted by "Bernd Bohmann (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/MYFACES-2628?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12894722#action_12894722 ] 

Bernd Bohmann commented on MYFACES-2628:
----------------------------------------

Independent of the suffix mapping problem, why we need a standard way to expose the current ResourceResolver instance?

> Facelets ResourceSolver cant work
> ---------------------------------
>
>                 Key: MYFACES-2628
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2628
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: JSR-314
>    Affects Versions: 2.0.0-beta-3
>         Environment: tomcat 6.0.20, java 1.6(mac osx), 
>            Reporter: Mark Li
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> In facelets 1.1.14, I can load page from classpath via ResourceSolver, 
> by in myfaces 2.0.0-beta-3, I cant do this, because 'DefaultRestoreViewSupport.checkResourceExists' method check the resource exists using 'servletContext.getResource(path);', should do some delegate.

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


[jira] Commented: (MYFACES-2628) Facelets ResourceSolver cant work

Posted by "Leonardo Uribe (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/MYFACES-2628?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12894800#action_12894800 ] 

Leonardo Uribe commented on MYFACES-2628:
-----------------------------------------

 There is no any reason to expose it, but note ResourceResolver is part of the current api, and there is a web config param:


> Facelets ResourceSolver cant work
> ---------------------------------
>
>                 Key: MYFACES-2628
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2628
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: JSR-314
>    Affects Versions: 2.0.0-beta-3
>         Environment: tomcat 6.0.20, java 1.6(mac osx), 
>            Reporter: Mark Li
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> In facelets 1.1.14, I can load page from classpath via ResourceSolver, 
> by in myfaces 2.0.0-beta-3, I cant do this, because 'DefaultRestoreViewSupport.checkResourceExists' method check the resource exists using 'servletContext.getResource(path);', should do some delegate.

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


[jira] Commented: (MYFACES-2628) Facelets ResourceSolver cant work

Posted by "Mark Li (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/MYFACES-2628?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12862555#action_12862555 ] 

Mark Li commented on MYFACES-2628:
----------------------------------

ok, thx

> Facelets ResourceSolver cant work
> ---------------------------------
>
>                 Key: MYFACES-2628
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2628
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: JSR-314
>    Affects Versions: 2.0.0-beta-3
>         Environment: tomcat 6.0.20, java 1.6(mac osx), 
>            Reporter: Mark Li
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> In facelets 1.1.14, I can load page from classpath via ResourceSolver, 
> by in myfaces 2.0.0-beta-3, I cant do this, because 'DefaultRestoreViewSupport.checkResourceExists' method check the resource exists using 'servletContext.getResource(path);', should do some delegate.

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