@Override public Map<String, Object> attributes() { return req.attributes(); }
@Override public Set<Entry<String, Object>> propertySet(final Object context) { if (context instanceof Request) { return ((Request) context).attributes().entrySet(); } return Collections.emptySet(); }
protected void handshake(final Request req, final Runnable handler) throws Exception { this.injector = req.require(Injector.class); this.renderers = ImmutableList.copyOf(injector.getInstance(Renderer.KEY)); this.produces = req.route().produces(); this.locals = req.attributes(); this.lastEventId = req.header("Last-Event-ID"); this.locale = req.locale(); handshake(handler); }
@Override public TemplateModel wrap(final Object obj) throws TemplateModelException { if (obj instanceof Config) { ConfigObject config = ((Config) obj).root(); return DefaultMapAdapter.adapt(config.unwrapped(), (ObjectWrapperWithAPISupport) wrapper); } if (obj instanceof Request) { Map<String, Object> req = ((Request) obj).attributes(); return DefaultMapAdapter.adapt(req, (ObjectWrapperWithAPISupport) wrapper); } if (obj instanceof Session) { Session session = (Session) obj; if (session.isDestroyed()) { return wrapper.wrap(null); } Map<String, String> hash = session.attributes(); return DefaultMapAdapter.adapt(hash, (ObjectWrapperWithAPISupport) wrapper); } return wrapper.wrap(obj); }
@Override public Map<String, Object> attributes() { return req.attributes(); }
@Override public Set<Entry<String, Object>> propertySet(final Object context) { if (context instanceof Request) { return ((Request) context).attributes().entrySet(); } return Collections.emptySet(); }
protected void handshake(final Request req, final Runnable handler) throws Exception { this.injector = req.require(Injector.class); this.renderers = ImmutableList.copyOf(injector.getInstance(Renderer.KEY)); this.produces = req.route().produces(); this.locals = req.attributes(); this.lastEventId = req.header("Last-Event-ID"); this.locale = req.locale(); handshake(handler); }
@Override public TemplateModel wrap(final Object obj) throws TemplateModelException { if (obj instanceof Config) { ConfigObject config = ((Config) obj).root(); return DefaultMapAdapter.adapt(config.unwrapped(), (ObjectWrapperWithAPISupport) wrapper); } if (obj instanceof Request) { Map<String, Object> req = ((Request) obj).attributes(); return DefaultMapAdapter.adapt(req, (ObjectWrapperWithAPISupport) wrapper); } if (obj instanceof Session) { Session session = (Session) obj; if (session.isDestroyed()) { return wrapper.wrap(null); } Map<String, String> hash = session.attributes(); return DefaultMapAdapter.adapt(hash, (ObjectWrapperWithAPISupport) wrapper); } return wrapper.wrap(obj); }