Java Code Examples for com.netflix.zuul.context.RequestContext#getRequestQueryParams()
The following examples show how to use
com.netflix.zuul.context.RequestContext#getRequestQueryParams() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DecodePasswordFilter.java From pig with MIT License | 6 votes |
@Override public Object run() { RequestContext ctx = RequestContext.getCurrentContext(); Map<String, List<String>> params = ctx.getRequestQueryParams(); if (params == null) { return null; } List<String> passList = params.get(PASSWORD); if (CollUtil.isEmpty(passList)) { return null; } String password = passList.get(0); if (StrUtil.isNotBlank(password)) { try { password = decryptAES(password, key); } catch (Exception e) { log.error("密码解密失败:{}", password); } params.put(PASSWORD, CollUtil.newArrayList(password.trim())); } ctx.setRequestQueryParams(params); return null; }
Example 2
Source File: ConvertAuthTokenInUriToCookieFilter.java From api-layer with Eclipse Public License 2.0 | 6 votes |
public Object run() { RequestContext context = RequestContext.getCurrentContext(); AuthConfigurationProperties.CookieProperties cp = authConfigurationProperties.getCookieProperties(); if ((context.getRequestQueryParams() != null) && context.getRequestQueryParams().containsKey(cp.getCookieName())) { HttpServletResponse servletResponse = context.getResponse(); Cookie cookie = new Cookie(cp.getCookieName(), context.getRequestQueryParams().get(cp.getCookieName()).get(0)); cookie.setPath(cp.getCookiePath()); cookie.setSecure(true); cookie.setHttpOnly(true); cookie.setMaxAge(cp.getCookieMaxAge()); cookie.setComment(cp.getCookieComment()); servletResponse.addCookie(cookie); String url = context.getRequest().getRequestURL().toString(); String newUrl; if (url.endsWith("/apicatalog/")) { newUrl = url + "#/dashboard"; } else { newUrl = url; } context.addZuulResponseHeader("Location", newUrl); context.setResponseStatusCode(HttpServletResponse.SC_MOVED_TEMPORARILY); } return null; }
Example 3
Source File: CallImpl.java From heimdall with Apache License 2.0 | 6 votes |
@Override public void add(String name, String value) { if (value != null) { RequestContext context = RequestContext.getCurrentContext(); Map<String, List<String>> params = context.getRequestQueryParams(); if (params == null) { params = new ConcurrentHashMap<>(); } params.put(name, Arrays.asList(value)); context.setRequestQueryParams(params); } }
Example 4
Source File: PathExtractor.java From ServiceComb-Company-WorkShop with Apache License 2.0 | 5 votes |
String path(RequestContext context) { HttpServletRequest request = context.getRequest(); StringBuilder builder = new StringBuilder(); builder.append(request.getContextPath()).append(request.getServletPath()); if (request.getPathInfo() != null) { builder.append(request.getPathInfo()); } if (context.getRequestQueryParams() != null) { appendQueryParams(context, builder); } return builder.toString(); }
Example 5
Source File: AuthenticationFilter.java From DBus with Apache License 2.0 | 4 votes |
public void setParameter(RequestContext ctx, String key, String parameter) { if (ctx.getRequestQueryParams() == null) ctx.setRequestQueryParams(new HashMap<>()); ctx.getRequestQueryParams().put(key, Arrays.asList(parameter)); }
Example 6
Source File: CacheInterceptorService.java From heimdall with Apache License 2.0 | 3 votes |
private boolean shouldCache(RequestContext context, List<String> headers, List<String> queryParams) { Map<String, List<String>> requestQueryParams = (context.getRequestQueryParams() != null) ? context.getRequestQueryParams() : new HashMap<>(); boolean queries = Lists.newArrayList(requestQueryParams.keySet()).containsAll(queryParams); boolean header = (context.getRequest().getHeaderNames() != null) && Collections.list(context.getRequest().getHeaderNames()).containsAll(headers); return header && queries; }
Example 7
Source File: CallImpl.java From heimdall with Apache License 2.0 | 3 votes |
@Override public void remove(String name) { RequestContext context = RequestContext.getCurrentContext(); Map<String, List<String>> params = context.getRequestQueryParams(); if (params != null) { params.remove(name); } context.setRequestQueryParams(params); }