/** * Sets the next Restlet after the inbound chain. * * @param next * The Restlet to process after the inbound chain. */ protected synchronized void setInboundNext(Restlet next) { if (getLastInboundFilter() != null) { getLastInboundFilter().setNext(next); } this.inboundNext = next; }
/** * Returns the next Restlet in the inbound chain. * * @return The next Restlet in the inbound chain. */ protected synchronized Restlet getInboundNext() { Restlet result = null; if (getLastInboundFilter() != null) { result = getLastInboundFilter().getNext(); } else { result = this.inboundNext; } return result; }
/** * Adds a new inbound filter to the chain. * * @param filter * The inbound filter to add. */ protected synchronized void addInboundFilter(Filter filter) { Restlet next = getInboundNext(); if (getFirstInboundFilter() == null) { setFirstInboundFilter(filter); } else if (getLastInboundFilter() != null) { getLastInboundFilter().setNext(filter); } setLastInboundFilter(filter); setInboundNext(next); }