You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltaspike.apache.org by ta...@apache.org on 2014/04/16 16:36:09 UTC

git commit: DELTASPIKE-574 missing DeltaSpikeResource

Repository: deltaspike
Updated Branches:
  refs/heads/master 0a4bc446b -> 5060e439d


DELTASPIKE-574 missing DeltaSpikeResource

Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/5060e439
Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/5060e439
Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/5060e439

Branch: refs/heads/master
Commit: 5060e439d70a34f44c9c25cf466c0b97e85fa238
Parents: 0a4bc44
Author: tandraschko <ta...@apache.org>
Authored: Wed Apr 16 08:31:41 2014 +0200
Committer: tandraschko <ta...@apache.org>
Committed: Wed Apr 16 08:31:41 2014 +0200

----------------------------------------------------------------------
 .../jsf/impl/resource/DeltaSpikeResource.java   | 93 ++++++++++++++++++++
 1 file changed, 93 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltaspike/blob/5060e439/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/resource/DeltaSpikeResource.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/resource/DeltaSpikeResource.java b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/resource/DeltaSpikeResource.java
new file mode 100644
index 0000000..7519954
--- /dev/null
+++ b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/resource/DeltaSpikeResource.java
@@ -0,0 +1,93 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.deltaspike.jsf.impl.resource;
+
+import javax.faces.application.Resource;
+import javax.faces.application.ResourceWrapper;
+
+/**
+ * {@link ResourceWrapper} which appends the version of DeltaSpike to the URL.
+ */
+public class DeltaSpikeResource extends ResourceWrapper
+{
+
+    private final Resource wrapped;
+    private final String version;
+
+    public DeltaSpikeResource(Resource resource, String version)
+    {
+        super();
+        this.wrapped = resource;
+        this.version = version;
+    }
+
+    @Override
+    public Resource getWrapped()
+    {
+        return wrapped;
+    }
+
+    @Override
+    public String getRequestPath()
+    {
+        return super.getRequestPath() + "&v=" + version;
+    }
+
+    @Override
+    public String getContentType()
+    {
+        return getWrapped().getContentType();
+    }
+
+    @Override
+    public String getLibraryName()
+    {
+        return getWrapped().getLibraryName();
+    }
+
+    @Override
+    public String getResourceName()
+    {
+        return getWrapped().getResourceName();
+    }
+
+    @Override
+    public void setContentType(String contentType)
+    {
+        getWrapped().setContentType(contentType);
+    }
+
+    @Override
+    public void setLibraryName(String libraryName)
+    {
+        getWrapped().setLibraryName(libraryName);
+    }
+
+    @Override
+    public void setResourceName(String resourceName)
+    {
+        getWrapped().setResourceName(resourceName);
+    }
+
+    @Override
+    public String toString()
+    {
+        return getWrapped().toString();
+    }
+}