updated context.xml and added check if it has been updated
This commit is contained in:
parent
f83be400dc
commit
f6be23ee4b
3 changed files with 27 additions and 26 deletions
|
|
@ -1,26 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- This file should modified and copied to /etc/tomcat7/Catalina/localhost/Zallery.xml -->
|
||||
<Context>
|
||||
|
||||
<!-- Default set of monitored resources -->
|
||||
<WatchedResource>WEB-INF/web.xml</WatchedResource>
|
||||
|
||||
<Environment type="java.lang.String" name="WEBSITE_NAME" value="Gallery" />
|
||||
<Environment type="java.lang.String" name="WEBSITE_URL" value="http://example.com/Zallery/" />
|
||||
<Environment type="java.lang.String" name="SMTP_HOST" value="127.0.0.1" />
|
||||
<Environment type="java.lang.String" name="DATA_PATH" value="C:\\data" />
|
||||
|
||||
<Resource
|
||||
name="jdbc/mysql"
|
||||
auth="Container"
|
||||
type="javax.sql.DataSource"
|
||||
username="username"
|
||||
password="password"
|
||||
driverClassName="com.mysql.jdbc.Driver"
|
||||
url="jdbc:mysql://host:3306/database"
|
||||
maxActive="8"
|
||||
maxIdle="4"
|
||||
validationQuery="SELECT 1"
|
||||
testOnBorrow="true" />
|
||||
|
||||
</Context>
|
||||
23
WebContent/META-INF/context.xml
Executable file
23
WebContent/META-INF/context.xml
Executable file
|
|
@ -0,0 +1,23 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- This file should modified and copied to /etc/tomcat7/Catalina/localhost/Zallery.xml -->
|
||||
<Context reloadable="true">
|
||||
|
||||
<Environment type="java.lang.String" name="WEBSITE_NAME" value="Gallery" />
|
||||
<Environment type="java.lang.String" name="WEBSITE_URL" value="http://example.com/Zallery/" />
|
||||
<Environment type="java.lang.String" name="SMTP_HOST" value="127.0.0.1" />
|
||||
<Environment type="java.lang.String" name="DATA_PATH" value="C:\\data" />
|
||||
|
||||
<Resource
|
||||
name="jdbc/mysql"
|
||||
auth="Container"
|
||||
type="javax.sql.DataSource"
|
||||
username="username"
|
||||
password="password"
|
||||
driverClassName="com.mysql.jdbc.Driver"
|
||||
url="jdbc:mysql://host:3306/database"
|
||||
maxActive="8"
|
||||
maxIdle="4"
|
||||
validationQuery="SELECT 1"
|
||||
testOnBorrow="true" />
|
||||
|
||||
</Context>
|
||||
|
|
@ -51,6 +51,10 @@ public class Zallery extends HttpServlet{
|
|||
ROOT_PATH = config.getServletContext().getRealPath("/");
|
||||
try {
|
||||
Context context = new InitialContext();
|
||||
// Check if Zallery has been properly configured
|
||||
if ("C:\\\\data".equals(context.lookup("java:comp/env/DATA_PATH")))
|
||||
throw new ServletException("Zallery has not been properly configured, set proper configuration in Zaller.xml context file.");
|
||||
|
||||
WEBSITE_NAME = (String)context.lookup("java:comp/env/WEBSITE_NAME");
|
||||
WEBSITE_URL = (String)context.lookup("java:comp/env/WEBSITE_URL");
|
||||
if( WEBSITE_URL.charAt(WEBSITE_URL.length()-1) != '/')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue