Java Code Examples for com.netflix.zuul.context.RequestContext#containsKey()
The following examples show how to use
com.netflix.zuul.context.RequestContext#containsKey() .
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: SentinelEntryUtils.java From Sentinel-Dashboard-Nacos with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") static void tryExitFromCurrentContext() { RequestContext ctx = RequestContext.getCurrentContext(); if (ctx.containsKey(ZuulConstant.ZUUL_CTX_SENTINEL_ENTRIES_KEY)) { Deque<AsyncEntry> asyncEntries = (Deque<AsyncEntry>) ctx.get(ZuulConstant.ZUUL_CTX_SENTINEL_ENTRIES_KEY); AsyncEntry entry; while (!asyncEntries.isEmpty()) { entry = asyncEntries.pop(); entry.exit(); } ctx.remove(ZuulConstant.ZUUL_CTX_SENTINEL_ENTRIES_KEY); } ContextUtil.exit(); }
Example 2
Source File: SentinelEntryUtils.java From Sentinel-Dashboard-Nacos with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") static void tryTraceExceptionThenExitFromCurrentContext(Throwable t) { RequestContext ctx = RequestContext.getCurrentContext(); if (ctx.containsKey(ZuulConstant.ZUUL_CTX_SENTINEL_ENTRIES_KEY)) { Deque<AsyncEntry> asyncEntries = (Deque<AsyncEntry>) ctx.get(ZuulConstant.ZUUL_CTX_SENTINEL_ENTRIES_KEY); AsyncEntry entry; while (!asyncEntries.isEmpty()) { entry = asyncEntries.pop(); Tracer.traceEntry(t, entry); entry.exit(); } ctx.remove(ZuulConstant.ZUUL_CTX_SENTINEL_ENTRIES_KEY); } ContextUtil.exit(); }
Example 3
Source File: SentinelEntryUtils.java From Sentinel with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") static void tryExitFromCurrentContext() { RequestContext ctx = RequestContext.getCurrentContext(); if (ctx.containsKey(ZuulConstant.ZUUL_CTX_SENTINEL_ENTRIES_KEY)) { Deque<EntryHolder> holders = (Deque<EntryHolder>) ctx.get(ZuulConstant.ZUUL_CTX_SENTINEL_ENTRIES_KEY); EntryHolder holder; while (!holders.isEmpty()) { holder = holders.pop(); exit(holder); } ctx.remove(ZuulConstant.ZUUL_CTX_SENTINEL_ENTRIES_KEY); } ContextUtil.exit(); }
Example 4
Source File: SentinelEntryUtils.java From Sentinel with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") static void tryTraceExceptionThenExitFromCurrentContext(Throwable t) { RequestContext ctx = RequestContext.getCurrentContext(); if (ctx.containsKey(ZuulConstant.ZUUL_CTX_SENTINEL_ENTRIES_KEY)) { Deque<EntryHolder> holders = (Deque<EntryHolder>) ctx.get(ZuulConstant.ZUUL_CTX_SENTINEL_ENTRIES_KEY); EntryHolder holder; while (!holders.isEmpty()) { holder = holders.pop(); Tracer.traceEntry(t, holder.getEntry()); exit(holder); } ctx.remove(ZuulConstant.ZUUL_CTX_SENTINEL_ENTRIES_KEY); } ContextUtil.exit(); }
Example 5
Source File: PostFilter.java From mini-platform with MIT License | 5 votes |
@Override public Object run() { RequestContext ctx = RequestContext.getCurrentContext(); HttpServletRequest request = ctx.getRequest(); log.debug("------------------->post"); log.debug("------------------->post:request:{}",request.getRequestURI()); //如果出错,Zuul默认的 SendErrorFilter 会添加key并转发到/error请求路径 if (ctx.containsKey("javax.servlet.error.status_code")){ log.error("error.status_code:"+ctx.get("javax.servlet.error.status_code").toString()); } return null; }
Example 6
Source File: ErrorFilter.java From oneplatform with Apache License 2.0 | 4 votes |
@Override public boolean shouldFilter() { RequestContext ctx = RequestContext.getCurrentContext(); return ctx.containsKey(ERROR_STATUS_CODE_KEY); }
Example 7
Source File: RewritePathFilter.java From skywalking with Apache License 2.0 | 4 votes |
@Override public boolean shouldFilter() { RequestContext ctx = RequestContext.getCurrentContext(); return ctx.containsKey(REQUEST_URI); }