Package com.djrapitops.plan.delivery.web
Class ResourceSvc
java.lang.Object
com.djrapitops.plan.delivery.web.ResourceSvc
- All Implemented Interfaces:
ResourceService
ResourceService implementation.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.djrapitops.plan.delivery.web.ResourceService
ResourceService.Holder, ResourceService.Position
-
Field Summary
-
Constructor Summary
ConstructorDescriptionResourceSvc(PlanFiles files, PlanConfig config, Locale locale, net.playeranalytics.plugin.server.PluginLogger logger, ErrorLogger errorLogger)
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addScriptsToResource(String pluginName, String fileName, ResourceService.Position position, String... jsSources)
Add javascript to load in an existing html resource.void
addStylesToResource(String pluginName, String fileName, ResourceService.Position position, String... cssSources)
Add css to load in an existing html resource.void
checkParams(String pluginName, String fileName, ResourceService.Position position, String[] jsSources)
void
checkParams(String pluginName, String fileName, Supplier<WebResource> source)
getOrWriteCustomized(String fileName, Supplier<WebResource> source)
getResource(String pluginName, String fileName, Supplier<WebResource> source)
Make one of your web resources customizable by user or Plan API.getTheResource(String pluginName, String fileName, Supplier<WebResource> source)
readCustomized(Resource customizedResource)
void
register()
writeCustomized(String fileName, Supplier<WebResource> source)
-
Field Details
-
snippets
-
-
Constructor Details
-
ResourceSvc
@Inject public ResourceSvc(PlanFiles files, PlanConfig config, Locale locale, net.playeranalytics.plugin.server.PluginLogger logger, ErrorLogger errorLogger)
-
-
Method Details
-
register
public void register() -
getResource
Description copied from interface:ResourceService
Make one of your web resources customizable by user or Plan API.- Specified by:
getResource
in interfaceResourceService
- Parameters:
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.- Returns:
- Resource of the customized file.
-
checkParams
-
getTheResource
public WebResource getTheResource(String pluginName, String fileName, Supplier<WebResource> source) -
getOrWriteCustomized
public WebResource getOrWriteCustomized(String fileName, Supplier<WebResource> source) throws IOException- Throws:
IOException
-
readCustomized
- Throws:
IOException
-
writeCustomized
public WebResource writeCustomized(String fileName, Supplier<WebResource> source) throws IOException- Throws:
IOException
-
addScriptsToResource
public void addScriptsToResource(String pluginName, String fileName, ResourceService.Position position, String... jsSources)Description copied from interface:ResourceService
Add javascript to load in an existing html resource.Adds
<script src="jsSrc"></script>
or multiple to the resource.- Specified by:
addScriptsToResource
in interfaceResourceService
- Parameters:
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.jsSources
- Source URLs.
-
checkParams
public void checkParams(String pluginName, String fileName, ResourceService.Position position, String[] jsSources) -
addStylesToResource
public void addStylesToResource(String pluginName, String fileName, ResourceService.Position position, String... cssSources)Description copied from interface:ResourceService
Add css to load in an existing html resource.Adds
<link href="cssSrc" rel="stylesheet"></link>
or multiple to the resource.- Specified by:
addStylesToResource
in interfaceResourceService
- Parameters:
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.cssSources
- Source URLs.
-