All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.kohsuke.stapler.framework.adjunct.package-info Maven / Gradle / Ivy

There is a newer version: 1.263
Show newest version
/*
 * Copyright (c) 2004-2010, Kohsuke Kawaguchi
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without modification, are permitted provided
 * that the following conditions are met:
 *
 *     * Redistributions of source code must retain the above copyright notice, this list of
 *       conditions and the following disclaimer.
 *     * Redistributions in binary form must reproduce the above copyright notice, this list of
 *       conditions and the following disclaimer in the documentation and/or other materials
 *       provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

/**
 * JavaScript/CSS packaging mechanism.
 *
 * 

* A part of writing a web application involves reusing JavaScript libraries that are developed by 3rd parties. * Such JavaScript libraries often come in a package of js files, CSS, images, and so on. To integrate those * libraries to your application, you often need to do: * *

    *
  • Copy files into the webapp resource directories. *
  • If the JavaScript library depends on other JavaScript libraries, copy those, too. *
  • For each page where you use them, write script and link tags to load images and CSS, as well as their dependencies. *
* *

* This tediousness hurts the small-scale reusability of JavaScript libraries. * The adjunct framework in Stapler attempts to solve this by allowing libraries/components to express * dependencies among themselves, and grouping CSS and JavaScript together, so that a single "inclusion" * would include everything that a JavaScript library needs. * *

What packagers do

*
    *
  1. * Package JavaScript libraries as a jar file, including CSS and asset files, typically through Maven. * CSS (*.css), JavaScript (*.js), and HTML (*.html) that are only different by their extensions are grouped * into "adjunct", which becomes the unit of dependency management. All three aspects of an adjunct is optional. * More about what these files do later. * *
  2. * If this library depends on other libraries, use Maven's dependency management to have the resulting jars * express dependencies. * *
  3. * Express dependencies among adjuncts. * *
* * *

What webapp developers do

*
    *
  1. * Include adjunct jar files into WEB-INF/libs either directly or indirectly, typically via Maven. * *
  2. * Bind {@link AdjunctManager} to URL by using Stapler. This object serves adjunct JavaScript, CSS, images, and so on. * *
  3. * Use {@code } tag to load adjunct into the page. This tag expands to the {@code