[ 
https://issues.apache.org/jira/browse/STRATOS-964?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Chamila de Alwis updated STRATOS-964:
-------------------------------------
    Affects Version/s: 4.1.0 Beta

> Some REST API are not returning response codes
> ----------------------------------------------
>
>                 Key: STRATOS-964
>                 URL: https://issues.apache.org/jira/browse/STRATOS-964
>             Project: Stratos
>          Issue Type: Sub-task
>          Components: REST API
>    Affects Versions: 4.0.0 M4, 4.1.0 Beta
>            Reporter: Mariangela Hills
>
> When looking though the code, I noticed that some of the REST APIs do not 
> return a response code. All HTTP requests sent in REST API  should return a 
> response code. The following code is one such example:
> @GET
>     @Path("/tenant/{tenantDomain}")
>     @Consumes("application/json")
>     @Produces("application/json")
>     @AuthorizationAction("/permission/protected/manage/monitor/tenants")
>     @SuperTenantService(true)
>     public TenantInfoBean getTenant(@PathParam("tenantDomain") String 
> tenantDomain) throws RestAPIException {
>         try {
>             return getTenantForDomain(tenantDomain);
>         } catch (Exception e) {
>             String msg = "Error in getting tenant information for tenant " + 
> tenantDomain;
>             log.error(msg, e);
>             throw new RestAPIException(msg);
>         }
>     }
>     private TenantInfoBean getTenantForDomain(String tenantDomain) throws 
> Exception {
>         TenantManager tenantManager = ServiceHolder.getTenantManager();
>         int tenantId;
>         try {
>             tenantId = tenantManager.getTenantId(tenantDomain);
>         } catch (UserStoreException e) {
>             String msg = "Error in retrieving the tenant id for the tenant 
> domain: " +
>                     tenantDomain + ".";
>             log.error(msg);
>             throw new Exception(msg, e);
>         }
>         Tenant tenant;
>         try {
>             tenant = (Tenant) tenantManager.getTenant(tenantId);
>         } catch (UserStoreException e) {
>             String msg = "Error in retrieving the tenant from the tenant 
> manager.";
>             log.error(msg);
>             throw new Exception(msg, e);
>         }
>         TenantInfoBean bean = 
> TenantMgtUtil.initializeTenantInfoBean(tenantId, tenant);
>         // retrieve first and last names from the UserStoreManager
>         bean.setFirstname(ClaimsMgtUtil.getFirstNamefromUserStoreManager(
>                 ServiceHolder.getRealmService(), tenantId));
>         bean.setLastname(ClaimsMgtUtil.getLastNamefromUserStoreManager(
>                 ServiceHolder.getRealmService(), tenantId));
>         //getting the subscription plan
>         String activePlan = "";
>         //TODO: usage plan using billing service
>         if (activePlan != null && activePlan.trim().length() > 0) {
>             bean.setUsagePlan(activePlan);
>         } else {
>             bean.setUsagePlan("");
>         }
>         return bean;
>     }



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to