use of jakarta.ws.rs.NotSupportedException in project resteasy by resteasy.
the class ClosedResponseHandlingResource method getNotSupportedTraced.
@Path("/testNotSupportedTraced")
@GET
public String getNotSupportedTraced(@Context UriInfo uriInfo) {
URI endpoint415 = UriBuilder.fromUri(uriInfo.getRequestUri()).path("415").build();
Client client = ClientBuilder.newClient();
try {
return client.target(endpoint415).request().get(String.class);
} catch (NotSupportedException e) {
throw new ClosedResponseHandlingPleaseMapException(e.getResponse());
} finally {
client.close();
}
}
use of jakarta.ws.rs.NotSupportedException in project incubator-hugegraph by apache.
the class TaskAPI method update.
@PUT
@Timed
@Path("{id}")
@Status(Status.ACCEPTED)
@Produces(APPLICATION_JSON_WITH_CHARSET)
public Map<String, Object> update(@Context GraphManager manager, @PathParam("graph") String graph, @PathParam("id") long id, @QueryParam("action") String action) {
LOG.debug("Graph [{}] cancel task: {}", graph, id);
if (!ACTION_CANCEL.equals(action)) {
throw new NotSupportedException(String.format("Not support action '%s'", action));
}
TaskScheduler scheduler = graph(manager, graph).taskScheduler();
HugeTask<?> task = scheduler.task(IdGenerator.of(id));
if (!task.completed() && !task.cancelling()) {
scheduler.cancel(task);
if (task.cancelling() || task.cancelled()) {
return task.asMap();
}
}
assert task.completed() || task.cancelling();
throw new BadRequestException(String.format("Can't cancel task '%s' which is completed or cancelling", id));
}
use of jakarta.ws.rs.NotSupportedException in project incubator-hugegraph by apache.
the class GraphsAPI method getConf.
@GET
@Timed
@Path("{name}/conf")
@Produces(APPLICATION_JSON_WITH_CHARSET)
@RolesAllowed("admin")
public File getConf(@Context GraphManager manager, @PathParam("name") String name) {
LOG.debug("Get graph configuration by name '{}'", name);
HugeGraph g = graph4admin(manager, name);
HugeConfig config = (HugeConfig) g.configuration();
File file = config.file();
if (file == null) {
throw new NotSupportedException("Can't access the api in " + "a node which started with non local file config.");
}
return file;
}
use of jakarta.ws.rs.NotSupportedException in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method constructorTest.
/*
* @testName: constructorTest
*
* @assertion_ids: JAXRS:JAVADOC:343; JAXRS:JAVADOC:12;
*
* @test_Strategy: Construct a new unsupported media type exception.
*
* getResponse
*/
@Test
public void constructorTest() throws Fault {
NotSupportedException e = new NotSupportedException();
assertResponse(e);
}
use of jakarta.ws.rs.NotSupportedException in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method constructorStringThrowableTest.
/*
* @testName: constructorStringThrowableTest
*
* @assertion_ids: JAXRS:JAVADOC:1093; JAXRS:JAVADOC:12;
*
* @test_Strategy: Construct a new unsupported media type exception.
*
* getResponse
*/
public void constructorStringThrowableTest() throws Fault {
Throwable[] throwables = new Throwable[] { new RuntimeException(), new IOException(), new Error(), new Throwable() };
for (Throwable t : throwables) {
NotSupportedException e = new NotSupportedException(MESSAGE, t);
assertResponse(e);
assertCause(e, t);
assertMessage(e);
}
}
Aggregations