Author: hlship
Date: Thu Aug  7 18:18:50 2008
New Revision: 683784

URL: http://svn.apache.org/viewvc?rev=683784&view=rev
Log:
TAPESTRY-2489: The ServiceStatus page should not reveal so much information in 
production mode, out of security concerns

Added:
    
tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/pages/ServiceStatus.properties
Modified:
    tapestry/tapestry5/trunk/src/site/apt/guide/servicestatus.apt
    
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/ServiceStatus.java
    
tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/pages/ServiceStatus.tml

Modified: tapestry/tapestry5/trunk/src/site/apt/guide/servicestatus.apt
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/src/site/apt/guide/servicestatus.apt?rev=683784&r1=683783&r2=683784&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/src/site/apt/guide/servicestatus.apt (original)
+++ tapestry/tapestry5/trunk/src/site/apt/guide/servicestatus.apt Thu Aug  7 
18:18:50 2008
@@ -22,4 +22,6 @@
   Virtual services have been referenced and have gotten as far as creating a 
service proxy.
   
   Real services have had methods invoked, this forces the <realization> of the 
service which includes
-  instantiating the service, injecting dependencies, and decorating with any 
applicable interceptors.
\ No newline at end of file
+  instantiating the service, injecting dependencies, and decorating with any 
applicable interceptors.
+
+  <The Service Status page does not display service information when the 
application is in production mode.>
\ No newline at end of file

Modified: 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/ServiceStatus.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/ServiceStatus.java?rev=683784&r1=683783&r2=683784&view=diff
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/ServiceStatus.java
 (original)
+++ 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/ServiceStatus.java
 Thu Aug  7 18:18:50 2008
@@ -14,12 +14,14 @@
 
 package org.apache.tapestry5.corelib.pages;
 
-import org.apache.tapestry5.annotations.Meta;
+import org.apache.tapestry5.SymbolConstants;
+import org.apache.tapestry5.annotations.ContentType;
 import org.apache.tapestry5.annotations.Property;
 import org.apache.tapestry5.beaneditor.BeanModel;
 import org.apache.tapestry5.ioc.Messages;
 import org.apache.tapestry5.ioc.Registry;
 import org.apache.tapestry5.ioc.annotations.Inject;
+import org.apache.tapestry5.ioc.annotations.Symbol;
 import org.apache.tapestry5.ioc.services.ServiceActivity;
 import org.apache.tapestry5.ioc.services.ServiceActivityScoreboard;
 import org.apache.tapestry5.services.BeanModelSource;
@@ -29,11 +31,9 @@
 /**
  * Page used to see the status of all services defined by the [EMAIL 
PROTECTED] Registry}.
  * <p/>
- * TODO: Add filters to control which services are displayed.
- * <p/>
- * TODO: Disable this page if in production mode (or not, as it does no harm).
+ * TODO: Add filters to control which services are displayed
  */
[EMAIL PROTECTED]("tapestry.response-content-type=text/html")
[EMAIL PROTECTED]("text/html")
 public class ServiceStatus
 {
     @Inject
@@ -54,6 +54,11 @@
     @Inject
     private Messages messages;
 
+    @Property
+    @Inject
+    @Symbol(SymbolConstants.PRODUCTION_MODE)
+    private boolean productionMode;
+
     {
         model = source.create(ServiceActivity.class, false, messages);
 

Added: 
tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/pages/ServiceStatus.properties
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/pages/ServiceStatus.properties?rev=683784&view=auto
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/pages/ServiceStatus.properties
 (added)
+++ 
tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/pages/ServiceStatus.properties
 Thu Aug  7 18:18:50 2008
@@ -0,0 +1,15 @@
+# Copyright 2008 The Apache Software Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+service-status-hidden=Detailed service status is only available in development 
mode.

Modified: 
tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/pages/ServiceStatus.tml
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/pages/ServiceStatus.tml?rev=683784&r1=683783&r2=683784&view=diff
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/pages/ServiceStatus.tml
 (original)
+++ 
tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/pages/ServiceStatus.tml
 Thu Aug  7 18:18:50 2008
@@ -26,47 +26,54 @@
 
         <p>${activity.size()} services defined in the IoC Registry.</p>
 
-        <t:grid rowsperpage="100" model="model" pagerposition="top" 
rowClass="row.status"
-                source="activity" row="row">
+        <t:unless test="productionMode">
 
-            <t:parameter name="serviceInterfaceCell">
-                ${row.serviceInterface}
-            </t:parameter>
-
-        </t:grid>
-
-        <p>
-            Explanation of status:
-            <dl>
-                <dt>Builtin</dt>
-                <dd>
-                    A fundamental service that exists even before the Registry 
is
-                    created.
-                </dd>
-
-                <dt>Defined</dt>
-                <dd>
-                    The service is defined, but has not yet been referenced.
-                </dd>
-
-                <dt>Virtual</dt>
-                <dd>
-                    The service has been referenced (usually for injection into
-                    another service) but has not yet been
-                    <em>realized</em>
-                    into an instantiated service. Realization occurs with the
-                    first method invocation on the proxy.
-                </dd>
-
-                <dt>Real</dt>
-                <dd>
-                    The service has been realized: instantiated, dependencies
-                    injected, decorated with interceptors and is fully in
-                    operation.
-                </dd>
-
-            </dl>
-        </p>
+            <t:grid rowsperpage="100" model="model" rowClass="row.status" 
source="activity" row="row">
 
+                <t:parameter name="serviceInterfaceCell">
+                    ${row.serviceInterface}
+                </t:parameter>
+
+            </t:grid>
+
+            <p>
+                Explanation of status:
+                <dl>
+                    <dt>Builtin</dt>
+                    <dd>
+                        A fundamental service that exists even before the 
Registry is
+                        created.
+                    </dd>
+
+                    <dt>Defined</dt>
+                    <dd>
+                        The service is defined, but has not yet been 
referenced.
+                    </dd>
+
+                    <dt>Virtual</dt>
+                    <dd>
+                        The service has been referenced (usually for injection 
into
+                        another service) but has not yet been
+                        <em>realized</em>
+                        into an instantiated service. Realization occurs with 
the
+                        first method invocation on the proxy.
+                    </dd>
+
+                    <dt>Real</dt>
+                    <dd>
+                        The service has been realized: instantiated, 
dependencies
+                        injected, decorated with interceptors and is fully in
+                        operation.
+                    </dd>
+
+                </dl>
+            </p>
+
+            <t:parameter name="else">
+                <p>
+                    <em>${message:service-status-hidden}</em>
+                </p>
+            </t:parameter>
+        </t:unless>
     </body>
 </html>
\ No newline at end of file


Reply via email to