You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by GitBox <gi...@apache.org> on 2018/09/12 08:43:02 UTC
[GitHub] luckslovez closed pull request #8:
feature/resource-path-injector-look-for-query-string-param
luckslovez closed pull request #8: feature/resource-path-injector-look-for-query-string-param
URL: https://github.com/apache/sling-org-apache-sling-models-impl/pull/8
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/src/main/java/org/apache/sling/models/impl/injectors/ResourcePathInjector.java b/src/main/java/org/apache/sling/models/impl/injectors/ResourcePathInjector.java
index ea4a480..b69383e 100644
--- a/src/main/java/org/apache/sling/models/impl/injectors/ResourcePathInjector.java
+++ b/src/main/java/org/apache/sling/models/impl/injectors/ResourcePathInjector.java
@@ -28,6 +28,7 @@
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Property;
import org.apache.felix.scr.annotations.Service;
+import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.api.resource.ResourceResolver;
import org.apache.sling.api.resource.ValueMap;
@@ -75,6 +76,12 @@ public Object getValue(@NotNull Object adaptable, String name, @NotNull Type dec
if (map != null) {
resourcePaths = map.get(name, String[].class);
}
+ // try the request params
+ SlingHttpServletRequest request = null;
+ if (adaptable instanceof SlingHttpServletRequest) {
+ request = (SlingHttpServletRequest) adaptable;
+ resourcePaths = new String[]{request.getParameter(name)};
+ }
}
if (ArrayUtils.isEmpty(resourcePaths)) {
// could not find a path to inject
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services