Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package net.sourceforge.jsdialect.util;
 
 
 import java.util.Map;
 
import static net.sourceforge.jsdialect.util.ContextPathAppender.appendContextPathIfRelativeResource;
import static net.sourceforge.jsdialect.util.QueryStringAppender.appendQueryStringIfNotEmpty;
import static net.sourceforge.jsdialect.util.ResourceAppender.appendResource;
import static net.sourceforge.jsdialect.util.ResourceChecker.resourceIsNotIncluded;

Add a <script src="..."><script> element to the head of the document.
public final class ScriptAppender {
    private ScriptAppender(Map<StringStringresourceUrls) {
        this. = new ResourceUrlResolver(resourceUrls);
    }
    public static ScriptAppender withResourceUrls(Map<StringStringresourceUrls) {
        return new ScriptAppender(resourceUrls);
    }

    

Parameters:
element if null, adds script to the end of head element.
    public void addScriptAfter(Arguments argumentsString keyString srcSuffixElement element,
            String... scriptParameters) {
        if (!(arguments.getContext() instanceof IWebContext)) {
            throw new UnsupportedOperationException("JQuery dialect must be used in a web environment");
        }
        String resourceUrl = .getResourceUrlOrDefault(key);
        if (resourceUrl == null) {
            throw new TemplateProcessingException("Required dependence -" + key + "- was not provided");
        }
        if (srcSuffix != null) {
            resourceUrl += srcSuffix;
        }
        resourceUrl = appendContextPathIfRelativeResource(resourceUrlarguments);
        if (resourceIsNotIncluded(resourceUrl.arguments)) {
            resourceUrl = appendQueryStringIfNotEmpty(resourceUrlscriptParameters);
            appendResource(resourceUrl.elementarguments);
        }
    }
New to GrepCode? Check out our FAQ X