通过wrapper修改slinghttpresponse
Modify slinghttpresponse through wrapper
我正在尝试覆盖 AEM 中的默认发送重定向功能。
我想从我的服务器重定向到 https 网址。
同样,我已经实现了一个吊索过滤器。实现了 SlingHttpServletResponseWrapper class 并覆盖了 sendredirect 函数。
然而,当我尝试
最终 SlingHttpServletResponse slingResponse = (ModifyLocResponse) 响应;
在运行时我得到
org.apache.sling.security.impl.ContentDispositionFilter$RewriterResponse 无法转换为 com.adobe.acs.samples.filters.wrappers.ModifyLocResponse
尝试通过如下方式实例化它:
final SlingHttpServletResponse slingResponse = new ModifyLocResponse(response);
当然,您需要确保 class 的构造函数也具有此模式:
class ModifyLocResponse extends SlingHttpServletResponseWrapper {
public ModifyLocResponse(SlingHttpServletResponse response) {
super(response);
}
...
}
我正在尝试覆盖 AEM 中的默认发送重定向功能。
我想从我的服务器重定向到 https 网址。
同样,我已经实现了一个吊索过滤器。实现了 SlingHttpServletResponseWrapper class 并覆盖了 sendredirect 函数。
然而,当我尝试
最终 SlingHttpServletResponse slingResponse = (ModifyLocResponse) 响应;
在运行时我得到
org.apache.sling.security.impl.ContentDispositionFilter$RewriterResponse 无法转换为 com.adobe.acs.samples.filters.wrappers.ModifyLocResponse
尝试通过如下方式实例化它:
final SlingHttpServletResponse slingResponse = new ModifyLocResponse(response);
当然,您需要确保 class 的构造函数也具有此模式:
class ModifyLocResponse extends SlingHttpServletResponseWrapper {
public ModifyLocResponse(SlingHttpServletResponse response) {
super(response);
}
...
}