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
Modifier and TypeFieldDescriptionstatic final String
static final String
Deprecated.static final String
Deprecated.since 3.2.0 - usecss(String)
orjavascript(String)
insteadstatic final String
Default buckets of web resources.static final String
Deprecated.since 3.2.0 - usecss(String)
orjavascript(String)
insteadstatic final String
static final String
static final String
Deprecated.since 3.2.0 - usecss(String)
orjavascript(String)
insteadstatic final String
Deprecated.since 3.2.0 - usecss(String)
orjavascript(String)
instead -
Constructor Summary
ConstructorDescriptionWebResource
(String type, String key, Object data, String location) Deprecated.since 3.2.0- replaced byWebResourceReference
-
Method Summary
Modifier and TypeMethodDescriptionstatic CssWebResourceBuilder
css()
AViewElementBuilder
which generates a link or style tag, depending if inline or url is usedstatic CssWebResourceBuilder
AViewElementBuilder
which 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 JavascriptWebResourceBuilder
globalJsonData
(@NonNull String key, Object data) AViewElementBuilder
which generates a<script>
element that registers the data argument as global JSON data.boolean
hasKey()
Deprecated.static JavascriptWebResourceBuilder
AViewElementBuilder
which generates a script tag and can be used for inline or jsonstatic JavascriptWebResourceBuilder
javascript
(@NonNull String url) AViewElementBuilder
which generates a script tag for external resourcesstatic LinkWebResourceBuilder
link()
AViewElementBuilder
which generates a link tag.static LinkWebResourceBuilder
AViewElementBuilder
which generates a link tag for the url specified.static MetaWebResourceBuilder
meta()
AViewElementBuilder
which generates a meta tag.static MetaWebResourceBuilder
AViewElementBuilder
which generates a meta tag for the attribute name.void
Deprecated.since 3.2.0 - usecss(String)
orjavascript(String)
insteadvoid
Deprecated.since 3.2.0 - usecss(String)
orjavascript(String)
insteadvoid
setLocation
(String location) Deprecated.void
Deprecated.
-
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) AViewElementBuilder
which 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
AViewElementBuilder
which generates a script tag for external resources -
javascript
AViewElementBuilder
which generates a script tag and can be used for inline or json -
css
AViewElementBuilder
which generates a link or style tag, depending if inline or url is used -
css
AViewElementBuilder
which generates a link tag -
link
AViewElementBuilder
which generates a link tag for the url specified. -
link
AViewElementBuilder
which generates a link tag. -
meta
AViewElementBuilder
which generates a meta tag for the attribute name. -
meta
AViewElementBuilder
which 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