Class WebResource
java.lang.Object
com.foreach.across.modules.web.resource.WebResource
Represents a single entry in the WebResourceRegistry.
All constants are deliberately Strings so they can easily be used in different view layers and custom values can be added in other modules.
As of version 3.2.0 the WebResource is mainly used as a static facade
for commonly used web resource types (eg. css() and javascript()) and
for the global constants of default buckets. Creating instances of WebResource
is deprecated and only kept for backwards compatibility.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final StringDeprecated.static final StringDeprecated.since 3.2.0 - usecss(String)orjavascript(String)insteadstatic final StringDefault buckets of web resources.static final StringDeprecated.since 3.2.0 - usecss(String)orjavascript(String)insteadstatic final Stringstatic final Stringstatic final StringDeprecated.since 3.2.0 - usecss(String)orjavascript(String)insteadstatic final StringDeprecated.since 3.2.0 - usecss(String)orjavascript(String)instead -
Constructor Summary
ConstructorsConstructorDescriptionWebResource(String type, String key, Object data, String location) Deprecated.since 3.2.0- replaced byWebResourceReference -
Method Summary
Modifier and TypeMethodDescriptionstatic CssWebResourceBuildercss()AViewElementBuilderwhich generates a link or style tag, depending if inline or url is usedstatic CssWebResourceBuilderAViewElementBuilderwhich generates a link taggetData()Deprecated.since 3.2.0 - usecss(String)orjavascript(String)insteadgetKey()Deprecated.since 3.2.0 - usecss(String)orjavascript(String)insteadDeprecated.getType()Deprecated.static JavascriptWebResourceBuilderglobalJsonData(@NonNull String key, Object data) AViewElementBuilderwhich generates a<script>element that registers the data argument as global JSON data.booleanhasKey()Deprecated.static JavascriptWebResourceBuilderAViewElementBuilderwhich generates a script tag and can be used for inline or jsonstatic JavascriptWebResourceBuilderjavascript(@NonNull String url) AViewElementBuilderwhich generates a script tag for external resourcesstatic LinkWebResourceBuilderlink()AViewElementBuilderwhich generates a link tag.static LinkWebResourceBuilderAViewElementBuilderwhich generates a link tag for the url specified.static MetaWebResourceBuildermeta()AViewElementBuilderwhich generates a meta tag.static MetaWebResourceBuilderAViewElementBuilderwhich generates a meta tag for the attribute name.voidDeprecated.since 3.2.0 - usecss(String)orjavascript(String)insteadvoidDeprecated.since 3.2.0 - usecss(String)orjavascript(String)insteadvoidsetLocation(String location) Deprecated.voidDeprecated.
-
Field Details
-
HEAD
Default buckets of web resources.- See Also:
-
CSS
- See Also:
-
JAVASCRIPT
- See Also:
-
JAVASCRIPT_PAGE_END
- See Also:
-
DATA
Deprecated.since 3.2.0 - usecss(String)orjavascript(String)insteadUsed for data that should be serialized and passed to the client (usually as json).- See Also:
-
INLINE
Deprecated.since 3.2.0 - usecss(String)orjavascript(String)insteadInline resource - entire content- See Also:
-
EXTERNAL
Deprecated.since 3.2.0 - usecss(String)orjavascript(String)insteadExternal resource - usually an absolute link- See Also:
-
RELATIVE
Deprecated.since 3.2.0 - usecss(String)orjavascript(String)insteadRelative to the context/controller being rendered - this is usually the default.- See Also:
-
VIEWS
Deprecated.since 3.2.0 - usecss(String)orjavascript(String)insteadEmbedded resource in the views directory - these usually find translated into a path using aWebResourceTranslator.- See Also:
-
-
Constructor Details
-
WebResource
Deprecated.since 3.2.0- replaced byWebResourceReference- See Also:
-
-
Method Details
-
hasKey
Deprecated. -
globalJsonData
public static JavascriptWebResourceBuilder globalJsonData(@NonNull @NonNull String key, Object data) AViewElementBuilderwhich generates a<script>element that registers the data argument as global JSON data. SeeJavascriptWebResourceBuilder.globalJsonData(String, Object)for more details.- Parameters:
key- qualified key under which to register the datadata- object that should be converted to json- Returns:
- javascript element builder
-
javascript
AViewElementBuilderwhich generates a script tag for external resources -
javascript
AViewElementBuilderwhich generates a script tag and can be used for inline or json -
css
AViewElementBuilderwhich generates a link or style tag, depending if inline or url is used -
css
AViewElementBuilderwhich generates a link tag -
link
AViewElementBuilderwhich generates a link tag for the url specified. -
link
AViewElementBuilderwhich generates a link tag. -
meta
AViewElementBuilderwhich generates a meta tag for the attribute name. -
meta
AViewElementBuilderwhich generates a meta tag. -
getKey
Deprecated.since 3.2.0 - usecss(String)orjavascript(String)instead -
getType
Deprecated. -
getLocation
Deprecated. -
setKey
Deprecated.since 3.2.0 - usecss(String)orjavascript(String)instead -
setType
Deprecated. -
setLocation
Deprecated. -
getData
Deprecated.since 3.2.0 - usecss(String)orjavascript(String)instead -
setData
Deprecated.since 3.2.0 - usecss(String)orjavascript(String)instead
-
css(String)orjavascript(String)instead