Skip to content

Commit

Permalink
Fix the request processor by using the servlet request (which is alwa…
Browse files Browse the repository at this point in the history
…ys available, in contrast of sling servlet request)
  • Loading branch information
royteeuwen committed Oct 13, 2017
1 parent 7e98ba4 commit ce9748e
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@
import com.cognifide.slice.mapper.api.processor.FieldProcessor;
import com.google.inject.Inject;
import org.apache.commons.lang.StringUtils;
import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.api.resource.ValueMap;

import javax.servlet.ServletRequest;
import java.lang.reflect.Field;

public class RequestAttributeProcessor implements FieldProcessor {

@Inject
private SlingHttpServletRequest slingRequest;
private ServletRequest servletRequest;

@Override
public boolean accepts(final Resource resource, final Field field) {
Expand All @@ -42,7 +42,7 @@ public boolean accepts(final Resource resource, final Field field) {
@Override
public Object mapResourceToField(Resource resource, ValueMap valueMap, Field field, String propertyName) {
String attributeName = getAttributeName(field);
return slingRequest.getAttribute(attributeName);
return servletRequest.getAttribute(attributeName);
}

private String getAttributeName(Field field) {
Expand Down

0 comments on commit ce9748e

Please sign in to comment.