@Singleton public class ResourceSvc extends java.lang.Object implements ResourceService
ResourceService.Holder, ResourceService.Position
Modifier and Type | Field and Description |
---|---|
java.util.Set<com.djrapitops.plan.delivery.web.ResourceSvc.Snippet> |
snippets |
Constructor and Description |
---|
ResourceSvc(PlanFiles files,
PlanConfig config,
Locale locale,
com.djrapitops.plugin.logging.console.PluginLogger logger,
ErrorLogger errorLogger) |
Modifier and Type | Method and Description |
---|---|
void |
addScriptsToResource(java.lang.String pluginName,
java.lang.String fileName,
ResourceService.Position position,
java.lang.String... jsSrcs)
Add javascript to load in an existing html resource.
|
void |
addStylesToResource(java.lang.String pluginName,
java.lang.String fileName,
ResourceService.Position position,
java.lang.String... cssSrcs)
Add css to load in an existing html resource.
|
void |
checkParams(java.lang.String pluginName,
java.lang.String fileName,
ResourceService.Position position,
java.lang.String[] jsSrcs) |
void |
checkParams(java.lang.String pluginName,
java.lang.String fileName,
java.util.function.Supplier<WebResource> source) |
WebResource |
getOrWriteCustomized(java.lang.String fileName,
java.util.function.Supplier<WebResource> source) |
WebResource |
getResource(java.lang.String pluginName,
java.lang.String fileName,
java.util.function.Supplier<WebResource> source)
Make one of your web resources customizable by user or Plan API.
|
WebResource |
getTheResource(java.lang.String pluginName,
java.lang.String fileName,
java.util.function.Supplier<WebResource> source) |
WebResource |
readCustomized(Resource customizedResource) |
void |
register() |
WebResource |
writeCustomized(java.lang.String fileName,
java.util.function.Supplier<WebResource> source) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getInstance
public final java.util.Set<com.djrapitops.plan.delivery.web.ResourceSvc.Snippet> snippets
@Inject public ResourceSvc(PlanFiles files, PlanConfig config, Locale locale, com.djrapitops.plugin.logging.console.PluginLogger logger, ErrorLogger errorLogger)
public void register()
public WebResource getResource(java.lang.String pluginName, java.lang.String fileName, java.util.function.Supplier<WebResource> source)
ResourceService
getResource
in interface ResourceService
pluginName
- Name of your plugin (for config purposes)fileName
- Name of the file (for customization)source
- Supplier to use to get the original resource, it is assumed that any text based files are encoded in UTF-8.public void checkParams(java.lang.String pluginName, java.lang.String fileName, java.util.function.Supplier<WebResource> source)
public WebResource getTheResource(java.lang.String pluginName, java.lang.String fileName, java.util.function.Supplier<WebResource> source)
public WebResource getOrWriteCustomized(java.lang.String fileName, java.util.function.Supplier<WebResource> source) throws java.io.IOException
java.io.IOException
public WebResource readCustomized(Resource customizedResource) throws java.io.IOException
java.io.IOException
public WebResource writeCustomized(java.lang.String fileName, java.util.function.Supplier<WebResource> source) throws java.io.IOException
java.io.IOException
public void addScriptsToResource(java.lang.String pluginName, java.lang.String fileName, ResourceService.Position position, java.lang.String... jsSrcs)
ResourceService
Adds <script src="jsSrc"></script>
or multiple to the resource.
addScriptsToResource
in interface ResourceService
pluginName
- Name of your plugin (for config purposes)fileName
- Name of the .html file being modifiedposition
- Where to place the script tag on the page.jsSrcs
- Source URLs.public void checkParams(java.lang.String pluginName, java.lang.String fileName, ResourceService.Position position, java.lang.String[] jsSrcs)
public void addStylesToResource(java.lang.String pluginName, java.lang.String fileName, ResourceService.Position position, java.lang.String... cssSrcs)
ResourceService
Adds <link href="cssSrc" rel="stylesheet"></link>
or multiple to the resource.
addStylesToResource
in interface ResourceService
pluginName
- Name of your plugin (for config purposes)fileName
- Name of the .html file being modifiedposition
- Where to place the link tag on the page.cssSrcs
- Source URLs.