org.apache.juneau.http.annotation.Body类的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(6.2k)|赞(0)|评价(0)|浏览(247)

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

Body介绍

暂无

代码示例

代码示例来源:origin: org.apache.juneau/juneau-examples-rest

@RemoteMethod(method=POST, path="/user/createWithArray")
public Ok createUsers(
  @Body(
    description="List of user objects"
  )
  User[] users
) throws InvalidUsername, IdConflict, NotAcceptable, UnsupportedMediaType;

代码示例来源:origin: org.apache.juneau/juneau-marshall

/**
 * Returns <jk>true</jk> if the specified annotation contains all default values.
 *
 * @param a The annotation to check.
 * @return <jk>true</jk> if the specified annotation contains all default values.
 */
public static boolean empty(Body a) {
  if (a == null)
    return true;
  return
    allEmpty(a.description(), a.example(), a.examples(), a.api(), a.value())
    && allFalse(a.required())
    && empty(a.schema());
}

代码示例来源:origin: org.apache.juneau/juneau-marshall

HttpPartSchemaBuilder apply(Body a) {
  required(a.required());
  allowEmptyValue(! a.required());
  apply(a.schema());
  return this;
}

代码示例来源:origin: apache/juneau

HttpPartSchemaBuilder apply(Body a) {
  required(a.required());
  allowEmptyValue(! a.required());
  apply(a.schema());
  return this;
}

代码示例来源:origin: org.apache.juneau/juneau-examples-rest

@RemoteMethod(method=PUT, path="/pet/{petId}")
public Ok updatePet(
  @Body(
    description="Pet object that needs to be added to the store"
  ) UpdatePet pet
) throws IdNotFound, NotAcceptable, UnsupportedMediaType;

代码示例来源:origin: apache/juneau

/**
 * Returns <jk>true</jk> if the specified annotation contains all default values.
 *
 * @param a The annotation to check.
 * @return <jk>true</jk> if the specified annotation contains all default values.
 */
public static boolean empty(Body a) {
  if (a == null)
    return true;
  return
    allEmpty(a.description(), a.example(), a.examples(), a.api(), a.value())
    && allFalse(a.required())
    && empty(a.schema());
}

代码示例来源:origin: apache/juneau

HttpPartSchemaBuilder apply(Body a) {
  required(a.required());
  allowEmptyValue(! a.required());
  apply(a.schema());
  return this;
}

代码示例来源:origin: apache/juneau

@Body
  public static class B05 {
    private String s;
    public B05(Reader in) throws Exception { this.s = IOUtils.read(in); }
    @Override public String toString() { return s; }
  }
}

代码示例来源:origin: apache/juneau

/**
 * Returns <jk>true</jk> if the specified annotation contains all default values.
 *
 * @param a The annotation to check.
 * @return <jk>true</jk> if the specified annotation contains all default values.
 */
public static boolean empty(Body a) {
  if (a == null)
    return true;
  return
    allEmpty(a.description(), a.example(), a.examples(), a.api(), a.value())
    && allFalse(a.required())
    && empty(a.schema());
}

代码示例来源:origin: org.apache.juneau/juneau-examples-rest

@RemoteMethod /* method and path inferred from method name */
public long postPet(
  @Body(
    description="Pet object to add to the store"
  ) CreatePet pet
) throws IdConflict, NotAcceptable, UnsupportedMediaType;

代码示例来源:origin: apache/juneau

private ObjectMap merge(ObjectMap om, Body a) throws ParseException {
  if (empty(a))
    return om;
  om = newMap(om);
  if (a.value().length > 0)
    om.putAll(parseMap(a.value()));
  if (a.api().length > 0)
    om.putAll(parseMap(a.api()));
  return om
    .appendSkipEmpty("description", resolve(a.description()))
    .appendSkipEmpty("x-example", resolve(a.example()))
    .appendSkipEmpty("x-examples", parseMap(a.examples()))
    .appendSkipFalse("required", a.required())
    .appendSkipEmpty("schema", merge(om.getObjectMap("schema"), a.schema()))
  ;
}

代码示例来源:origin: org.apache.juneau/juneau-examples-rest

@RemoteMethod
public Ok postUser(
  @Body(
    description="Created user object"
  )
  User user
) throws InvalidUsername, IdConflict, NotAcceptable, UnsupportedMediaType;

代码示例来源:origin: org.apache.juneau/juneau-rest-server

private ObjectMap merge(ObjectMap om, Body a) throws ParseException {
  if (empty(a))
    return om;
  om = newMap(om);
  if (a.value().length > 0)
    om.putAll(parseMap(a.value()));
  if (a.api().length > 0)
    om.putAll(parseMap(a.api()));
  return om
    .appendSkipEmpty("description", resolve(a.description()))
    .appendSkipEmpty("x-example", resolve(a.example()))
    .appendSkipEmpty("x-examples", parseMap(a.examples()))
    .appendSkipFalse("required", a.required())
    .appendSkipEmpty("schema", merge(om.getObjectMap("schema"), a.schema()))
  ;
}

代码示例来源:origin: org.apache.juneau/juneau-examples-rest

@RestMethod(
    summary="Overwrite the JSON-Schema document",
    description="Replaces the schema document with the specified content, and then mirrors it as the response."
  )
  public JsonSchema put(@Body JsonSchema schema) throws Exception {
    this.schema = schema;
    return schema;
  }
}

代码示例来源:origin: apache/juneau

private ObjectMap merge(ObjectMap om, Body a) throws ParseException {
  if (empty(a))
    return om;
  om = newMap(om);
  if (a.value().length > 0)
    om.putAll(parseMap(a.value()));
  if (a.api().length > 0)
    om.putAll(parseMap(a.api()));
  return om
    .appendSkipEmpty("description", resolve(a.description()))
    .appendSkipEmpty("x-example", resolve(a.example()))
    .appendSkipEmpty("x-examples", parseMap(a.examples()))
    .appendSkipFalse("required", a.required())
    .appendSkipEmpty("schema", merge(om.getObjectMap("schema"), a.schema()))
  ;
}

代码示例来源:origin: org.apache.juneau/juneau-examples-rest

@RestMethod(
    summary="Overwrite the sample ATOM feed",
    description="Replaces the feed with the specified content, and then mirrors it as the response."
  )
  public Feed put(@Body Feed feed) throws Exception {
    this.feed = feed;
    return feed;
  }
}

代码示例来源:origin: apache/juneau

@RemoteMethod(method=PUT, path="/pet/{petId}")
public Ok updatePet(
  @Body(
    description="Pet object that needs to be added to the store"
  ) UpdatePet pet
) throws IdNotFound, NotAcceptable, UnsupportedMediaType;

代码示例来源:origin: apache/juneau

@Body
public static class B01 {
  private String val;
  public B01(String val) { this.val = val; }
  @Override public String toString() { return val; }
}
@RestMethod(name=PUT, path="/Bean")

代码示例来源:origin: apache/juneau

@Body
public static class B02 {
  public String f1;
}
@RestMethod(name=PUT, path="/BeanList")

代码示例来源:origin: apache/juneau

@Body({
  "description:'a\nb',",
  "required:true,",
  "schema:{type:'string'},",
  "x-example:'\\'a\\'',",
  "x-examples:{foo:'bar'}"
})
public static class SA02 {
  public SA02(String x) {}
}
@RestMethod

相关文章