Package net.solarnetwork.node.setup
Class ClasspathSetupResource
java.lang.Object
net.solarnetwork.node.setup.BaseStaticSetupResource
net.solarnetwork.node.setup.ClasspathSetupResource
- All Implemented Interfaces:
SetupResource
Static classpath based implementation of
SetupResource.- Version:
- 1.1
- Author:
- matt
-
Field Summary
Fields inherited from interface net.solarnetwork.node.setup.SetupResource
AUTHENTICATED_USER_ROLE, CACHE_DISABLED, CSS_CONTENT_TYPE, HTML_CONTENT_TYPE, JAVASCRIPT_CONTENT_TYPE, JSON_CONTENT_TYPE, USER_ROLES, WEB_CONSUMER_TYPES -
Constructor Summary
ConstructorsConstructorDescriptionClasspathSetupResource(String uid, String path, Class<?> clazz, String contentType) Construct with values.ClasspathSetupResource(String uid, String path, Class<?> clazz, String contentType, Locale locale, int cacheSeconds) Construct with values.ClasspathSetupResource(String uid, String path, Class<?> clazz, String contentType, Locale locale, int cacheSeconds, Set<String> consumerTypes, Set<String> roles) Constructor.ClasspathSetupResource(String uid, String path, Class<?> clazz, String contentType, Locale locale, int cacheSeconds, Set<String> consumerTypes, Set<String> roles, SetupResourceScope scope) Full constructor.ClasspathSetupResource(String uid, String path, Class<?> clazz, String contentType, Set<String> consumerTypes) Construct with values.ClasspathSetupResource(String uid, String path, Class<?> clazz, String contentType, Set<String> consumerTypes, Set<String> roles) Construct with values. -
Method Summary
Methods inherited from class net.solarnetwork.node.setup.BaseStaticSetupResource
contentLength, getCacheMaximumSeconds, getContentType, getLocale, getRequiredRoles, getResourceUID, getScope, getSupportedConsumerTypes, lastModified
-
Constructor Details
-
ClasspathSetupResource
public ClasspathSetupResource(String uid, String path, Class<?> clazz, String contentType) throws IOException Construct with values. Caching will be one day, and all consumer types will be supported. The locale will be inferred from the path.- Parameters:
uid- theresourceUIDvaluepath- the classpath resource pathclazz- the class to load the resource relative tocontentType- the content tpye- Throws:
IOException- if an error occurs accessing the resource
-
ClasspathSetupResource
public ClasspathSetupResource(String uid, String path, Class<?> clazz, String contentType, Set<String> consumerTypes) throws IOException Construct with values. Caching will be one day. The locale will be inferred from the path.- Parameters:
uid- theresourceUIDvaluepath- the classpath resource pathclazz- the class to load the resource relative tocontentType- the content typeconsumerTypes- the optional consumer types- Throws:
IOException- if an error occurs accessing the resource
-
ClasspathSetupResource
public ClasspathSetupResource(String uid, String path, Class<?> clazz, String contentType, Set<String> consumerTypes, Set<String> roles) throws IOException Construct with values. Caching will be one day. The locale will be inferred from the path.- Parameters:
uid- theresourceUIDvaluepath- the classpath resource pathclazz- the class to load the resource relative tocontentType- the content typeconsumerTypes- the optional consumer typesroles- the optional required roles- Throws:
IOException- if an error occurs accessing the resource
-
ClasspathSetupResource
public ClasspathSetupResource(String uid, String path, Class<?> clazz, String contentType, Locale locale, int cacheSeconds) throws IOException Construct with values.- Parameters:
uid- theresourceUIDvaluepath- the classpath resource pathclazz- the class to load the resource relative tocontentType- the content typelocale- the localecacheSeconds- the maximum cache seconds- Throws:
IOException- if an error occurs accessing the resource
-
ClasspathSetupResource
public ClasspathSetupResource(String uid, String path, Class<?> clazz, String contentType, Locale locale, int cacheSeconds, Set<String> consumerTypes, Set<String> roles) throws IOException Constructor.- Parameters:
uid- theresourceUIDvaluepath- the classpath resource pathclazz- the class to load the resource relative tocontentType- the content typelocale- the localecacheSeconds- the maximum cache secondsconsumerTypes- the optional consumer typesroles- the optional required roles- Throws:
IOException- if an error occurs accessing the resource
-
ClasspathSetupResource
public ClasspathSetupResource(String uid, String path, Class<?> clazz, String contentType, Locale locale, int cacheSeconds, Set<String> consumerTypes, Set<String> roles, SetupResourceScope scope) throws IOException Full constructor.- Parameters:
uid- theresourceUIDvaluepath- the classpath resource pathclazz- the class to load the resource relative tocontentType- the content typelocale- the localecacheSeconds- the maximum cache secondsconsumerTypes- the optional consumer typesroles- the optional required rolesscope- the scope to use- Throws:
IOException- if an error occurs accessing the resource- Since:
- 1.1
-
-
Method Details
-
getInputStream
Description copied from interface:SetupResourceReturn a newInputStream. This method should return a new stream each time it is called.- Returns:
- the input stream for the underlying resource (must not be null)
- Throws:
IOException- if the stream could not be opened
-