Package nl.vpro.web.servlet
Class ConfigurationServlet
java.lang.Object
javax.servlet.GenericServlet
javax.servlet.http.HttpServlet
nl.vpro.web.servlet.ConfigurationServlet
- All Implemented Interfaces:
Serializable
,javax.servlet.Servlet
,javax.servlet.ServletConfig
public class ConfigurationServlet
extends javax.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
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
doGet
(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) static Context
protected ConfigurationServlet.Environment
protected long
getLastModified
(javax.servlet.http.HttpServletRequest req) protected String
getName()
getProperties
(javax.servlet.http.HttpServletRequest req) getProperties
(javax.servlet.ServletContext context, javax.servlet.http.HttpServletRequest request) getSystem
(javax.servlet.http.HttpServletRequest req) void
init()
protected void
protected void
merge
(javax.servlet.http.HttpServletRequest req, InputStream is, Map<String, Object> map) protected void
mergeServletContextResource
(javax.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 javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPost, doPut, doTrace, service, service
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, 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 classjavax.servlet.GenericServlet
-
getLastModified
protected long getLastModified(javax.servlet.http.HttpServletRequest req) - Overrides:
getLastModified
in classjavax.servlet.http.HttpServlet
-
doGet
protected void doGet(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) throws IOException - Overrides:
doGet
in classjavax.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(javax.servlet.http.HttpServletRequest req, InputStream is, Map<String, Object> map) throws IOException- Throws:
IOException
-
merge
protected void merge(javax.servlet.http.HttpServletRequest req, File file, Map<String, Object> map) throws IOException- Throws:
IOException
-
mergeServletContextResource
protected void mergeServletContextResource(javax.servlet.http.HttpServletRequest req, String path, Map<String, Object> map) throws IOException- Throws:
IOException
-
getSystem
protected Map<String,String> getSystem(javax.servlet.http.HttpServletRequest req) throws IOException - Throws:
IOException
-
getEnvironment
-
getProperties
protected Map<String,Object> getProperties(javax.servlet.http.HttpServletRequest req) throws IOException - Throws:
IOException
-
getName
-