io.micronaut.http.annotation.Get.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(5.3k)|赞(0)|评价(0)|浏览(147)

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

Get.<init>介绍

暂无

代码示例

代码示例来源:origin: micronaut-projects/micronaut-core

/**
 * @return The current leader address
 */
@Get(uri = "/status/leader", single = true)
Publisher<String> status();

代码示例来源:origin: micronaut-projects/micronaut-core

/**
 * Reads a Key from Consul. See https://www.consul.io/api/kv.html.
 *
 * @param key The key to read
 * @return A {@link Publisher} that emits a list of {@link KeyValue}
 */
@Get(uri = "/kv/{+key}?recurse", single = true)
Publisher<List<KeyValue>> readValues(String key);

代码示例来源:origin: micronaut-projects/micronaut-core

/**
 * Gets all of the registered services.
 *
 * @return The {@link NewServiceEntry} instances
 */
@Get(uri = "/agent/services", single = true)
Publisher<Map<String, ServiceEntry>> getServices();

代码示例来源:origin: micronaut-projects/micronaut-core

/**
 * Gets all of the service names and optional tags.
 *
 * @return A Map where the keys are service names and the values are service tags
 */
@Get(uri = "/catalog/services", single = true)
Publisher<Map<String, List<String>>> getServiceNames();

代码示例来源:origin: micronaut-projects/micronaut-core

/**
 * Returns the configuration and member information of the local agent.
 *
 * @return the {@link LocalAgentConfiguration} instance
 */
@Get(uri = "/agent/self", single = true)
Publisher<LocalAgentConfiguration> getSelf();

代码示例来源:origin: micronaut-projects/micronaut-core

/**
 * Gets all the nodes for the given data center.
 *
 * @param datacenter The data center
 * @return A publisher that emits the nodes
 */
@Get(uri = "/catalog/nodes?dc={datacenter}", single = true)
Publisher<List<CatalogEntry>> getNodes(@NotNull String datacenter);

代码示例来源:origin: micronaut-projects/micronaut-core

/**
 * @return A {@link Publisher} with applications info.
 */
@SuppressWarnings("WeakerAccess")
@Get("/apps")
@Produces(single = true)
public abstract Publisher<ApplicationInfos> getApplicationInfosInternal();

代码示例来源:origin: micronaut-projects/micronaut-core

/**
 * Obtain a {@link ApplicationInfo} for the given app id.
 *
 * @param appId The app id
 * @return The {@link ApplicationInfo} instance
 */
@Get(uri = "/apps/{appId}", single = true)
Publisher<ApplicationInfo> getApplicationInfo(@NotBlank String appId);

代码示例来源:origin: micronaut-projects/micronaut-core

@Get("/list")
String list(List<Integer> values) {
  assert values.stream().allMatch(val -> val instanceof Integer);
  return "Parameter Value: " + values;
}

代码示例来源:origin: micronaut-projects/micronaut-core

/**
 * Obtain a {@link InstanceInfo} for the given app id.
 *
 * @param appId      The app id
 * @param instanceId The instance id (this is the value of {@link InstanceInfo#getId()})
 * @return The {@link InstanceInfo} instance
 */
@Get(uri = "/apps/{appId}/{instanceId}", single = true)
Publisher<InstanceInfo> getInstanceInfo(@NotBlank String appId, @NotBlank String instanceId);

代码示例来源:origin: micronaut-projects/micronaut-core

@Get("/optional-list")
  String optionalList(Optional<List<Integer>> values) {
    if (values.isPresent()) {
      assert values.get().stream().allMatch(val -> val instanceof Integer);
      return "Parameter Value: " + values.get();
    } else {
      return "Parameter Value: none";
    }
  }
}

代码示例来源:origin: micronaut-projects/micronaut-core

@Get
  public HttpResponse index(String username) {
    return HttpResponse.ok("Authenticated: " + username);
  }
}

代码示例来源:origin: micronaut-projects/micronaut-core

@Get("/greet/{name}")
Message greet(String name) {
  return new Message("Hello " + name);
}
// end::json[]

代码示例来源:origin: micronaut-projects/micronaut-core

@Get("/maybestock/{isbn}")
  public Maybe<Map> maybestock(String isbn) {
    return Maybe.empty(); //<2>
  }
}

代码示例来源:origin: micronaut-projects/micronaut-core

@Status(HttpStatus.CREATED)
@Get(produces = MediaType.TEXT_PLAIN)
public String index() {
  return "success";
}
//end::atstatus[]

代码示例来源:origin: micronaut-projects/micronaut-core

@Produces(MediaType.TEXT_PLAIN)
  @Get("/stock/{isbn}")
  Integer stock(String isbn) {
    throw new OutOfStockException();
  }
}

代码示例来源:origin: micronaut-projects/micronaut-core

@Produces(MediaType.TEXT_PLAIN)
  @Get("/stock/{isbn}")
  Integer stock(String isbn) {
    throw new OutOfStockException();
  }
}

代码示例来源:origin: micronaut-projects/micronaut-core

@Get("/custom-headers")
  public HttpResponse customHeaders() {
    return HttpResponse.ok("abc").contentType("text/plain").contentLength(7);
  }
}

代码示例来源:origin: micronaut-projects/micronaut-core

@Get("/{name}")
  public HttpResponse<Pet> get(String name, @Header("X-Pet-Client") String clientId) {
    Pet pet = new Pet();
    pet.setName(name);
    pet.setAge(Integer.valueOf(clientId));
    return HttpResponse.ok(pet)
              .header("X-Pet-Client", clientId);
  }
}

代码示例来源:origin: micronaut-projects/micronaut-core

@Get(value = "/headlines", produces = MediaType.TEXT_EVENT_STREAM) // <1>
Flux<Event<Headline>> streamHeadlines() {
  return Flux.<Event<Headline>>create((emitter) -> {  // <2>
    Headline headline = new Headline();
    headline.setText("Latest Headline at " + ZonedDateTime.now());
    emitter.next(Event.of(headline));
    emitter.complete();
  }).repeat(100) // <3>
   .delayElements(Duration.ofSeconds(1)); // <4>
}
// end::streaming[]

相关文章