IMO we need validations in both places. The reason being that in REST API
if we do not check the availability of a resource before executing an
operation it may raise a HTTP 500 to the end user as a result of the
exception raised by the backend service.

Thanks

On Sat, Jan 31, 2015 at 5:52 PM, Sajith Kariyawasam <[email protected]> wrote:

> Hi Devs,
>
> I noted that in addCartridge operation, existing cartridge check is done
> twice.
>
> In StratosApiV41 --> CartridgeBean cartridgeBean =
> StratosApiV41Utils.getCartridgeForValidate(cartridgeType);
>
> Also in CloudcontrollerServiceImpl -->
>  cloudControllerContext.getCartridge(cartridgeType)
>
> I think the check in StratosApi (rest endpoint) is redundant, and that is
> not a responsibility of rest endpoint, also this will be an overhead to do
> a service call.
>
> Any reason for adding it there..?
>
> Thanks,
> Sajith
>



-- 
Imesh Gunaratne

Technical Lead, WSO2
Committer & PMC Member, Apache Stratos

Reply via email to