org.jooby.Request.attributes()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(3.1k)|赞(0)|评价(0)|浏览(645)

本文整理了Java中org.jooby.Request.attributes方法的一些代码示例,展示了Request.attributes的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Request.attributes方法的具体详情如下:
包路径:org.jooby.Request
类名称:Request
方法名:attributes

Request.attributes介绍

[英]A read only version of the current locals.
[中]当前本地文件的只读版本。

代码示例

代码示例来源:origin: jooby-project/jooby

  1. @Override
  2. public Map<String, Object> attributes() {
  3. return req.attributes();
  4. }

代码示例来源:origin: jooby-project/jooby

  1. @Override
  2. public Set<Entry<String, Object>> propertySet(final Object context) {
  3. if (context instanceof Request) {
  4. return ((Request) context).attributes().entrySet();
  5. }
  6. return Collections.emptySet();
  7. }

代码示例来源:origin: jooby-project/jooby

  1. protected void handshake(final Request req, final Runnable handler) throws Exception {
  2. this.injector = req.require(Injector.class);
  3. this.renderers = ImmutableList.copyOf(injector.getInstance(Renderer.KEY));
  4. this.produces = req.route().produces();
  5. this.locals = req.attributes();
  6. this.lastEventId = req.header("Last-Event-ID");
  7. this.locale = req.locale();
  8. handshake(handler);
  9. }

代码示例来源:origin: jooby-project/jooby

  1. @Override
  2. public TemplateModel wrap(final Object obj) throws TemplateModelException {
  3. if (obj instanceof Config) {
  4. ConfigObject config = ((Config) obj).root();
  5. return DefaultMapAdapter.adapt(config.unwrapped(), (ObjectWrapperWithAPISupport) wrapper);
  6. }
  7. if (obj instanceof Request) {
  8. Map<String, Object> req = ((Request) obj).attributes();
  9. return DefaultMapAdapter.adapt(req, (ObjectWrapperWithAPISupport) wrapper);
  10. }
  11. if (obj instanceof Session) {
  12. Session session = (Session) obj;
  13. if (session.isDestroyed()) {
  14. return wrapper.wrap(null);
  15. }
  16. Map<String, String> hash = session.attributes();
  17. return DefaultMapAdapter.adapt(hash, (ObjectWrapperWithAPISupport) wrapper);
  18. }
  19. return wrapper.wrap(obj);
  20. }

代码示例来源:origin: org.jooby/jooby

  1. @Override
  2. public Map<String, Object> attributes() {
  3. return req.attributes();
  4. }

代码示例来源:origin: org.jooby/jooby-hbs

  1. @Override
  2. public Set<Entry<String, Object>> propertySet(final Object context) {
  3. if (context instanceof Request) {
  4. return ((Request) context).attributes().entrySet();
  5. }
  6. return Collections.emptySet();
  7. }

代码示例来源:origin: org.jooby/jooby

  1. protected void handshake(final Request req, final Runnable handler) throws Exception {
  2. this.injector = req.require(Injector.class);
  3. this.renderers = ImmutableList.copyOf(injector.getInstance(Renderer.KEY));
  4. this.produces = req.route().produces();
  5. this.locals = req.attributes();
  6. this.lastEventId = req.header("Last-Event-ID");
  7. this.locale = req.locale();
  8. handshake(handler);
  9. }

代码示例来源:origin: org.jooby/jooby-ftl

  1. @Override
  2. public TemplateModel wrap(final Object obj) throws TemplateModelException {
  3. if (obj instanceof Config) {
  4. ConfigObject config = ((Config) obj).root();
  5. return DefaultMapAdapter.adapt(config.unwrapped(), (ObjectWrapperWithAPISupport) wrapper);
  6. }
  7. if (obj instanceof Request) {
  8. Map<String, Object> req = ((Request) obj).attributes();
  9. return DefaultMapAdapter.adapt(req, (ObjectWrapperWithAPISupport) wrapper);
  10. }
  11. if (obj instanceof Session) {
  12. Session session = (Session) obj;
  13. if (session.isDestroyed()) {
  14. return wrapper.wrap(null);
  15. }
  16. Map<String, String> hash = session.attributes();
  17. return DefaultMapAdapter.adapt(hash, (ObjectWrapperWithAPISupport) wrapper);
  18. }
  19. return wrapper.wrap(obj);
  20. }

相关文章