Package nl.vpro.web.servlet
Class ConfigurationServlet
java.lang.Object
jakarta.servlet.GenericServlet
jakarta.servlet.http.HttpServlet
nl.vpro.web.servlet.ConfigurationServlet
- All Implemented Interfaces:
jakarta.servlet.Servlet
,jakarta.servlet.ServletConfig
,Serializable
public class ConfigurationServlet
extends jakarta.servlet.http.HttpServlet
Serves a 'configuration.js' for javascript clients.
Expects an init param "name" with that it determines the 'environment' via
- Either it is the system property vpro.[name].env
- If that is missing it is the application context variable vpro/[name]/env
- If that is missing too, it is
ConfigurationServlet.Environment.PROD
- The resource [name].properties
- The resource [name].[env];properties (if exists)
- The file /WEB-INF/classes/[name].properties (if exists)
- The file /WEB-INF/classes/[name].[env];properties (if exists)
- The file ${user.home}/conf/[name].properties (if exists)
- The file ${user.home}/conf/[name].[env];properties (if exists)
- Since:
- 0.3
- Author:
- Michiel Meeuwissen
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionFields inherited from class jakarta.servlet.http.HttpServlet
LEGACY_DO_HEAD
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
doGet
(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) static Context
protected ConfigurationServlet.Environment
protected long
getLastModified
(jakarta.servlet.http.HttpServletRequest req) protected String
getName()
getProperties
(jakarta.servlet.http.HttpServletRequest req) getProperties
(jakarta.servlet.ServletContext context, jakarta.servlet.http.HttpServletRequest request) getSystem
(jakarta.servlet.http.HttpServletRequest req) void
init()
protected void
protected void
merge
(jakarta.servlet.http.HttpServletRequest req, InputStream is, Map<String, Object> map) protected void
mergeServletContextResource
(jakarta.servlet.http.HttpServletRequest req, String path, Map<String, Object> map) protected void
write
(String varName, @NonNull OutputStream outputStream, @NonNull Map<String, String> system, @NonNull Map<String, Object> props) Methods inherited from class jakarta.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPost, doPut, doTrace, init, service, service
Methods inherited from class jakarta.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, log, log
-
Field Details
-
SYSTEM_PROP_MAP
-
-
Constructor Details
-
ConfigurationServlet
public ConfigurationServlet()
-
-
Method Details
-
getContext
- Throws:
NamingException
-
getProperties
-
init
public void init()- Overrides:
init
in classjakarta.servlet.GenericServlet
-
getLastModified
protected long getLastModified(jakarta.servlet.http.HttpServletRequest req) - Overrides:
getLastModified
in classjakarta.servlet.http.HttpServlet
-
doGet
protected void doGet(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) throws IOException - Overrides:
doGet
in classjakarta.servlet.http.HttpServlet
- Throws:
IOException
-
write
protected void write(String varName, @NonNull OutputStream outputStream, @NonNull Map<String, String> system, @NonNull Map<String, throws IOExceptionObject> props) - Throws:
IOException
-
merge
protected void merge(jakarta.servlet.http.HttpServletRequest req, InputStream is, Map<String, Object> map) throws IOException- Throws:
IOException
-
merge
protected void merge(jakarta.servlet.http.HttpServletRequest req, File file, Map<String, Object> map) throws IOException- Throws:
IOException
-
mergeServletContextResource
protected void mergeServletContextResource(jakarta.servlet.http.HttpServletRequest req, String path, Map<String, Object> map) throws IOException- Throws:
IOException
-
getSystem
protected Map<String,String> getSystem(jakarta.servlet.http.HttpServletRequest req) throws IOException - Throws:
IOException
-
getEnvironment
-
getProperties
protected Map<String,Object> getProperties(jakarta.servlet.http.HttpServletRequest req) throws IOException - Throws:
IOException
-
getName
-