Author: ssolsagl
Date: 2007-04-27 20:41:46 +0200 (Fri, 27 Apr 2007)
New Revision: 4913
Modified:
trunk/war/src/main/java/no/schibstedsok/searchportal/http/servlet/VelocityDebugServlet.java
Log:
Changed parameters. VELOCITY_DEBUG is the system property. VELOCITY_DEBUG_ON is
internal for switching border on/off
Modified:
trunk/war/src/main/java/no/schibstedsok/searchportal/http/servlet/VelocityDebugServlet.java
===================================================================
---
trunk/war/src/main/java/no/schibstedsok/searchportal/http/servlet/VelocityDebugServlet.java
2007-04-27 18:40:16 UTC (rev 4912)
+++
trunk/war/src/main/java/no/schibstedsok/searchportal/http/servlet/VelocityDebugServlet.java
2007-04-27 18:41:46 UTC (rev 4913)
@@ -30,8 +30,10 @@
public class VelocityDebugServlet extends HttpServlet{
private static final Logger LOG =
Logger.getLogger(VelocityDebugServlet.class);
+ /* Key that must be set as system property when starting tomcat */
+ private static final String VELOCITY_DEBUG = "VELOCITY_DEBUG";
/* Key for switching velocitydebug on/off */
- private static final String VELOCITY_DEBUG = "VELOCITY_DEBUG";
+ private static final String VELOCITY_DEBUG_ON = "VELOCITY_DEBUG_ON";
/* Html tag */
private static final String HTML = "html";
/* Body tag */
@@ -49,14 +51,17 @@
Element html = doc.createElement(HTML);
Element body = doc.createElement(BODY);
- if(!isLocalhost(request)) {
- LOG.warn("velocitydebug when running localhost only.");
- body.appendChild(doc.createTextNode("Localhost only."));
+ if(!isLocalhost(request) ||
!"true".equals(System.getProperty(VELOCITY_DEBUG))) {
+ LOG.warn("velocitydebug when running localhost and
VELOCITY_DEBUG set to true");
+
+ body.appendChild(doc.createTextNode("Localhost only,
start with -DVELOCITY_DEBUG=true"));
+ html.appendChild(body);
+ doc.appendChild(html);
internalWriteDocument(doc, response.getWriter());
return;
}
// TODO Auto-generated method stub
- String velocityDebug = System.getProperty(VELOCITY_DEBUG);
+ String velocityDebug = System.getProperty(VELOCITY_DEBUG_ON);
String debugStatus = "false";
if("true".equals(velocityDebug)) {
@@ -64,8 +69,12 @@
}else{
debugStatus = "true";
}
-
- System.setProperty(VELOCITY_DEBUG, debugStatus);
+ System.setProperty(VELOCITY_DEBUG_ON, debugStatus);
+
+ if(request.getQueryString() != null) {
+ response.sendRedirect("/search/?" +
request.getQueryString());
+ }
+
body.appendChild(doc.createTextNode(ON_OFF + " " +
debugStatus));
html.appendChild(body);
doc.appendChild(html);
_______________________________________________
Kernel-commits mailing list
[email protected]
http://sesat.no/mailman/listinfo/kernel-commits