From Piotr Kliczewski <piotr.kliczewski(a)gmail.com>:
Piotr Kliczewski has submitted this change and it was merged.
Change subject: restapi: Use non-capturing groups for action status
......................................................................
restapi: Use non-capturing groups for action status
The API has a mechanism that can be used to check the status of
asynchronous actions. For example, when a template is imported the API
returns a response like this:
<action
href="/ovirt-engine/api/storagedomains/123/templates/456/import/789"/>
...
</action>
The 'href' provided in that response can be used to check the status of
the action.
In the server side that is implemented by methods with declarations like
this:
@Path("{action: (import|register)}/{oid}")
ActionResource getActionResource(
@PathParam("action") String action,
@PathParam("oid") String oid
);
But unfortunatelly since Resteasy 3 there is a bug that makes this fail:
the parenthesis don't work correctly with resource locators. See this
for details:
Regex with parenthesis doesn't work with resource locator
https://issues.jboss.org/browse/RESTEASY-1569
To avoid that issue this patch changes updates the server to use version
1.1.10 of the metamodel, which generates that code using non-capturing
groups instead of plain parenthesis:
@Path("{action: (?:import|register)}/{oid}")
ActionResource getActionResource(
@PathParam("action") String action,
@PathParam("oid") String oid
);
Note the use of (?:...) instead of just (...).
That solves the issue for all the V4 action resources, because the
code is automatically generated by the metamodel. But for the V3
compatibility layer this has to be modified manually in each resource.
In addition the URLs generated by the action resource need to be
generated correctly, containing the "/v3" or "/v4" prefix only when
it
is explicitly included in the request.
Change-Id: Ied1d04175706d38d725d4ea05617b0c93ec8ca91
Bug-Url:
https://bugzilla.redhat.com/1405774
Related-To:
https://issues.jboss.org/browse/RESTEASY-1569
Signed-off-by: Juan Hernandez <juan.hernandez(a)redhat.com>
(cherry picked from commit 2fe146eeaf75936716d4349527d4b122e4b273e8)
---
M
backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/invocation/Current.java
M
backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/AbstractBackendActionableResource.java
M
backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/AbstractBackendAsyncStatusResource.java
M
backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendApiResource.java
M
backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/rsdl/RsdlLoader.java
M
backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/util/LinkHelper.java
M
backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/v3/adapters/V3ApiOutAdapter.java
M
backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/v3/helpers/V3LinkHelper.java
M
backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/v3/servers/V3ActionServer.java
M
backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/v3/servers/V3AttachedStorageDomainServer.java
M
backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/v3/servers/V3ClusterServer.java
M
backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/v3/servers/V3CopyableServer.java
M
backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/v3/servers/V3DiskServer.java
M
backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/v3/servers/V3EventsServer.java
M
backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/v3/servers/V3ExternalHostProviderServer.java
M
backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/v3/servers/V3ExternalProviderServer.java
M
backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/v3/servers/V3GlusterBrickServer.java
M
backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/v3/servers/V3GlusterBricksServer.java
M
backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/v3/servers/V3GlusterHookServer.java
M
backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/v3/servers/V3GlusterVolumeServer.java
M
backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/v3/servers/V3HostNicServer.java
M
backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/v3/servers/V3HostServer.java
M
backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/v3/servers/V3ImageServer.java
M
backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/v3/servers/V3JobServer.java
M
backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/v3/servers/V3MoveableServer.java
M
backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/v3/servers/V3OpenstackImageProviderServer.java
M
backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/v3/servers/V3OpenstackImageServer.java
M
backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/v3/servers/V3OpenstackNetworkProviderServer.java
M
backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/v3/servers/V3OpenstackVolumeProviderServer.java
M
backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/v3/servers/V3SnapshotServer.java
M
backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/v3/servers/V3StepServer.java
M
backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/v3/servers/V3StorageDomainServer.java
M
backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/v3/servers/V3StorageDomainTemplateServer.java
M
backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/v3/servers/V3StorageDomainVmServer.java
M
backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/v3/servers/V3SystemServer.java
M
backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/v3/servers/V3TemplateDiskServer.java
M
backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/v3/servers/V3TemplateServer.java
M
backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/v3/servers/V3VmDiskServer.java
M
backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/v3/servers/V3VmGraphicsConsoleServer.java
M
backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/v3/servers/V3VmNicServer.java
M
backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/v3/servers/V3VmPoolServer.java
M
backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/v3/servers/V3VmServer.java
M
backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/AbstractBackendBaseTest.java
43 files changed, 130 insertions(+), 113 deletions(-)
Approvals:
Juan Hernandez: Verified; Looks good to me, approved
Jenkins CI: Passed CI tests
--
To view, visit
https://gerrit.ovirt.org/70908
To unsubscribe, visit
https://gerrit.ovirt.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ied1d04175706d38d725d4ea05617b0c93ec8ca91
Gerrit-PatchSet: 2
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-4.1
Gerrit-Owner: Juan Hernandez <juan.hernandez(a)redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Juan Hernandez <juan.hernandez(a)redhat.com>
Gerrit-Reviewer: Piotr Kliczewski <piotr.kliczewski(a)gmail.com>
Gerrit-Reviewer: gerrit-hooks <automation(a)ovirt.org>