本文整理了Java中javax.ws.rs.POST
类的一些代码示例,展示了POST
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。POST
类的具体详情如下:
包路径:javax.ws.rs.POST
类名称:POST
暂无
代码示例来源:origin: apache/incubator-druid
@POST
@Path("/assignTask")
@Consumes({MediaType.APPLICATION_JSON, SmileMediaTypes.APPLICATION_JACKSON_SMILE})
public Response assignTask(Task task)
{
try {
workerTaskMonitor.assignTask(task);
return Response.ok().build();
}
catch (RuntimeException ex) {
return Response.serverError().entity(ex.getMessage()).build();
}
}
代码示例来源:origin: apache/storm
@POST
@Path("/{func}")
public String post(@PathParam("func") String func, String args, @Context HttpServletRequest request) throws Exception {
meterHttpRequests.mark();
return responseDuration.time(() -> drpc.executeBlocking(func, args));
}
代码示例来源:origin: weibocom/motan
@POST
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
@Produces(MediaType.APPLICATION_JSON)
Response add(@FormParam("id") int id, @FormParam("name") String name);
代码示例来源:origin: apache/incubator-druid
@POST
@Path("/suspendAll")
@Produces(MediaType.APPLICATION_JSON)
public Response suspendAll()
{
return suspendOrResumeAll(true);
}
代码示例来源:origin: apache/incubator-druid
@POST
@Path("/{dataSourceName}")
@Consumes(MediaType.APPLICATION_JSON)
@ResourceFilters(RulesResourceFilter.class)
public Response setDatasourceRules(
@PathParam("dataSourceName") final String dataSourceName,
final List<Rule> rules,
@HeaderParam(AuditManager.X_DRUID_AUTHOR) @DefaultValue("") final String author,
@HeaderParam(AuditManager.X_DRUID_COMMENT) @DefaultValue("") final String comment,
@Context HttpServletRequest req
)
{
if (databaseRuleManager.overrideRule(
dataSourceName,
rules,
new AuditInfo(author, comment, req.getRemoteAddr())
)) {
return Response.ok().build();
}
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build();
}
代码示例来源:origin: jersey/jersey
@POST
@Path("webapplication_noentity")
public String testWebApplicationExceptionNoEntity(String s) {
String[] tokens = s.split(":");
assert tokens.length == 2;
int statusCode = Integer.valueOf(tokens[1]);
Response r = Response.status(statusCode).build();
throw new WebApplicationException(r);
}
代码示例来源: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
@Timed
@POST
@Path("/cluster")
@Consumes(MediaType.TEXT_PLAIN)
@ApiOperation(value = "Create and send a cluster debug event.")
@NoAuditEvent("only used to create a debug event")
public void generateClusterDebugEvent(@ApiParam(name = "text", defaultValue = "Cluster Test") @Nullable String text) {
clusterEventBus.post(DebugEvent.create(nodeId.toString(), isNullOrEmpty(text) ? "Cluster Test" : text));
}
代码示例来源:origin: apache/incubator-druid
@POST
@Path("/redirect")
@Produces(MediaType.APPLICATION_JSON)
public Response redirecting() throws Exception
{
return Response.temporaryRedirect(new URI(StringUtils.format("http://localhost:%s/simple/direct", port))).build();
}
代码示例来源:origin: apache/incubator-druid
@POST
@Produces(MediaType.APPLICATION_JSON)
public Response post()
{
return Response.ok(DEFAULT_RESPONSE_CONTENT).build();
}
}
代码示例来源:origin: jersey/jersey
@Path("start")
@POST
public Response post(@DefaultValue("0") @QueryParam("testSources") int testSources) {
final Process process = new Process(testSources);
processes.put(process.getId(), process);
Executors.newSingleThreadExecutor().execute(process);
final URI processIdUri = UriBuilder.fromResource(DomainResource.class).path("process/{id}").build(process.getId());
return Response.created(processIdUri).build();
}
代码示例来源:origin: Graylog2/graylog2-server
@POST
@Timed
@ApiOperation(value = "Shutdown this node gracefully.",
notes = "Attempts to process all buffered and cached messages before exiting, " +
"shuts down inputs first to make sure that no new messages are accepted.")
@Path("/shutdown")
@AuditEvent(type = AuditEventTypes.NODE_SHUTDOWN_INITIATE)
public Response shutdown() {
checkPermission(RestPermissions.NODE_SHUTDOWN, serverStatus.getNodeId().toString());
new Thread(gracefulShutdown).start();
return accepted().build();
}
}
代码示例来源:origin: apache/incubator-druid
@POST
public Response postMock(InputStream inputStream)
{
return Response.ok().build();
}
};
代码示例来源:origin: Graylog2/graylog2-server
@POST
@Timed
@ApiOperation(value = "Add a new named pattern", response = GrokPattern.class)
@AuditEvent(type = AuditEventTypes.GROK_PATTERN_CREATE)
public Response createPattern(@ApiParam(name = "pattern", required = true)
@Valid @NotNull GrokPattern pattern) throws ValidationException {
checkPermission(RestPermissions.INPUTS_CREATE);
// remove the ID from the pattern, this is only used to create new patterns
final GrokPattern newPattern = grokPatternService.save(pattern.toBuilder().id(null).build());
final URI patternUri = getUriBuilderToSelf().path(GrokResource.class, "listPattern").build(newPattern.id());
return Response.created(patternUri).entity(newPattern).build();
}
代码示例来源:origin: elasticjob/elastic-job-lite
/**
* 终止作业.
*
* @param serverIp 服务器IP地址
* @param jobName 作业名称
*/
@POST
@Path("/{serverIp}/jobs/{jobName}/shutdown")
public void shutdownServerJob(@PathParam("serverIp") final String serverIp, @PathParam("jobName") final String jobName) {
jobAPIService.getJobOperatorAPI().shutdown(Optional.of(jobName), Optional.of(serverIp));
}
代码示例来源:origin: elasticjob/elastic-job-lite
/**
* 添加事件追踪数据源配置.
*
* @param config 事件追踪数据源配置
* @return 是否添加成功
*/
@POST
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public boolean add(final EventTraceDataSourceConfiguration config) {
return eventTraceDataSourceConfigurationService.add(config);
}
代码示例来源:origin: apache/incubator-druid
@POST
@Path("/resumeAll")
@Produces(MediaType.APPLICATION_JSON)
public Response resumeAll()
{
return suspendOrResumeAll(false);
}
代码示例来源:origin: apache/incubator-druid
@POST
@Path("/stop")
public Response stop(@Context final HttpServletRequest req)
{
authorizationCheck(req, Action.WRITE);
stopGracefully();
return Response.status(Response.Status.OK).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: Graylog2/graylog2-server
@Timed
@POST
@Path("/local")
@Consumes(MediaType.TEXT_PLAIN)
@ApiOperation(value = "Create and send a local debug event.")
@NoAuditEvent("only used to create a debug event")
public void generateDebugEvent(@ApiParam(name = "text", defaultValue = "Local Test") @Nullable String text) {
serverEventBus.post(DebugEvent.create(nodeId.toString(), isNullOrEmpty(text) ? "Local Test" : text));
}
内容来源于网络,如有侵权,请联系作者删除!