我正在为 Syndesis API 中的端点返回 404,即/api/v1/test-support/snapshot-db
,它允许您创建数据库的快照。
在 Restlet 上,我添加了正确的_oauth_proxy
cookie,并发出了GET
一个<host>/api/v1/test-support/snapshot-db
.
@Path("/test-support")
@org.springframework.stereotype.Component
@ConditionalOnProperty(value = "endpoints.test_support.enabled")
public class TestSupportHandler {
private static final Logger LOG = LoggerFactory.getLogger(TestSupportHandler.class);
private final DataManager dataMgr;
private final List<DataAccessObject<?>> daos;
private final OpenShiftService openShiftService;
@Context
private HttpServletRequest context;
private final DBI dbi;
private CacheManager cacheManager;
private Collection<BackendController> controllers;
public TestSupportHandler(DBI dbi, DataManager dataMgr, CacheManager cacheManager, List<DataAccessObject<?>> daos, OpenShiftService openShiftService, Collection<BackendController> controllers) {
this.dbi = dbi;
this.dataMgr = dataMgr;
this.cacheManager = cacheManager;
this.controllers = controllers;
this.daos = daos.stream().filter(x -> !x.isReadOnly()).collect(Collectors.toList());
this.openShiftService = openShiftService;
}
@GET
@Path("/snapshot-db")
@Produces(MediaType.APPLICATION_JSON)
public List<ModelData<?>> snapshotDB() {
LOG.info("user {} is making snapshot", context.getRemoteUser());
ArrayList<ModelData<?>> result = new ArrayList<>();
for (DataAccessObject<?> dao : daos) {
ListResult<? extends WithId<?>> l = dao.fetchAll();
for (WithId<?> entity : l.getItems()) {
@SuppressWarnings({"unchecked", "rawtypes"})
ModelData<?> modelData = new ModelData(entity.getKind(), entity);
result.add(modelData);
}
}
return result;
}
}
我得到以下回复:
{
"errorCode": 404,
"userMsg": "Given request is not acceptable",
"developerMsg": "RESTEASY003210: Could not find resource for full path: <host>/api/v1/test-support/snapshot-db"
}