本文整理了Java中javax.ws.rs.core.Response.noContent
方法的一些代码示例,展示了Response.noContent
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Response.noContent
方法的具体详情如下:
包路径:javax.ws.rs.core.Response
类名称:Response
方法名:noContent
[英]Create a new ResponseBuilder for an empty response.
[中]为空响应创建新的ResponseBuilder。
代码示例来源:origin: dropwizard/dropwizard
@Override
public Response toResponse(EmptyOptionalException exception) {
return Response.noContent().build();
}
}
代码示例来源:origin: prestodb/presto
@DELETE
@Path("{queryId}/{token}")
@Produces(MediaType.APPLICATION_JSON)
public Response cancelQuery(@PathParam("queryId") QueryId queryId,
@PathParam("token") long token)
{
Query query = queries.get(queryId);
if (query == null) {
return Response.status(Status.NOT_FOUND).build();
}
query.cancel();
return Response.noContent().build();
}
代码示例来源:origin: Graylog2/graylog2-server
@PUT
@RequiresPermissions(value = {RestPermissions.LDAPGROUPS_EDIT, RestPermissions.LDAP_EDIT}, logical = OR)
@ApiOperation(value = "Update the LDAP group to Graylog role mapping", notes = "Corresponds directly to the output of GET /system/ldap/settings/groups")
@Path("/settings/groups")
@Consumes(MediaType.APPLICATION_JSON)
@AuditEvent(type = AuditEventTypes.LDAP_GROUP_MAPPING_UPDATE)
public Response updateGroupMappingSettings(@ApiParam(name = "JSON body", required = true, value = "A hash in which the keys are the LDAP group names and values is the Graylog role name.")
@NotNull Map<String, String> groupMapping) throws ValidationException {
final LdapSettings ldapSettings = firstNonNull(ldapSettingsService.load(), ldapSettingsFactory.createEmpty());
ldapSettings.setGroupMapping(groupMapping);
ldapSettingsService.save(ldapSettings);
return Response.noContent().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: prestodb/presto
@DELETE
@Path("/v1/proxy")
@Produces(APPLICATION_JSON)
public void cancelQuery(
@QueryParam("uri") String uri,
@QueryParam("hmac") String hash,
@Context HttpServletRequest servletRequest,
@Suspended AsyncResponse asyncResponse)
{
if (!hmac.hashString(uri, UTF_8).equals(HashCode.fromString(hash))) {
throw badRequest(FORBIDDEN, "Failed to validate HMAC of URI");
}
Request.Builder request = prepareDelete().setUri(URI.create(uri));
performRequest(servletRequest, asyncResponse, request, response -> responseWithHeaders(noContent(), response));
}
代码示例来源:origin: jersey/jersey
@Override
public Response apply(ContainerRequestContext data) {
headMethodCalled = true;
return Response.noContent().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: traccar/traccar
@POST
@Path("test")
public Response test(@QueryParam("deviceId") long deviceId, Attribute entity) throws SQLException {
Context.getPermissionsManager().checkAdmin(getUserId());
Context.getPermissionsManager().checkDevice(getUserId(), deviceId);
Position last = Context.getIdentityManager().getLastPosition(deviceId);
if (last != null) {
Object result = new ComputedAttributesHandler().computeAttribute(entity, last);
if (result != null) {
switch (entity.getType()) {
case "number":
Number numberValue = (Number) result;
return Response.ok(numberValue).build();
case "boolean":
Boolean booleanValue = (Boolean) result;
return Response.ok(booleanValue).build();
default:
return Response.ok(result.toString()).build();
}
} else {
return Response.noContent().build();
}
} else {
throw new IllegalArgumentException("Device has no last position");
}
}
代码示例来源:origin: jersey/jersey
@Override
public Response apply(ContainerRequestContext data) {
final String content = clipboard.content();
if (content.isEmpty()) {
return Response.noContent().build();
}
return Response.ok(content).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: traccar/traccar
@POST
@Path("test")
public Response testMessage() throws MessageException, InterruptedException {
for (Typed method : Context.getNotificatorManager().getAllNotificatorTypes()) {
Context.getNotificatorManager()
.getNotificator(method.getType()).sendSync(getUserId(), new Event("test", 0), null);
}
return Response.noContent().build();
}
代码示例来源:origin: jersey/jersey
@Override
public Response doDispatch(final Object resource, final ContainerRequest containerRequest) throws ProcessingException {
invoke(containerRequest, resource);
return Response.noContent().build();
}
}
代码示例来源:origin: pentaho/pentaho-kettle
@GET
@Path( "/saveFile/{path}/{name}/{override}" )
public Response saveFile( @PathParam( "path" ) String path, @PathParam( "name" ) String name,
@PathParam( "override" ) String override ) {
boolean overwrite = override != null && override.toLowerCase().equals( "true" );
if ( repositoryBrowserController.saveFile( path, name, "", overwrite ) ) {
return Response.ok().build();
}
return Response.noContent().build();
}
代码示例来源:origin: traccar/traccar
@Path("{id}/accumulators")
@PUT
public Response updateAccumulators(DeviceAccumulators entity) throws SQLException {
if (!Context.getPermissionsManager().getUserAdmin(getUserId())) {
Context.getPermissionsManager().checkManager(getUserId());
Context.getPermissionsManager().checkPermission(Device.class, getUserId(), entity.getDeviceId());
}
Context.getDeviceManager().resetDeviceAccumulators(entity);
LogAction.resetDeviceAccumulators(getUserId(), entity.getDeviceId());
return Response.noContent().build();
}
代码示例来源:origin: jersey/jersey
@Override
public Response apply(ContainerRequestContext data) {
clipboard.clear();
return Response.noContent().build();
}
});
代码示例来源:origin: pentaho/pentaho-kettle
@GET
@Path( "/checkForSecurityOrDupeIssues/{path}/{name}/{fileName}/{override}" )
public Response checkForSecurityOrDupeIssues( @PathParam( "path" ) String path, @PathParam( "name" ) String name,
@PathParam( "fileName" ) String fileName,
@PathParam( "override" ) String override ) {
boolean overwrite = override != null && override.toLowerCase().equals( "true" );
if ( repositoryBrowserController.checkForSecurityOrDupeIssues( path, name, fileName, overwrite ) ) {
return Response.ok().build();
}
return Response.noContent().build();
}
代码示例来源:origin: Impetus/Kundera
@Path("/{jpaQuery}")
public Response executeUpdateJPAQuery(@Context HttpHeaders headers, @Context UriInfo info, String parameters) {
String jpaQuery = info.getPathParameters().getFirst("jpaQuery");
return Response.noContent().build();
return Response.noContent().build();
return Response.ok(result, mediaType).build();
代码示例来源:origin: jersey/jersey
@Override
public Response apply(ContainerRequestContext request) {
if (request == null) {
return Response.noContent().build();
} else {
return Response.ok(Stringifier.stringify((ContainerRequest) request), MediaType.TEXT_PLAIN).build();
}
}
});
代码示例来源:origin: pentaho/pentaho-kettle
@GET
@Path( "/checkForSecurityOrDupeIssues/{path}/{name}/{override}" )
public Response checkForSecurityOrDupeIssues( @PathParam( "path" ) String path, @PathParam( "name" ) String name,
@PathParam( "override" ) String override ) {
boolean overwrite = override != null && override.toLowerCase().equals( "true" );
if ( repositoryBrowserController.checkForSecurityOrDupeIssues( path, name, "", overwrite ) ) {
return Response.ok().build();
}
return Response.noContent().build();
}
代码示例来源:origin: Impetus/Kundera
@Path("/{jpaQuery}")
public Response executeDeleteJPAQuery(@Context HttpHeaders headers, @Context UriInfo info, String parameters) {
String jpaQuery = info.getPathParameters().getFirst("jpaQuery");
return Response.noContent().build();
return Response.noContent().build();
return Response.ok(result, mediaType).build();
内容来源于网络,如有侵权,请联系作者删除!