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

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

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

Request.body介绍

[英]Short version of body().to(type). HTTP body. Please don't use this method for form submits. This method is used for getting raw or a parsed data like json, xml, etc...
[中][$0$]的短版本。HTTP正文。请不要将此方法用于表单提交。此方法用于获取raw或json、xml等解析数据。。。

代码示例

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

  1. @Override
  2. public <T> T body(final Class<T> type) throws Exception {
  3. return req.body(type);
  4. }

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

  1. @Override
  2. public Mutant body() throws Exception {
  3. return req.body();
  4. }

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

  1. /**
  2. * Short version of <code>body().to(type)</code>.
  3. *
  4. * HTTP body. Please don't use this method for form submits. This method is used for getting
  5. * <code>raw</code> or a parsed data like json, xml, etc...
  6. *
  7. * @param type Object type.
  8. * @param <T> Value type.
  9. * @return Instance of object.
  10. * @throws Exception If body can't be converted or there is no HTTP body.
  11. */
  12. @Nonnull
  13. default <T> T body(final Class<T> type) throws Exception {
  14. return body().to(type);
  15. }

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

  1. @Override public String getRequestContent() {
  2. return Try.apply(() -> req.body().value()).get();
  3. }

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

  1. @Override
  2. public <T> T body(final Class<T> type) throws Exception {
  3. return req.body(type);
  4. }

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

  1. @Override
  2. public Mutant body() throws Exception {
  3. return req.body();
  4. }

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

  1. /**
  2. * Short version of <code>body().to(type)</code>.
  3. *
  4. * HTTP body. Please don't use this method for form submits. This method is used for getting
  5. * <code>raw</code> or a parsed data like json, xml, etc...
  6. *
  7. * @param type Object type.
  8. * @param <T> Value type.
  9. * @return Instance of object.
  10. * @throws Exception If body can't be converted or there is no HTTP body.
  11. */
  12. @Nonnull
  13. default <T> T body(final Class<T> type) throws Exception {
  14. return body().to(type);
  15. }

相关文章