Example usage for org.apache.wicket.resource.loader ComponentStringResourceLoader loadStringResource

List of usage examples for org.apache.wicket.resource.loader ComponentStringResourceLoader loadStringResource

Introduction

In this page you can find the example usage for org.apache.wicket.resource.loader ComponentStringResourceLoader loadStringResource.

Prototype

@Override
public String loadStringResource(final Component component, final String key, final Locale locale,
        final String style, final String variation) 

Source Link

Usage

From source file:com.evolveum.midpoint.web.security.MidPointAuthWebSession.java

License:Apache License

@Override
public boolean authenticate(String username, String password) {
    LOGGER.debug("Authenticating '{}' {} password in web session.",
            new Object[] { username, (StringUtils.isEmpty(password) ? "without" : "with") });

    boolean authenticated;
    try {/*from  ww w . jav a2s.  c o m*/
        Authentication authentication = authenticationProvider
                .authenticate(new UsernamePasswordAuthenticationToken(username, password));
        SecurityContextHolder.getContext().setAuthentication(authentication);
        authenticated = authentication.isAuthenticated();

        auditEvent(authentication, username, OperationResultStatus.SUCCESS);
    } catch (AuthenticationException ex) {
        ComponentStringResourceLoader comp = new ComponentStringResourceLoader();
        error(comp.loadStringResource(MidPointApplication.class, ex.getMessage(), getLocale(), "", ""));

        LOGGER.debug("Couldn't authenticate user.", ex);
        authenticated = false;

        auditEvent(null, username, OperationResultStatus.FATAL_ERROR);
    }

    return authenticated;
}

From source file:org.hippoecm.frontend.editor.plugins.resource.ImageDisplayPlugin.java

License:Apache License

private String lookupLinkLabel(final String filename) {
    String linkLabel;/*w ww  . ja va 2  s .  c  om*/

    if (HippoNodeType.NT_RESOURCE.equals(filename)) {
        ComponentStringResourceLoader componentStringResourceLoader = new ComponentStringResourceLoader();
        linkLabel = componentStringResourceLoader.loadStringResource(this, "download.link", getLocale(), null,
                null);
    } else {
        linkLabel = filename;
    }
    return linkLabel;
}

From source file:org.openengsb.ui.admin.global.menu.MenuTemplate.java

License:Apache License

@SuppressWarnings({ "unchecked", "rawtypes" })
public void addMenuItem(String index, Class<? extends WebPage> linkClass, String langKey, String langDescKey,
        ResourceReference icon, String... authority) {

    ComponentStringResourceLoader csrl = new ComponentStringResourceLoader();
    String label = csrl.loadStringResource(linkClass, langKey, getSession().getLocale(),
            getSession().getStyle(), "");
    String description = csrl.loadStringResource(linkClass, langDescKey, getSession().getLocale(),
            getSession().getStyle(), "");
    BookmarkablePageLabelLink pageLabelLink = new BookmarkablePageLabelLink("link", linkClass, label);
    addAuthorizationRoles(pageLabelLink, authority);

    if (icon == null) {
        menuItems.add(new MenuItem(index, pageLabelLink, description));
    } else {//from   w  ww.  j a  v a2 s  . co  m
        menuItems.add(new MenuItem(index, pageLabelLink, description, icon));
    }
    avialableItems.add(index);
}