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
Fields -
Constructor Summary
ConstructorsConstructorDescriptionResourceSvc(PublicHtmlFiles publicHtmlFiles, PlanConfig config, Locale locale, dagger.Lazy<Addresses> addresses, net.playeranalytics.plugin.server.PluginLogger logger, ErrorLogger errorLogger) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddScriptsToResource(String pluginName, String fileName, ResourceService.Position position, String... jsSources) Add javascript to load in a html resource.voidaddStylesToResource(String pluginName, String fileName, ResourceService.Position position, String... cssSources) Add css to load in an existing html resource.voidcheckParams(String pluginName, String fileName, Supplier<WebResource> source) voidcheckParams(String pluginName, String fileName, ResourceService.Position position, String[] jsSources) 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) voidregister()writeCustomized(String fileName, Supplier<WebResource> source) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.djrapitops.plan.delivery.web.ResourceService
addJavascriptToResource, addStyleToResource
-
Field Details
-
snippets
-
-
Constructor Details
-
ResourceSvc
@Inject public ResourceSvc(PublicHtmlFiles publicHtmlFiles, PlanConfig config, Locale locale, dagger.Lazy<Addresses> addresses, net.playeranalytics.plugin.server.PluginLogger logger, ErrorLogger errorLogger)
-
-
Method Details
-
register
public void register() -
getResource
Description copied from interface:ResourceServiceMake one of your web resources customizable by user or Plan API.- Specified by:
getResourcein 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
-
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:ResourceServiceAdd javascript to load in a html resource.Adds
<script src="jsSrc"></script>or multiple to the resource.- Specified by:
addScriptsToResourcein 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:ResourceServiceAdd css to load in an existing html resource.Adds
<link href="cssSrc" rel="stylesheet"></link>or multiple to the resource.- Specified by:
addStylesToResourcein 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.
-