More zuul constant and javadoc updates

parent 506a9a44
......@@ -56,6 +56,10 @@ import static org.springframework.cloud.netflix.zuul.filters.support.FilterConst
import static org.springframework.cloud.netflix.zuul.filters.support.FilterConstants.X_FORWARDED_PREFIX_HEADER;
import static org.springframework.cloud.netflix.zuul.filters.support.FilterConstants.X_FORWARDED_PROTO_HEADER;
/**
* Pre {@link ZuulFilter} that determines where and how to route based on the supplied {@link RouteLocator}.
* Also sets various proxy related headers for downstream requests.
*/
public class PreDecorationFilter extends ZuulFilter {
private static final Log log = LogFactory.getLog(PreDecorationFilter.class);
......
......@@ -18,7 +18,6 @@ package org.springframework.cloud.netflix.zuul.filters.pre;
import javax.servlet.http.HttpServletRequest;
import org.springframework.cloud.netflix.zuul.util.RequestUtils;
import org.springframework.web.servlet.DispatcherServlet;
import com.netflix.zuul.ZuulFilter;
......@@ -26,6 +25,7 @@ import com.netflix.zuul.context.RequestContext;
import com.netflix.zuul.http.HttpServletRequestWrapper;
import com.netflix.zuul.http.ZuulServlet;
import static org.springframework.cloud.netflix.zuul.filters.support.FilterConstants.IS_DISPATCHER_SERVLET_REQUEST_KEY;
import static org.springframework.cloud.netflix.zuul.filters.support.FilterConstants.PRE_TYPE;
import static org.springframework.cloud.netflix.zuul.filters.support.FilterConstants.SERVLET_DETECTION_FILTER_ORDER;
......@@ -67,9 +67,9 @@ public class ServletDetectionFilter extends ZuulFilter {
HttpServletRequest request = ctx.getRequest();
if (!(request instanceof HttpServletRequestWrapper)
&& isDispatcherServletRequest(request)) {
ctx.set(RequestUtils.IS_DISPATCHERSERVLETREQUEST, true);
ctx.set(IS_DISPATCHER_SERVLET_REQUEST_KEY, true);
} else {
ctx.set(RequestUtils.IS_DISPATCHERSERVLETREQUEST, false);
ctx.set(IS_DISPATCHER_SERVLET_REQUEST_KEY, false);
}
return null;
......
......@@ -17,11 +17,12 @@
package org.springframework.cloud.netflix.zuul.filters.support;
import com.netflix.zuul.ZuulFilter;
import org.springframework.cloud.netflix.zuul.filters.pre.DebugFilter;
import org.springframework.cloud.netflix.zuul.filters.pre.Servlet30WrapperFilter;
import org.springframework.cloud.netflix.zuul.filters.route.SendForwardFilter;
import com.netflix.zuul.ZuulFilter;
/**
* @author Spencer Gibb
*/
......@@ -30,6 +31,11 @@ public interface FilterConstants {
// KEY constants -----------------------------------
/**
* Zuul {@link com.netflix.zuul.context.RequestContext} key for use in {@link org.springframework.cloud.netflix.zuul.filters.pre.ServletDetectionFilter}
*/
String IS_DISPATCHER_SERVLET_REQUEST_KEY = "isDispatcherServletRequest";
/**
* Zuul {@link com.netflix.zuul.context.RequestContext} key for use in {@link org.springframework.cloud.netflix.zuul.filters.route.SendForwardFilter}
*/
String FORWARD_TO_KEY = "forward.to";
......
......@@ -2,12 +2,18 @@ package org.springframework.cloud.netflix.zuul.util;
import com.netflix.zuul.context.RequestContext;
import static org.springframework.cloud.netflix.zuul.filters.support.FilterConstants.IS_DISPATCHER_SERVLET_REQUEST_KEY;
public class RequestUtils {
public static final String IS_DISPATCHERSERVLETREQUEST = "isDispatcherServletRequest";
/**
* @deprecated use {@link org.springframework.cloud.netflix.zuul.filters.support.FilterConstants#IS_DISPATCHER_SERVLET_REQUEST_KEY}
*/
@Deprecated
public static final String IS_DISPATCHERSERVLETREQUEST = IS_DISPATCHER_SERVLET_REQUEST_KEY;
public static boolean isDispatcherServletRequest() {
return RequestContext.getCurrentContext().getBoolean(IS_DISPATCHERSERVLETREQUEST);
return RequestContext.getCurrentContext().getBoolean(IS_DISPATCHER_SERVLET_REQUEST_KEY);
}
public static boolean isZuulServletRequest() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment