@Override public RequestType requestType() { return delegate.requestType(); }
public TraversingResponder(Executor executor, GlobalContext globalContext, ResourceRequest inReplyTo, ChannelHandlerContext ctx) { super(inReplyTo, ctx); this.executor = executor; this.currentResource = globalContext; this.plan = new TraversalPlan(inReplyTo.requestType(), inReplyTo.resourcePath()); }
private DefaultResourceRequest(ResourceRequest original) { this.requestType = original.requestType(); this.resourcePath = original.resourcePath(); this.requestId = original.requestId(); }
private List<Interceptor> getInterceptors(String chainName, ResourceRequest request) { List<Interceptor> result = new LinkedList<>(); List<InterceptorConfigEntry> chainConfigEntries = interceptorsConfig.get().getChainConfig(chainName); for (InterceptorConfigEntry configEntry : chainConfigEntries) { String interceptorName = configEntry.getInterceptorName(); Interceptor interceptor = interceptors.get(interceptorName); if (interceptor == null) { log.warnf("No interceptor under key '%s'", interceptorName); continue; } // Verify resourcePath matches if (configEntry.getResourcePathMapping() != null && request != null) { ResourcePath interceptorResPath = new ResourcePath(configEntry.getResourcePathMapping()); if (!interceptorResPath.isParentOf(request.resourcePath())) { continue; } } // Verify requestType matches if (configEntry.getRequestTypeMapping() != null && request != null) { if (!request.requestType().matches(configEntry.getRequestTypeMapping())) { continue; } } result.add(interceptor); } return result; }
if (request.requestType() != RequestType.CREATE && request.requestType() != RequestType.UPDATE) {
@Override public void onOutbound(OutboundInterceptorContext context) throws Exception { ResourceResponse response = context.response(); if (context.request().requestType() == RequestType.READ && response.responseType() == ResourceResponse.ResponseType.READ && response.state() != null) { ResourcePath resourcePath = new ResourcePath(response.resource().uri().toString()); SecurityContext securityContext = context.request().requestContext().securityContext(); // Process just members of response.state() and not the state itself as resource has been already authorized at onInbound processMembers(resourcePath, response.state(), securityContext, new Consumer<ResourceState>() { @Override public void accept(ResourceState authorizedState) { response.setState(authorizedState); context.forward(); } }); } else { super.onOutbound(context); } }