Author: nbelaevski
Date: 2010-12-15 08:32:31 -0500 (Wed, 15 Dec 2010)
New Revision: 20579
Modified:
trunk/core/api/src/main/java/org/richfaces/resource/ResourceFactory.java
trunk/core/impl/src/main/java/org/richfaces/resource/ResourceFactoryImpl.java
trunk/ui/core/ui/src/main/java/org/richfaces/component/AbstractMediaOutput.java
trunk/ui/core/ui/src/main/java/org/richfaces/resource/MediaOutputResource.java
Log:
https://issues.jboss.org/browse/RF-10008
Modified: trunk/core/api/src/main/java/org/richfaces/resource/ResourceFactory.java
===================================================================
--- trunk/core/api/src/main/java/org/richfaces/resource/ResourceFactory.java 2010-12-15
13:04:17 UTC (rev 20578)
+++ trunk/core/api/src/main/java/org/richfaces/resource/ResourceFactory.java 2010-12-15
13:32:31 UTC (rev 20579)
@@ -44,8 +44,4 @@
public abstract Resource createResource(FacesContext context, ResourceRequestData
resourceData);
- public abstract Resource createResource(UserResource resource);
-
- public abstract Resource createResource(Java2DUserResource resource);
-
}
Modified: trunk/core/impl/src/main/java/org/richfaces/resource/ResourceFactoryImpl.java
===================================================================
---
trunk/core/impl/src/main/java/org/richfaces/resource/ResourceFactoryImpl.java 2010-12-15
13:04:17 UTC (rev 20578)
+++
trunk/core/impl/src/main/java/org/richfaces/resource/ResourceFactoryImpl.java 2010-12-15
13:32:31 UTC (rev 20579)
@@ -476,7 +476,7 @@
return Collections.unmodifiableSet(mappedResourceDataMap.keySet());
}
- public Resource createResource(Java2DUserResource resource) {
+ protected Resource createResource(Java2DUserResource resource) {
boolean cacheable = isCacheableSet(resource.getClass());
boolean versioned = isVersionedSet(resource.getClass());
@@ -488,7 +488,7 @@
}
}
- public Resource createResource(UserResource resource) {
+ protected Resource createResource(UserResource resource) {
boolean cacheable = isCacheableSet(resource.getClass());
boolean versioned = isVersionedSet(resource.getClass());
Modified: trunk/ui/core/ui/src/main/java/org/richfaces/component/AbstractMediaOutput.java
===================================================================
---
trunk/ui/core/ui/src/main/java/org/richfaces/component/AbstractMediaOutput.java 2010-12-15
13:04:17 UTC (rev 20578)
+++
trunk/ui/core/ui/src/main/java/org/richfaces/component/AbstractMediaOutput.java 2010-12-15
13:32:31 UTC (rev 20579)
@@ -28,11 +28,11 @@
import javax.el.MethodExpression;
import javax.faces.application.Resource;
+import javax.faces.application.ResourceHandler;
import javax.faces.component.UIOutput;
import javax.faces.el.MethodBinding;
import org.ajax4jsf.resource.ResourceComponent2;
-import org.richfaces.application.ServiceTracker;
import org.richfaces.cdk.annotations.Attribute;
import org.richfaces.cdk.annotations.EventName;
import org.richfaces.cdk.annotations.JsfComponent;
@@ -41,7 +41,6 @@
import org.richfaces.cdk.annotations.Tag;
import org.richfaces.cdk.annotations.TagType;
import org.richfaces.resource.MediaOutputResource;
-import org.richfaces.resource.ResourceFactory;
/**
* @author shura
@@ -119,12 +118,8 @@
}
public Resource getResource() {
- ResourceFactory factory = ServiceTracker.getService(ResourceFactory.class);
-
- MediaOutputResource mediaOutputResource = new MediaOutputResource();
- mediaOutputResource.initialize(this);
-
- return factory.createResource(mediaOutputResource);
+ ResourceHandler resourceHandler =
getFacesContext().getApplication().getResourceHandler();
+ return resourceHandler.createResource(MediaOutputResource.class.getName());
}
@Attribute
Modified: trunk/ui/core/ui/src/main/java/org/richfaces/resource/MediaOutputResource.java
===================================================================
---
trunk/ui/core/ui/src/main/java/org/richfaces/resource/MediaOutputResource.java 2010-12-15
13:04:17 UTC (rev 20578)
+++
trunk/ui/core/ui/src/main/java/org/richfaces/resource/MediaOutputResource.java 2010-12-15
13:32:31 UTC (rev 20579)
@@ -30,6 +30,7 @@
import javax.el.MethodExpression;
import javax.el.ValueExpression;
import javax.faces.component.StateHolder;
+import javax.faces.component.UIComponent;
import javax.faces.component.UIComponentBase;
import javax.faces.context.FacesContext;
@@ -98,7 +99,9 @@
*/
// TODO use ResourceComponent or exchange object as argument?
- public void initialize(AbstractMediaOutput uiMediaOutput) {
+ @PostConstructResource
+ public void initialize() {
+ AbstractMediaOutput uiMediaOutput = (AbstractMediaOutput)
UIComponent.getCurrentComponent(FacesContext.getCurrentInstance());
this.setCacheable(uiMediaOutput.isCacheable());
this.setContentType(uiMediaOutput.getMimeType());
this.userData = uiMediaOutput.getValue();