ApiResourceUnwrapperRequestWrapper.java 1 KB
/*
 * Decompiled with CFR 0_118.
 * 
 * Could not load the following classes:
 *  org.apache.sling.api.SlingHttpServletRequest
 *  org.apache.sling.api.resource.Resource
 *  org.apache.sling.api.wrappers.SlingHttpServletRequestWrapper
 */
package com.adobe.granite.rest.impl.servlet;

import com.adobe.granite.rest.impl.ApiResourceWrapper;
import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.api.wrappers.SlingHttpServletRequestWrapper;

public class ApiResourceUnwrapperRequestWrapper
extends SlingHttpServletRequestWrapper {
    private Resource resource;

    public ApiResourceUnwrapperRequestWrapper(SlingHttpServletRequest wrappedRequest) {
        super(wrappedRequest);
        this.resource = wrappedRequest.getResource();
    }

    public Resource getResource() {
        if (this.resource instanceof ApiResourceWrapper) {
            return ((ApiResourceWrapper)this.resource).getResource();
        }
        return this.resource;
    }
}