我为Syndesis API中的端点返回了一个404,即/api/v1/test-support/snapshot-db,它允许您创建数据库的快照。
在Restlet上,我添加了适当的_oauth_proxy cookie,并向<host>/api/v1/test-support/snapshot-db发出了一个GET。
@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"
}发布于 2019-09-10 18:54:15
请注意@ConditionalOnProperty(value = "endpoints.test_support.enabled")。这意味着根据环境中设置的参数,此端点可能会被关闭。如果您有访问服务器pod的权限,请检查此参数的设置并将其设置为'true‘。尝试使用:
oc edit pod <server-podname>并寻找
spec:
containers:
- env:
- name: JAVA_APP_DIR
value: /deployments
- name: JAVA_OPTIONS
value: -Djava.net.preferIPv4Stack=true -Duser.home=/tmp
- name: NAMESPACE
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.namespace
- name: ENDPOINTS_TEST_SUPPORT_ENABLED
value: "false"并将其设置为"true“。如果不能坚持,请尝试编辑dc
oc edit dc syndesis-server 最后注意:如果Syndesis Operator在您的安装中运行,您可能希望将其缩减为零,否则它可能会撤消您的编辑。
祝你好运!--库尔特
https://stackoverflow.com/questions/57869169
复制相似问题