本文整理了Java中javax.ws.rs.core.Response.ok
方法的一些代码示例,展示了Response.ok
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Response.ok
方法的具体详情如下:
包路径:javax.ws.rs.core.Response
类名称:Response
方法名:ok
[英]Create a new ResponseBuilder with an OK status.
[中]创建一个状态为OK的新ResponseBuilder。
代码示例来源:origin: prestodb/presto
@GET
@Path("coordinator")
@Produces(TEXT_PLAIN)
public Response getServerCoordinator()
{
if (coordinator) {
return Response.ok().build();
}
// return 404 to allow load balancers to only send traffic to the coordinator
return Response.status(Response.Status.NOT_FOUND).build();
}
}
代码示例来源:origin: apache/incubator-druid
@GET
@Produces(MediaType.APPLICATION_JSON)
public Response getMap()
{
return Response.ok(map).build();
}
}
代码示例来源:origin: prestodb/presto
@GET
@Path("memory")
public Response getClusterMemoryPoolInfo()
{
return Response.ok()
.entity(clusterMemoryManager.getMemoryPoolInfo())
.build();
}
代码示例来源:origin: apache/incubator-druid
@POST
@Path("/terminateAll")
@Produces(MediaType.APPLICATION_JSON)
public Response terminateAll()
{
return asLeaderWithSupervisorManager(
manager -> {
manager.stopAndRemoveAllSupervisors();
return Response.ok(ImmutableMap.of("status", "success")).build();
}
);
}
代码示例来源:origin: apache/incubator-druid
@POST
@Path("/{dataSourceName}")
@Consumes(MediaType.APPLICATION_JSON)
@ResourceFilters(DatasourceResourceFilter.class)
public Response enableDataSource(
@PathParam("dataSourceName") final String dataSourceName
)
{
if (!databaseSegmentManager.enableDataSource(dataSourceName)) {
return Response.noContent().build();
}
return Response.ok().build();
}
代码示例来源:origin: Graylog2/graylog2-server
@POST
@RequiresPermissions(SidecarRestPermissions.CONFIGURATIONS_CREATE)
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value = "Create new configuration variable")
@AuditEvent(type = SidecarAuditEventTypes.CONFIGURATION_VARIABLE_CREATE)
public Response createConfigurationVariable(@ApiParam(name = "JSON body", required = true)
@Valid @NotNull ConfigurationVariable request) {
ValidationResult validationResult = validateConfigurationVariableHelper(request);
if (validationResult.failed()) {
return Response.status(Response.Status.BAD_REQUEST).entity(validationResult).build();
}
final ConfigurationVariable configurationVariable = persistConfigurationVariable(null, request);
return Response.ok().entity(configurationVariable).build();
}
代码示例来源:origin: apache/incubator-druid
@Override
public Response apply(TaskQueue taskQueue)
{
final List<TaskInfo<Task, TaskStatus>> tasks = taskStorageQueryAdapter.getActiveTaskInfo(dataSource);
if (tasks.isEmpty()) {
return Response.status(Status.NOT_FOUND).build();
} else {
for (final TaskInfo<Task, TaskStatus> task : tasks) {
taskQueue.shutdown(task.getId(), "Shutdown request from user");
}
return Response.ok(ImmutableMap.of("dataSource", dataSource)).build();
}
}
}
代码示例来源:origin: apache/incubator-druid
@GET
@Path("/keys")
@Produces(MediaType.APPLICATION_JSON)
public Response getKeys()
{
return Response.ok(map.keySet().toString()).build();
}
代码示例来源:origin: apache/incubator-druid
@GET
@Produces(MediaType.APPLICATION_JSON)
public Response getCompactConfig()
{
return Response.ok(CoordinatorCompactionConfig.current(manager)).build();
}
代码示例来源:origin: apache/incubator-druid
@DELETE
@Path("{resource}")
@Produces(MediaType.APPLICATION_JSON)
public Response delete()
{
return Response.ok(DEFAULT_RESPONSE_CONTENT).build();
}
代码示例来源:origin: prestodb/presto
@GET
@Path("workerMemory")
public Response getWorkerMemoryInfo()
{
return Response.ok()
.entity(clusterMemoryManager.getWorkerMemoryInfo())
.build();
}
代码示例来源:origin: apache/incubator-druid
@DELETE
@Path("/{dataSourceName}/segments/{segmentId}")
@ResourceFilters(DatasourceResourceFilter.class)
public Response deleteDatasourceSegment(
@PathParam("dataSourceName") String dataSourceName,
@PathParam("segmentId") String segmentId
)
{
if (databaseSegmentManager.removeSegment(dataSourceName, segmentId)) {
return Response.ok().build();
}
return Response.noContent().build();
}
代码示例来源:origin: apache/incubator-druid
@Override
public final Response handleGET(String id)
{
try {
final Object returnObj = get(id);
if (returnObj == null) {
return Response.status(Response.Status.NOT_FOUND).build();
} else {
return Response.ok(returnObj).build();
}
}
catch (Exception e) {
LOG.error(e, "Error handling get request for [%s]", id);
return Response.serverError().entity(ServletResourceUtils.sanitizeException(e)).build();
}
}
代码示例来源:origin: apache/incubator-druid
@GET
@Path("/values")
@Produces(MediaType.APPLICATION_JSON)
public Response getValues()
{
return Response.ok(map.values().toString()).build();
}
代码示例来源:origin: apache/incubator-druid
@GET
@Produces(MediaType.APPLICATION_JSON)
public Response getDynamicConfigs()
{
return Response.ok(CoordinatorDynamicConfig.current(manager)).build();
}
代码示例来源:origin: apache/incubator-druid
@POST
@Path("/direct")
@Produces(MediaType.APPLICATION_JSON)
public Response direct(String input)
{
if ("hello".equals(input)) {
return Response.ok("hello").build();
} else {
return Response.serverError().build();
}
}
代码示例来源:origin: Netflix/eureka
@GET
@Path("statusoverrides")
public Response getOverrides() throws Exception {
Map<String, InstanceInfo.InstanceStatus> result = registry.overriddenInstanceStatusesSnapshot();
ObjectMapper objectMapper = new ObjectMapper();
String responseStr = objectMapper.writeValueAsString(result);
return Response.ok(responseStr).build();
}
}
代码示例来源:origin: apache/incubator-druid
@POST
@Path("/{dataSourceName}/segments/{segmentId}")
@Consumes(MediaType.APPLICATION_JSON)
@ResourceFilters(DatasourceResourceFilter.class)
public Response enableDatasourceSegment(
@PathParam("dataSourceName") String dataSourceName,
@PathParam("segmentId") String segmentId
)
{
if (!databaseSegmentManager.enableSegment(segmentId)) {
return Response.noContent().build();
}
return Response.ok().build();
}
代码示例来源:origin: apache/incubator-druid
@GET
@Path("/loadstatus")
@Produces(MediaType.APPLICATION_JSON)
public Response getLoadStatus()
{
return Response.ok(ImmutableMap.of("cacheInitialized", coordinator.isStarted())).build();
}
代码示例来源:origin: apache/incubator-druid
@GET
@Produces(MediaType.APPLICATION_JSON)
@ResourceFilters(StateResourceFilter.class)
public Response getRules()
{
return Response.ok(databaseRuleManager.getAllRules()).build();
}
内容来源于网络,如有侵权,请联系作者删除!