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() 

Source Link

Document

Get Application for current thread.

Usage

From source file:org.sakaiproject.scorm.ui.player.util.ContentPackageWebResource.java

License:Educational Community License

private boolean supportsCompression() {
    if (Application.get().getResourceSettings().getDisableGZipCompression()) {
        return false;
    }//from  w w  w.j a  v  a2s .co m
    if (RequestCycle.get() == null)
        return false;

    WebRequest request = (WebRequest) RequestCycle.get().getRequest();
    String s = request.getHttpServletRequest().getHeader("Accept-Encoding");
    if (s == null) {
        return false;
    } else {
        return s.indexOf("gzip") >= 0;
    }
}

From source file:org.sakaiproject.scorm.ui.upload.components.FileUploadForm.java

License:Educational Community License

private Folder getUploadFolder() {
    return ((ScormTool) Application.get()).getUploadFolder();
}

From source file:org.sakaiproject.sitestats.tool.facade.Locator.java

License:Educational Community License

public static SakaiFacade getFacade() {
    if (facade == null) {
        facade = ((SiteStatsApplication) Application.get()).getFacade();
    }
    return facade;
}

From source file:org.sturmm.wicketless.resource.CoffeeScriptResourceReference.java

License:Apache License

public CoffeeScriptResourceReference(Class<?> scope, String name) {
    super(scope, name);
    if (Application.get().usesDevelopmentConfig()) {
        Application.get().getResourceReferenceRegistry().unregisterResourceReference(this.getKey());
    }// w ww  .  ja  v  a 2  s.  c o m
    Application.get().getResourceReferenceRegistry().registerResourceReference(this);

}

From source file:org.sturmm.wicketless.resource.CoffeeScriptResourceReference.java

License:Apache License

@Override
public IResource getResource() {
    if (resource == null || Application.get().usesDevelopmentConfig()) {
        String script;/*w w w .j  a va  2 s  . c o  m*/
        try {
            script = IOUtils
                    .toString(getScope().getClassLoader().getResourceAsStream(getFullyQualifiedResourceName()));
        } catch (IOException e) {
            throw new CoffeeScriptResourceException(
                    "Unable to load CoffeeScript resource at '" + getFullyQualifiedResourceName() + "'", e);
        }

        resource = new CoffeeScriptResource(script);
    }

    return resource;
}

From source file:org.sturmm.wicketless.resource.LessCssResource.java

License:Apache License

public LessCssResource(Class<?> scope, String name) {
    super("text/css");
    source = new ClasspathLessSource(scope, name) {
        private static final long serialVersionUID = 1L;

        @Override//from w ww  .  jav  a 2s.  c om
        public boolean isCompressed() {
            return Application.get().usesDeploymentConfig();
        }
    };
}

From source file:org.sturmm.wicketless.resource.LessCssResourceReference.java

License:Apache License

public LessCssResourceReference(Class<?> scope, String name) {
    super(scope, name);
    if (Application.get().usesDevelopmentConfig()) {
        Application.get().getResourceReferenceRegistry().unregisterResourceReference(this.getKey());
    }//from   ww w .  java2s .co m
    Application.get().getResourceReferenceRegistry().registerResourceReference(this);

}

From source file:org.sturmm.wicketless.resource.LessCssResourceReference.java

License:Apache License

@Override
public IResource getResource() {
    if (resource == null || Application.get().usesDevelopmentConfig()) {
        resource = new LessCssResource(getScope(), getName());
    }//from  w w  w.  j  a  v a 2 s . c om

    return resource;
}

From source file:org.tdmx.console.AdminApplication.java

License:Open Source License

public static AdminApplication get() {
    Application application = Application.get();
    if (application instanceof AdminApplication == false) {
        throw new WicketRuntimeException("The application attached to the current thread is not a "
                + AdminApplication.class.getSimpleName());
    }//from w  w w.  j ava2s  .co m

    return (AdminApplication) application;
}

From source file:org.ujorm.wicket.component.tools.ChoiceRendererNullable.java

License:Apache License

/** {@inheritDoc} */
@Override//  www .  j a v  a 2  s . co  m
public Object getDisplayValue(T item) throws NullPointerException {
    final String key = resourceKey(item);
    final String defaultValue = item != null ? item.name() : "-";
    final String value = resourceSource != null ? resourceSource.getString(key, null, defaultValue)
            : Application.get().getResourceSettings().getLocalizer().getString(key, null, defaultValue);
    return postprocess(value);
}