@ -29,6 +29,7 @@ import java.util.Set;
@@ -29,6 +29,7 @@ import java.util.Set;
import javax.servlet.http.HttpServletRequest ;
import lombok.extern.apachecommons.CommonsLog ;
import org.apache.commons.io.IOUtils ;
import org.springframework.boot.actuate.trace.TraceRepository ;
import org.springframework.util.LinkedMultiValueMap ;
@ -37,10 +38,13 @@ import org.springframework.util.StringUtils;
@@ -37,10 +38,13 @@ import org.springframework.util.StringUtils;
import com.netflix.zuul.context.RequestContext ;
import com.netflix.zuul.util.HTTPRequestUtils ;
import org.springframework.web.util.UriUtils ;
import org.springframework.web.util.WebUtils ;
/ * *
* @author Dave Syer
* /
@CommonsLog
public class ProxyRequestHelper {
/ * *
@ -57,6 +61,20 @@ public class ProxyRequestHelper {
@@ -57,6 +61,20 @@ public class ProxyRequestHelper {
this . traces = traces ;
}
public String buildZuulRequestURI ( HttpServletRequest request ) {
RequestContext context = RequestContext . getCurrentContext ( ) ;
String uri = request . getRequestURI ( ) ;
String contextURI = ( String ) context . get ( "requestURI" ) ;
if ( contextURI ! = null ) {
try {
uri = UriUtils . encodePath ( contextURI , WebUtils . DEFAULT_CHARACTER_ENCODING ) ;
} catch ( Exception e ) {
log . debug ( "unable to encode uri path from context, falling back to uri from request" , e ) ;
}
}
return uri ;
}
public MultiValueMap < String , String > buildZuulRequestQueryParams (
HttpServletRequest request ) {
Map < String , List < String > > map = HTTPRequestUtils . getInstance ( ) . getQueryParams ( ) ;