List of usage examples for org.apache.wicket.protocol.http WebApplication getInitParameter
public String getInitParameter(String key)
From source file:ch.qos.mistletoe.wicket.TestReportPage.java
License:Open Source License
public TestReportPage() { WebApplication application = (WebApplication) getApplication(); String originalTargetClassStr = application.getInitParameter(Constants.DEFAULT_TEST_SUITE_KEY); add(new FeedbackPanel(Constants.FEEDBACK_ID)); add(new SummaryMarkupContainer(Constants.SUMMARY_ID, null)); Form<String> form = new RunTestForm(Constants.RUN_FORM_ID, this); add(form);/*from w w w . ja v a 2s.c om*/ form.add(new TextField<String>(Constants.TEST_CLASS_NAME_ID, new Model<String>(originalTargetClassStr))); EmptyPanel emptyPanel = new EmptyPanel(Constants.NODE_ID); add(emptyPanel); }
From source file:org.apache.isis.extensions.wicket.view.gmap2.collection.locatable.CollectionOfEntitiesAsLocatables.java
License:Apache License
/** * Overridable so can obtain API from another source if required. *//* w w w. j av a 2s .c om*/ protected String getGoogleMapsAPIkey() { final WebApplication webApplication = (WebApplication) getApplication(); return webApplication.getInitParameter(GOOGLE_MAPS_API_KEY); }
From source file:org.dcm4chee.web.common.login.WebLoginContext.java
License:LGPL
@Override protected org.apache.wicket.security.hive.authentication.Subject getSubject(String username, String password) throws LoginException { WebApplication app = (WebApplication) RequestCycle.get().getApplication(); String webApplicationPolicy = app.getInitParameter("webApplicationPolicy"); if (webApplicationPolicy == null) webApplicationPolicy = "dcm4chee"; String rolesGroupName = app.getInitParameter("rolesGroupName"); if (rolesGroupName == null) rolesGroupName = "Roles"; LoginCallbackHandler handler = new LoginCallbackHandler(username, password); LoginContext context;/*from w w w.ja v a2s. c o m*/ SecureSession secureSession; try { secureSession = ((SecureSession) RequestCycle.get().getSession()); secureSession.setManageUsers(BaseCfgDelegate.getInstance().getManageUsers()); context = new LoginContext(webApplicationPolicy, handler); context.login(); secureSession.setUsername(username); } catch (Exception e) { log.warn("Login failed. Reason: " + e.getMessage()); throw new LoginException(); } if (!readHiveFile()) return null; DefaultSubject subject; try { subject = LoginContextSecurityHelper.mapSwarmSubject(context.getSubject(), null); if (!LoginContextSecurityHelper.checkLoginAllowed(subject)) { ((SecureSession) RequestCycle.get().getSession()).invalidate(); log.warn( "Failed to authorize subject for login, denied. See 'LoginAllowedRolename' parameter in web.xml."); } secureSession.extendedLogin(username, password, subject); } catch (Exception e) { log.error("Login failed for user " + username, e); ((SecureSession) RequestCycle.get().getSession()).invalidate(); subject = new DefaultSubject(); } return subject; }
From source file:org.dcm4chee.wizard.common.login.context.WebLoginContext.java
License:LGPL
@Override protected org.wicketstuff.security.hive.authentication.Subject getSubject(String username, String password) throws LoginException { WebApplication app = (WebApplication) Application.get(); String webApplicationPolicy = app.getInitParameter("webApplicationPolicy"); if (webApplicationPolicy == null) webApplicationPolicy = "dcm4chee"; String rolesGroupName = app.getInitParameter("rolesGroupName"); if (rolesGroupName == null) rolesGroupName = "Roles"; LoginCallbackHandler handler = new LoginCallbackHandler(username, password); LoginContext context;//from w ww. ja va 2s .co m SecureSession secureSession; try { secureSession = (SecureSession) Session.get(); // secureSession.setManageUsers(BaseCfgDelegate.getInstance().getManageUsers()); context = new LoginContext(webApplicationPolicy, handler); context.login(); secureSession.setUsername(username); } catch (Exception e) { log.warn("Login failed. Reason: " + e.getMessage()); throw new LoginException(); } if (!readHiveFile()) return null; DefaultSubject subject; try { subject = LoginContextSecurityHelper.mapSwarmSubject(context.getSubject(), null); if (!LoginContextSecurityHelper.checkLoginAllowed(subject)) { ((SecureSession) Session.get()).invalidate(); log.warn( "Failed to authorize subject for login, denied. See 'LoginAllowedRolename' parameter in web.xml."); } secureSession.extendedLogin(username, password, subject); } catch (Exception e) { log.error("Login failed for user " + username, e); ((SecureSession) Session.get()).invalidate(); subject = new DefaultSubject(); } return subject; }