/** * Constructor with a parent Restlet. */ public SpringRouter(Restlet parent) { super(parent.getContext()); }
@Override public Context getContext() { return wrappedRestlet.getContext(); }
@Override public Context getContext() { return wrappedRestlet.getContext(); }
/** * Returns the helped Restlet context. * * @return The helped Restlet context. */ public Context getContext() { return getHelped().getContext(); }
/** * Constructor. * * @param router * The parent router. * @param next * The next Restlet. */ public Route(Router router, Restlet next) { super((router != null) ? router.getContext() : (next != null) ? next .getContext() : null, next); this.router = router; }
/** * Returns the helped Restlet context. * * @return The helped Restlet context. */ public Context getContext() { return getHelped().getContext(); }
/** * Returns the helped Restlet logger. * * @return The helped Restlet logger. */ public Logger getLogger() { return (getHelped().getContext() != null) ? getHelped().getContext() .getLogger() : Context.getCurrentLogger(); }
/** * Sets the outbound root Restlet. * * @param outboundRoot * The outbound root Restlet. */ public synchronized void setOutboundRoot(Restlet outboundRoot) { this.outboundRoot = outboundRoot; if ((outboundRoot != null) && (outboundRoot.getContext() == null)) { outboundRoot.setContext(getContext()); } }
/** * Sets the next Restlet. * * In addition, this method will set the context of the next Restlet if it * is null by passing a reference to its own context. * * @param next * The next Restlet. */ public void setNext(Restlet next) { if ((next != null) && (next.getContext() == null)) { next.setContext(getContext()); } this.next = next; }
/** * Sets the inbound root Restlet. * * @param inboundRoot * The inbound root Restlet. */ public synchronized void setInboundRoot(Restlet inboundRoot) { this.inboundRoot = inboundRoot; if ((inboundRoot != null) && (inboundRoot.getContext() == null)) { inboundRoot.setContext(getContext()); } }
/** * Checks the context and sets it if necessary. * * @param target * The target Restlet. */ protected void checkContext(Restlet target) { if ((target.getContext() == null) && (this.parentContext != null)) { target.setContext(this.parentContext.createChildContext()); } }
/** * Returns the helped Restlet logger. * * @return The helped Restlet logger. */ public Logger getLogger() { if (getHelped() != null && getHelped().getContext() != null) { return getHelped().getContext().getLogger(); } return Context.getCurrentLogger(); }
/** * Returns the helped Restlet parameters. * * @return The helped Restlet parameters. */ public Series<Parameter> getHelpedParameters() { Series<Parameter> result = null; if ((getHelped() != null) && (getHelped().getContext() != null)) { result = getHelped().getContext().getParameters(); } else { result = new Form(); } return result; }
/** * Returns the helped Restlet parameters. * * @return The helped Restlet parameters. */ public Series<Parameter> getHelpedParameters() { Series<Parameter> result = null; if ((getHelped() != null) && (getHelped().getContext() != null)) { result = getHelped().getContext().getParameters(); } else { result = new Series<Parameter>(Parameter.class); } return result; }
@Override public Route attach(String uriPattern, Restlet target) { if (target.getContext() == null) { target .setContext(getContext() .createChildContext()); } return super.attach(uriPattern, target); }
@Override public TemplateRoute attach(Restlet target) { if (target.getContext() == null) { target.setContext(getContext().createChildContext()); } return super.attach(target); }
@Override public TemplateRoute attachDefault(Restlet defaultTarget) { if (defaultTarget.getContext() == null) { defaultTarget.setContext(getContext().createChildContext()); } return super.attachDefault(defaultTarget); }
@Override public Route attach(Restlet target) { if (target.getContext() == null) { target .setContext(getContext() .createChildContext()); } return super.attach(target); }
@Override public Route attachDefault(Restlet defaultTarget) { if (defaultTarget.getContext() == null) { defaultTarget.setContext(getContext() .createChildContext()); } return super.attachDefault(defaultTarget); }
@Override public TemplateRoute attach(String uriPattern, Restlet target) { if (target.getContext() == null) { target.setContext(getContext().createChildContext()); } return super.attach(uriPattern, target); }