通道处理器的默认行为是执行sendRedirect(使用302代码临时重定向).我需要更改此行为,以便执行永久(301)重定向而不是302重定向.我试着做以下事情:
通过扩展ChannelProcessingFilter创建自定义ChannelProcessingFilter:
public class MyChannelProcessingFilter extends ChannelProcessingFilter{
//No implementation, I needed this to just make sure that a custom filter is created and I can configure it as a custom filter in the xml file.
}
Run Code Online (Sandbox Code Playgroud)通过扩展AbstractRetryEntryPoint创建自定义EntryPoint
public class RetryWithHttpsEntryPoint extends org.springframework.security.web.access.channel.AbstractRetryEntryPoint {
private PortResolver portResolver = new PortResolverImpl();
private final String scheme ="https://";
/** The standard port for the scheme (80 for http, 443 for https) */
private final int standardPort = 443;
public RetryWithHttpsEntryPoint() {
super("https://", 443);
} …Run Code Online (Sandbox Code Playgroud)