Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide annotation for declaring Facelets ResourceResolver #1038

Closed
eclipse-faces-bot opened this issue Oct 6, 2011 · 16 comments
Closed

Provide annotation for declaring Facelets ResourceResolver #1038

eclipse-faces-bot opened this issue Oct 6, 2011 · 16 comments

Comments

@eclipse-faces-bot
Copy link

We need a way to declare a ResourceResolver without XML.

Affected Versions

[2.0]

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
Reported by @edburns

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
Issue-Links:
is related to
JAVASERVERFACES_SPEC_PUBLIC-599

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
@edburns said:
Adding jsf-api/src/main/java/javax/faces/view/facelets/FaceletsResourceResolver.java
Transmitting file data .
Committed revision 9400.

Still need to implement

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
@edburns said:
Fix in progress. Incomplete.

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
File: diffs.patch
Attached By: @edburns

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
@edburns said:
in progress, need test before commit

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
File: changebundle.txt
Attached By: @edburns

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
@edburns said:
Sending jsf-ri/src/main/java/com/sun/faces/application/ApplicationAssociate.java
Sending jsf-ri/src/main/java/com/sun/faces/config/AnnotationScanner.java
Sending jsf-ri/src/main/java/com/sun/faces/facelets/util/ReflectionUtil.java
Adding jsf-test/#1038
Adding jsf-test/#1038/build.xml
Adding jsf-test/#1038/i_spec_1038_war
Adding jsf-test/#1038/i_spec_1038_war/pom.xml
Adding jsf-test/#1038/i_spec_1038_war/src
Adding jsf-test/#1038/i_spec_1038_war/src/main
Adding jsf-test/#1038/i_spec_1038_war/src/main/java
Adding jsf-test/#1038/i_spec_1038_war/src/main/java/com
Adding jsf-test/#1038/i_spec_1038_war/src/main/java/com/sun
Adding jsf-test/#1038/i_spec_1038_war/src/main/java/com/sun/faces
Adding jsf-test/#1038/i_spec_1038_war/src/main/java/com/sun/faces/regression
Adding jsf-test/#1038/i_spec_1038_war/src/main/java/com/sun/faces/regression/i_spec_1038_war
Adding jsf-test/#1038/i_spec_1038_war/src/main/java/com/sun/faces/regression/i_spec_1038_war/AnnotationDeclaredResourceResolver.java
Adding jsf-test/#1038/i_spec_1038_war/src/main/webapp
Adding jsf-test/#1038/i_spec_1038_war/src/main/webapp/WEB-INF
Adding jsf-test/#1038/i_spec_1038_war/src/main/webapp/WEB-INF/beans.xml
Adding jsf-test/#1038/i_spec_1038_war/src/main/webapp/WEB-INF/web.xml
Adding jsf-test/#1038/i_spec_1038_war/src/main/webapp/i_spec_1038_war.xhtml
Transmitting file data .........
Committed revision 9401.

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
@arjantijms said:
I have a question about the implementation. Currently it's:

**ApplicationAssociate#createFaceletFactory**Set<? extends Class> resourceResolvers = 
    ConfigManager.getAnnotatedClasses(ctx).get(FaceletsResourceResolver.class);
if ((null != resourceResolvers) && !resourceResolvers.isEmpty()) {
    Class resolverClass = resourceResolvers.iterator().next();
    if (1 < resourceResolvers.size()) {
        if (LOGGER.isLoggable(Level.SEVERE)) {
            LOGGER.log(Level.SEVERE, "Found more than one class " + 
"annotated with FaceletsResourceResolver.  Will " + 
"use {0} and ignore the others", resolverClass);
        }
    }
    resolver = (ResourceResolver) 
        ReflectionUtil.decorateInstance(resolverClass,
        ResourceResolver.class,
        resolver);
} else {
    String resolverName = webConfig.getOptionValue(FaceletsResourceResolver);
    if (resolverName != null && resolverName.length() > 0) {
        resolver = (ResourceResolver) 
ReflectionUtil.decorateInstance(resolverName,
ResourceResolver.class,
resolver);
    }
}

So if the @FaceletsResourceResolver annotation is present, it's used. Otherwise the XML is consulted.

Should this perhaps not be the other way around? In Java EE it seems to be the convention that XML can be used to override annotations. Is there a hard rule for this somewhere?

A small other thing; I noticed that in com.sun.faces.config.AnnotationScanner the Javadoc on top of the class has not been updated for the newly added annotation.

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
@edburns said:
Good questions by arjan tims have prompted me to reopen this.

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
@edburns said:
Spec changes.

Sending preface.fm
Sending usingFacesInWebapps.fm
Transmitting file data ..
Committed revision 1041.

Sending jsf-ri/src/main/java/com/sun/faces/application/ApplicationAssociate.java
Sending jsf-ri/src/main/java/com/sun/faces/config/AnnotationScanner.java
Transmitting file data ..
Committed revision 9407.

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
Marked as fixed on Wednesday, October 19th 2011, 10:29:02 pm

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
@edburns said:
I don't know what the difference between "close" and "resolve" is so I am doing both.

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
@arjantijms said:
Per commit 9755 and issues #719 and #809, ResourceResolver has been deprecated.

Perhaps it's a little confusing if a new annotation is introduced for something that is simultaneously deprecated?

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
This issue was imported from java.net JIRA JAVASERVERFACES_SPEC_PUBLIC-1038

@eclipse-faces-bot
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant