Search in sources :

Example 11 with ServicePathManager

use of org.apache.servicecomb.common.rest.locator.ServicePathManager in project java-chassis by ServiceComb.

the class AbstractRestInvocation method findRestOperation.

protected void findRestOperation(MicroserviceMeta microserviceMeta) {
    ServicePathManager servicePathManager = ServicePathManager.getServicePathManager(microserviceMeta);
    if (servicePathManager == null) {
        LOGGER.error("No schema defined for {}:{}.", microserviceMeta.getAppId(), microserviceMeta.getMicroserviceName());
        throw new InvocationException(Status.NOT_FOUND, Status.NOT_FOUND.getReasonPhrase());
    }
    OperationLocator locator = locateOperation(servicePathManager);
    requestEx.setAttribute(RestConst.PATH_PARAMETERS, locator.getPathVarMap());
    this.restOperationMeta = locator.getOperation();
}
Also used : OperationLocator(org.apache.servicecomb.common.rest.locator.OperationLocator) InvocationException(org.apache.servicecomb.swagger.invocation.exception.InvocationException) ServicePathManager(org.apache.servicecomb.common.rest.locator.ServicePathManager)

Aggregations

ServicePathManager (org.apache.servicecomb.common.rest.locator.ServicePathManager)11 OperationLocator (org.apache.servicecomb.common.rest.locator.OperationLocator)6 MicroserviceMeta (org.apache.servicecomb.core.definition.MicroserviceMeta)6 HashMap (java.util.HashMap)3 Test (org.junit.Test)3 Expectations (mockit.Expectations)2 RestOperationMeta (org.apache.servicecomb.common.rest.definition.RestOperationMeta)2 SchemaMeta (org.apache.servicecomb.core.definition.SchemaMeta)2 ReferenceConfig (org.apache.servicecomb.core.provider.consumer.ReferenceConfig)2 AbstractHttpServletRequest (org.apache.servicecomb.foundation.vertx.http.AbstractHttpServletRequest)2 InvocationException (org.apache.servicecomb.swagger.invocation.exception.InvocationException)2 Swagger (io.swagger.models.Swagger)1 ArrayList (java.util.ArrayList)1 Mock (mockit.Mock)1 HttpServerFilterBaseForTest (org.apache.servicecomb.common.rest.filter.HttpServerFilterBaseForTest)1 OperationMeta (org.apache.servicecomb.core.definition.OperationMeta)1 ConsumerSchemaFactory (org.apache.servicecomb.core.definition.schema.ConsumerSchemaFactory)1 MicroserviceReferenceConfig (org.apache.servicecomb.core.provider.consumer.MicroserviceReferenceConfig)1 SwaggerGenerator (org.apache.servicecomb.swagger.generator.core.SwaggerGenerator)1 ApplicationContext (org.springframework.context.ApplicationContext)1