Example usage for org.apache.wicket Application get

List of usage examples for org.apache.wicket Application get

Introduction

In this page you can find the example usage for org.apache.wicket Application get.

Prototype

public static Application get(final String applicationKey) 

Source Link

Document

Gets the Application based on the application key of that application.

Usage

From source file:at.molindo.wicketutils.utils.MockUtils.java

License:Apache License

public static <V> V withRequest(String applicationKey, IMockRequestCallback<V> callback) {
    return withRequest((WebApplication) Application.get(applicationKey), callback);
}

From source file:com.gitblit.wicket.pages.BasePage.java

License:Apache License

@Override
public void renderHead(IHeaderResponse response) {
    super.renderHead(response);
    response.render(JavaScriptHeaderItem.forReference(JQueryResourceReference.get()));

    if (app().settings().getBoolean(Keys.web.useResponsiveLayout, true)) {
        response.render(CssHeaderItem.forReference(
                Application.get().getSharedResources().get(Bootstrap.BOOTSTRAP_RESPONSIVE_CSS_RESOURCE)));
    }/* w w w.j a  v a2s  .c o  m*/
    if (app().settings().getBoolean(Keys.web.hideHeader, false)) {
        response.render(
                CssHeaderItem.forReference(new ContextRelativeResourceReference("/hideheader.css", false)));
    }
}

From source file:com.lyndir.lhunath.grantmywishes.webapp.listener.GrantMyWishesGuiceContext.java

License:Apache License

/**
 * @return The Guice {@link Injector} that was created for the {@link WebApplication} this thread is working with.
 *
 * @see Application#get()//w ww .  ja  v  a 2 s  .c  om
 */
public static Injector get() {

    return get(((WebApplication) Application.get(wicketFilter.toString())).getServletContext());
}

From source file:com.lyndir.lhunath.snaplog.webapp.listener.GuiceContext.java

License:Apache License

/**
 * @return The Guice {@link Injector} that was created for the {@link WebApplication} this thread is working with.
 *
 * @see Application#get()//from w  w  w  .j  a  v a2 s . c o m
 */
public static Injector get() {

    if (injector != null)
        return injector;

    return get(((WebApplication) Application.get(wicketFilter.toString())).getServletContext());
}

From source file:org.apache.openmeetings.cli.TestAdmin.java

License:Apache License

@After
public void tearDown() throws IOException {
    resetDerbyHome();//from  ww  w .j  av a  2s  . co m
    System.getProperties().remove(OM_HOME);
    deleteDirectory(tempFolder);
    WebApplication app = (WebApplication) Application.get(getWicketApplicationName());
    if (app != null) {
        destroyApplication();
        setInitComplete(false);
    }
}

From source file:org.apache.openmeetings.core.remote.UserService.java

License:Apache License

@Override
public boolean kickUserBySessionId(String SID, long userId, String sessionId) {
    try {//from   ww  w  .  ja  va 2  s .  c  o  m
        Long users_id = sessiondataDao.check(SID);
        // admin only
        if (AuthLevelUtil.hasAdminLevel(userDao.getRights(users_id))) {
            ((IApplication) Application.get(wicketApplicationName)).invalidateClient(userId, sessionId);
            return true;
        }
    } catch (Exception err) {
        log.error("[kickUserBySessionId]", err);
    }
    return false;
}

From source file:org.apache.openmeetings.core.util.WebSocketHelper.java

License:Apache License

public static IApplication getApp() {
    return (IApplication) Application.get(getWicketApplicationName());
}

From source file:org.apache.openmeetings.service.mail.EmailManager.java

License:Apache License

public static String getString(long id) {
    return ((IApplication) Application.get(wicketApplicationName)).getOmString(id);
}

From source file:org.apache.openmeetings.service.mail.EmailManager.java

License:Apache License

/**
 * sends a mail address to the user with his account data
 * /*w w w  .  j  a va  2 s .  c  om*/
 * @param username
 * @param userpass
 * @param email
 * @param hash
 * @return
 * @throws Exception
 */
public String sendMail(String username, String userpass, String email, String hash,
        Boolean sendEmailWithVerficationCode, Long langId) {
    log.debug("sendMail:: username = {}, email = {}", username, email);
    Integer sendEmailAtRegister = configurationDao.getConfValue("sendEmailAtRegister", Integer.class, "0");

    String link = ((IApplication) Application.get(wicketApplicationName))
            .urlForActivatePage(new PageParameters().add("u", hash));

    if (sendEmailAtRegister == 1) {
        ensureApplication(langId != null ? langId
                : configurationDao.getConfValue(CONFIG_DEFAULT_LANG_KEY, Long.class, "1"));
        mailHandler.send(email, getString(512), RegisterUserTemplate.getEmail(username, userpass, email,
                sendEmailWithVerficationCode ? link : null));
    }
    return "success";
}

From source file:org.artifactory.webapp.WebappServiceImpl.java

License:Open Source License

@Override
public void rebuildSiteMap() {
    // get the first application key (in aol it will not work!)
    ArtifactoryApplication app = (ArtifactoryApplication) Application
            .get(Application.getApplicationKeys().iterator().next());
    // we must attach the application to the current thread in order to perform wicket operation
    ThreadContext.setApplication(app);/*w  w w  .  j a va  2s.  c  o m*/
    try {
        app.rebuildSiteMap();
    } finally {
        ThreadContext.detach();
    }
}