X-Git-Url: https://gerrit.onap.org/r/gitweb?p=aaf%2Fauthz.git;a=blobdiff_plain;f=auth%2Fauth-service%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Faaf%2Fauth%2Fservice%2Fapi%2FAPI_Api.java;h=5213a6e9d6af7ff74b49aaad6431bd03d081e5a6;hp=79dda3265bdc22d139b5faa22d07b464a5380eab;hb=4b5a7d721d994a49057e9bfb403c7bff1b376660;hpb=824dc7b5fc0e1ccdf7f460479aff344727f0f01e diff --git a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_Api.java b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_Api.java index 79dda326..5213a6e9 100644 --- a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_Api.java +++ b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_Api.java @@ -40,53 +40,53 @@ import org.onap.aaf.cadi.Symm; * */ public class API_Api { - // Hide Public Constructor - private API_Api() {} - - /** - * Normal Init level APIs - * - * @param authzAPI - * @param facade - * @throws Exception - */ - public static void init(final AAF_Service authzAPI, AuthzFacade facade) throws Exception { - //////// - // Overall APIs - /////// - authzAPI.route(HttpMethods.GET,"/api",API.API,new Code(facade,"Document API", true) { - @Override - public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception { - Result r = context.getAPI(trans,resp,authzAPI); - if(r.isOK()) { - resp.setStatus(HttpStatus.OK_200); - } else { - context.error(trans,resp,r); - } - } - }); + // Hide Public Constructor + private API_Api() {} + + /** + * Normal Init level APIs + * + * @param authzAPI + * @param facade + * @throws Exception + */ + public static void init(final AAF_Service authzAPI, AuthzFacade facade) throws Exception { + //////// + // Overall APIs + /////// + authzAPI.route(HttpMethods.GET,"/api",API.API,new Code(facade,"Document API", true) { + @Override + public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception { + Result r = context.getAPI(trans,resp,authzAPI); + if(r.isOK()) { + resp.setStatus(HttpStatus.OK_200); + } else { + context.error(trans,resp,r); + } + } + }); - //////// - // Overall Examples - /////// - authzAPI.route(HttpMethods.GET,"/api/example/*",API.VOID,new Code(facade,"Document API", true) { - @Override - public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception { - String pathInfo = req.getPathInfo(); - int question = pathInfo.lastIndexOf('?'); - - pathInfo = pathInfo.substring(13, question<0?pathInfo.length():question);// IMPORTANT, this is size of "/api/example/" - String nameOrContextType=Symm.base64noSplit.decode(pathInfo); - Result r = context.getAPIExample(trans,resp,nameOrContextType, - question>=0 && "optional=true".equalsIgnoreCase(req.getPathInfo().substring(question+1)) - ); - if(r.isOK()) { - resp.setStatus(HttpStatus.OK_200); - } else { - context.error(trans,resp,r); - } - } - }); + //////// + // Overall Examples + /////// + authzAPI.route(HttpMethods.GET,"/api/example/*",API.VOID,new Code(facade,"Document API", true) { + @Override + public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception { + String pathInfo = req.getPathInfo(); + int question = pathInfo.lastIndexOf('?'); + + pathInfo = pathInfo.substring(13, question<0?pathInfo.length():question);// IMPORTANT, this is size of "/api/example/" + String nameOrContextType=Symm.base64noSplit.decode(pathInfo); + Result r = context.getAPIExample(trans,resp,nameOrContextType, + question>=0 && "optional=true".equalsIgnoreCase(req.getPathInfo().substring(question+1)) + ); + if(r.isOK()) { + resp.setStatus(HttpStatus.OK_200); + } else { + context.error(trans,resp,r); + } + } + }); - } + } }