/** * This method may be invoked by user code to notify interceptors that a nested * operation is being invoked which is denoted by this request details. */ public void notifyIncomingRequestPreHandled(RestOperationTypeEnum theOperationType) { RequestDetails requestDetails = getRequestDetails(); if (requestDetails == null) { return; } IRestfulServerDefaults server = requestDetails.getServer(); if (server == null) { return; } List<IServerInterceptor> interceptors = server.getInterceptors(); for (IServerInterceptor next : interceptors) { next.incomingRequestPreHandled(theOperationType, this); } }
protected final Object invokeServerMethod(IRestfulServer<?> theServer, RequestDetails theRequest, Object[] theMethodParams) { // Handle server action interceptors RestOperationTypeEnum operationType = getRestOperationType(theRequest); if (operationType != null) { for (IServerInterceptor next : theServer.getInterceptors()) { ActionRequestDetails details = new ActionRequestDetails(theRequest); populateActionRequestDetailsForInterceptor(theRequest, details, theMethodParams); next.incomingRequestPreHandled(operationType, details); } } // Actually invoke the method try { Method method = getMethod(); return method.invoke(getProvider(), theMethodParams); } catch (InvocationTargetException e) { if (e.getCause() instanceof BaseServerResponseException) { throw (BaseServerResponseException) e.getCause(); } throw new InternalErrorException("Failed to call access method: " + e.getCause(), e); } catch (Exception e) { throw new InternalErrorException("Failed to call access method: " + e.getCause(), e); } }
public void notifyInterceptors(RestOperationTypeEnum theOperationType, ActionRequestDetails theRequestDetails) { if (theRequestDetails.getId() != null && theRequestDetails.getId().hasResourceType() && isNotBlank(theRequestDetails.getResourceType())) { if (theRequestDetails.getId().getResourceType().equals(theRequestDetails.getResourceType()) == false) { throw new InternalErrorException( "Inconsistent server state - Resource types don't match: " + theRequestDetails.getId().getResourceType() + " / " + theRequestDetails.getResourceType()); } } if (theRequestDetails.getUserData().get(PROCESSING_SUB_REQUEST) == Boolean.TRUE) { theRequestDetails.notifyIncomingRequestPreHandled(theOperationType); } List<IServerInterceptor> interceptors = getConfig().getInterceptors(); for (IServerInterceptor next : interceptors) { next.incomingRequestPreHandled(theOperationType, theRequestDetails); } }
/** * This method may be invoked by user code to notify interceptors that a nested * operation is being invoked which is denoted by this request details. */ public void notifyIncomingRequestPreHandled(RestOperationTypeEnum theOperationType) { RequestDetails requestDetails = getRequestDetails(); if (requestDetails == null) { return; } IRestfulServerDefaults server = requestDetails.getServer(); if (server == null) { return; } List<IServerInterceptor> interceptors = server.getInterceptors(); for (IServerInterceptor next : interceptors) { next.incomingRequestPreHandled(theOperationType, this); } }
protected final Object invokeServerMethod(IRestfulServer<?> theServer, RequestDetails theRequest, Object[] theMethodParams) { // Handle server action interceptors RestOperationTypeEnum operationType = getRestOperationType(theRequest); if (operationType != null) { for (IServerInterceptor next : theServer.getInterceptors()) { ActionRequestDetails details = new ActionRequestDetails(theRequest); populateActionRequestDetailsForInterceptor(theRequest, details, theMethodParams); next.incomingRequestPreHandled(operationType, details); } } // Actually invoke the method try { Method method = getMethod(); return method.invoke(getProvider(), theMethodParams); } catch (InvocationTargetException e) { if (e.getCause() instanceof BaseServerResponseException) { throw (BaseServerResponseException) e.getCause(); } throw new InternalErrorException("Failed to call access method: " + e.getCause(), e); } catch (Exception e) { throw new InternalErrorException("Failed to call access method: " + e.getCause(), e); } }
public void notifyInterceptors(RestOperationTypeEnum theOperationType, ActionRequestDetails theRequestDetails) { if (theRequestDetails.getId() != null && theRequestDetails.getId().hasResourceType() && isNotBlank(theRequestDetails.getResourceType())) { if (theRequestDetails.getId().getResourceType().equals(theRequestDetails.getResourceType()) == false) { throw new InternalErrorException( "Inconsistent server state - Resource types don't match: " + theRequestDetails.getId().getResourceType() + " / " + theRequestDetails.getResourceType()); } } if (theRequestDetails.getUserData().get(PROCESSING_SUB_REQUEST) == Boolean.TRUE) { theRequestDetails.notifyIncomingRequestPreHandled(theOperationType); } List<IServerInterceptor> interceptors = getConfig().getInterceptors(); for (IServerInterceptor next : interceptors) { next.incomingRequestPreHandled(theOperationType, theRequestDetails); } }