* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
public static final String AAF_GUI_COPYRIGHT = "aaf_gui_copyright";
public static final String HTTP_SERVLET_REQUEST = "HTTP_SERVLET_REQUEST";
public static final int TIMEOUT = 60000;
- public static final String app = "AAF GUI";
-
+ public static final String APP = "AAF GUI";
+
// AAF API
-
+
// Certificate manager API
public RosettaDF<Artifacts> artifactsDF;
public RosettaDF<CertInfo> certInfoDF;
private final AAFConHttp cmCon;
public final AAFConHttp aafCon;
public final AAFLurPerm lur;
-
- public final Slot slot_httpServletRequest;
+
+ public final Slot slotHttpServletRequest;
protected final String deployedVersion;
private StaticSlot sThemeWebPath;
private StaticSlot sDefaultTheme;
sDefaultTheme = env.staticSlot(AAF_GUI_THEME);
String defTheme = env.getProperty(AAF_GUI_THEME,"onap");
env.put(sDefaultTheme, defTheme);
-
+
sThemeWebPath = env.staticSlot(CachingFileAccess.CFA_WEB_PATH);
if(env.get(sThemeWebPath)==null) {
- env.put(sThemeWebPath,"theme");
+ env.put(sThemeWebPath,"theme");
}
-
- slot_httpServletRequest = env.slot(HTTP_SERVLET_REQUEST);
- deployedVersion = app_version;
+
+
+ slotHttpServletRequest = env.slot(HTTP_SERVLET_REQUEST);
+ deployedVersion = appVersion;
+
// Certificate Manager
- String aaf_url_cm = env.getProperty(Config.AAF_URL_CM,Config.AAF_URL_CM_DEF);
- cmCon = new AAFConHttp(env.access(),aaf_url_cm);
+ String aafUrlCm = env.getProperty(Config.AAF_URL_CM,Config.AAF_URL_CM_DEF);
+ cmCon = new AAFConHttp(env.access(),aafUrlCm);
artifactsDF = env.newDataFactory(Artifacts.class);
certInfoDF = env.newDataFactory(CertInfo.class);
-
+
/////////////////////////
// Screens
Page roleDetail = new Display(this, GET, new RoleDetail(this, start, myRoles)).page();
new Display(this, POST, new RoleDetailAction(this,start,myRoles,roleDetail));
new Display(this, GET, new RoleHistory(this,start,myRoles,roleDetail));
-
+
// MyNameSpace
final Page myNamespaces = new Display(this, GET, new NssShow(this, start)).page();
Page nsDetail = new Display(this, GET, new NsDetail(this, start, myNamespaces)).page();
Page artiShow = new Display(this, GET, new CMArtifactShow(this, start, myNamespaces, nsDetail, crdDetail)).page();
Page artiCForm = new Display(this, GET, new CMArtiChangeForm(this, start, myNamespaces, nsDetail, crdDetail,artiShow)).page();
new Display(this, POST, new CMArtiChangeAction(this, start,artiShow,artiCForm));
-
+
// Password Change Screens
final Page pwc = new Display(this, GET, new PassChangeForm(this, start,crdDetail)).page();
new Display(this, POST, new PassChangeAction(this, start, pwc));
-
+
// Password Delete Screen
new Display(this, GET, new PassDeleteAction(this, start,crdDetail));
// Validation Change Screens
final Page validate = new Display(this, GET, new ApprovalForm(this, start)).page();
new Display(this, POST, new ApprovalAction(this, start, validate));
-
+
// Onboard, Detailed Edit Screens
final Page onb = new Display(this, GET, new NsInfoForm(this, start)).page();
new Display(this, POST, new NsInfoAction(this, start, onb));
// Web Command Screens
/* final Page webCommand =*/ new Display(this, GET, new WebCommand(this, start)).page();
-
+
// API Docs
final Page apidocs = new Display(this, GET, new ApiDocs(this, start)).page();
new Display(this, GET, new ApiExample(this,start, apidocs)).page();
-
+
// Permission Grant Page
final Page permGrant = new Display(this, GET, new PermGrantForm(this, start)).page();
new Display(this, POST, new PermGrantAction(this, start, permGrant)).page();
-
+
// Login Landing if no credentials detected
final Page loginLanding = new Display(this, GET, new LoginLanding(this, start)).page();
new Display(this, POST, new LoginLandingAction(this, start, loginLanding));
-
+
// User Role Request Extend and Remove
new Display(this, GET, new UserRoleExtend(this, start,myRoles)).page();
new Display(this, GET, new UserRoleRemove(this, start,myRoles)).page();
-
+
// See my Pending Requests
final Page requestsShow = new Display(this, GET, new PendingRequestsShow(this, start)).page();
new Display(this, GET, new RequestDetail(this, start, requestsShow));
-
+
// Command line Mechanism
route(env, PUT, "/gui/cui", new CUI(this),"text/plain;charset=utf-8","*/*");
-
+
route(env, GET, "/gui/clear", new HttpCode<AuthzTrans, Void>(null, "Clear"){
- @Override
- public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
- trans.clearCache();
- Cookie cookies[] = req.getCookies();
- if(cookies!=null) {
- for(Cookie c : cookies) {
- if(c.getName().startsWith("aaf.gui.")) {
- c.setMaxAge(0);
- resp.addCookie(c);
- }
- }
- }
- resp.sendRedirect("/gui/home");
- }
+ @Override
+ public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
+ trans.clearCache();
+ Cookie cookies[] = req.getCookies();
+ if(cookies!=null) {
+ for(Cookie c : cookies) {
+ if(c.getName().startsWith("aaf.gui.")) {
+ c.setMaxAge(0);
+ resp.addCookie(c);
+ }
+ }
+ }
+ resp.sendRedirect("/gui/home");
+ }
}, "text/plain;charset=utf-8","*/*");
-
- ///////////////////////
+
+ ///////////////////////
// WebContent Handler
///////////////////////
CachingFileAccess<AuthzTrans> cfa = new CachingFileAccess<AuthzTrans>(env);
- //route(env,GET,"/"+env.get(sThemeWebPath)+"/:key*", cfa);
route(env,GET,"/theme/:key*", cfa);
///////////////////////
aafCon = aafCon();
lur = aafCon.newLur();
}
-
+
public<T> RosettaDF<T> getDF(Class<T> cls) throws APIException {
return Cmd.getDF(env,cls);
}
-
+
public void writeError(AuthzTrans trans, Future<?> fp, HTMLGen hgen, int indent) {
if (hgen!=null) {
String msg = aafCon.readableErrMsg(fp);
}
public<RET> RET cmClientAsUser(TaggedPrincipal p,Retryable<RET> retryable) throws APIException, LocatorException, CadiException {
- return cmCon.hman().best(new HTransferSS(p,app, aafCon.securityInfo()), retryable);
+ return cmCon.hman().best(new HTransferSS(p, APP, aafCon.securityInfo()), retryable);
}
-
+
@Override
public Filter[] _filters(Object ... additionalTafLurs) throws CadiException, LocatorException {
try {
try {
new JettyServiceStarter<AuthzEnv,AuthzTrans>(
- new AAF_GUI(new AuthzEnv(propAccess)),true)
- .start();
- } catch (Exception e) {
- propAccess.log(e);
- }
+ new AAF_GUI(new AuthzEnv(propAccess)),true)
+ .start();
+ } catch (Exception e) {
+ propAccess.log(e);
+ }
} catch (Exception e) {
e.printStackTrace();
}