More zuul constant and javadoc updates

parent 506a9a44
...@@ -56,6 +56,10 @@ import static org.springframework.cloud.netflix.zuul.filters.support.FilterConst ...@@ -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_PREFIX_HEADER;
import static org.springframework.cloud.netflix.zuul.filters.support.FilterConstants.X_FORWARDED_PROTO_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 { public class PreDecorationFilter extends ZuulFilter {
private static final Log log = LogFactory.getLog(PreDecorationFilter.class); private static final Log log = LogFactory.getLog(PreDecorationFilter.class);
......
...@@ -18,7 +18,6 @@ package org.springframework.cloud.netflix.zuul.filters.pre; ...@@ -18,7 +18,6 @@ package org.springframework.cloud.netflix.zuul.filters.pre;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import org.springframework.cloud.netflix.zuul.util.RequestUtils;
import org.springframework.web.servlet.DispatcherServlet; import org.springframework.web.servlet.DispatcherServlet;
import com.netflix.zuul.ZuulFilter; import com.netflix.zuul.ZuulFilter;
...@@ -26,6 +25,7 @@ import com.netflix.zuul.context.RequestContext; ...@@ -26,6 +25,7 @@ import com.netflix.zuul.context.RequestContext;
import com.netflix.zuul.http.HttpServletRequestWrapper; import com.netflix.zuul.http.HttpServletRequestWrapper;
import com.netflix.zuul.http.ZuulServlet; 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.PRE_TYPE;
import static org.springframework.cloud.netflix.zuul.filters.support.FilterConstants.SERVLET_DETECTION_FILTER_ORDER; import static org.springframework.cloud.netflix.zuul.filters.support.FilterConstants.SERVLET_DETECTION_FILTER_ORDER;
...@@ -67,9 +67,9 @@ public class ServletDetectionFilter extends ZuulFilter { ...@@ -67,9 +67,9 @@ public class ServletDetectionFilter extends ZuulFilter {
HttpServletRequest request = ctx.getRequest(); HttpServletRequest request = ctx.getRequest();
if (!(request instanceof HttpServletRequestWrapper) if (!(request instanceof HttpServletRequestWrapper)
&& isDispatcherServletRequest(request)) { && isDispatcherServletRequest(request)) {
ctx.set(RequestUtils.IS_DISPATCHERSERVLETREQUEST, true); ctx.set(IS_DISPATCHER_SERVLET_REQUEST_KEY, true);
} else { } else {
ctx.set(RequestUtils.IS_DISPATCHERSERVLETREQUEST, false); ctx.set(IS_DISPATCHER_SERVLET_REQUEST_KEY, false);
} }
return null; return null;
......
...@@ -17,11 +17,12 @@ ...@@ -17,11 +17,12 @@
package org.springframework.cloud.netflix.zuul.filters.support; 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.DebugFilter;
import org.springframework.cloud.netflix.zuul.filters.pre.Servlet30WrapperFilter; import org.springframework.cloud.netflix.zuul.filters.pre.Servlet30WrapperFilter;
import org.springframework.cloud.netflix.zuul.filters.route.SendForwardFilter; import org.springframework.cloud.netflix.zuul.filters.route.SendForwardFilter;
import com.netflix.zuul.ZuulFilter;
/** /**
* @author Spencer Gibb * @author Spencer Gibb
*/ */
...@@ -30,6 +31,11 @@ public interface FilterConstants { ...@@ -30,6 +31,11 @@ public interface FilterConstants {
// KEY constants ----------------------------------- // 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} * 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"; String FORWARD_TO_KEY = "forward.to";
......
...@@ -2,12 +2,18 @@ package org.springframework.cloud.netflix.zuul.util; ...@@ -2,12 +2,18 @@ package org.springframework.cloud.netflix.zuul.util;
import com.netflix.zuul.context.RequestContext; 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 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() { public static boolean isDispatcherServletRequest() {
return RequestContext.getCurrentContext().getBoolean(IS_DISPATCHERSERVLETREQUEST); return RequestContext.getCurrentContext().getBoolean(IS_DISPATCHER_SERVLET_REQUEST_KEY);
} }
public static boolean isZuulServletRequest() { 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