You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by hl...@apache.org on 2005/03/08 23:36:41 UTC

cvs commit: jakarta-tapestry/framework/src/java/org/apache/tapestry/services/impl AbsoluteURLBuilderImpl.java

hlship      2005/03/08 14:36:41

  Modified:    config   common.properties
               framework/src/descriptor/META-INF tapestry.request.xml
               examples/Workbench/src/context/WEB-INF Border.html
               framework/src/java/org/apache/tapestry/pages Exception.css
                        Exception.java Exception.html Exception.page
               .        .classpath
               examples/Workbench/src/context/css workbench.css
               framework/src/java/org/apache/tapestry Framework.library
               framework/src/java/org/apache/tapestry/services/impl
                        AbsoluteURLBuilderImpl.java
  Added:       framework/src/java/org/apache/tapestry/html
                        RequestDisplay.jwc RequestDisplay.java
                        RequestDisplay.html
  Log:
  Move the code for displaying the request objects into its own component, RequestDisplay.
  Adjust the Workbench's Border component to use the RequestDisplay component and adjust the CSS stylesheet to match.
  
  Revision  Changes    Path
  1.1                  jakarta-tapestry/framework/src/java/org/apache/tapestry/html/RequestDisplay.jwc
  
  Index: RequestDisplay.jwc
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <!-- 
     Copyright 2005 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.
  -->
  
  <!DOCTYPE component-specification PUBLIC 
    "-//Apache Software Foundation//Tapestry Specification 3.1//EN" 
    "http://jakarta.apache.org/tapestry/dtd/Tapestry_3_1.dtd">
  		
  <component-specification class="org.apache.tapestry.html.RequestDisplay" 
  	allow-body="no" 
  	allow-informal-parameters="no">
    
    <description>
    Displays an HTML representation of the request, session, context and servlet.
    </description>
    
    <inject property="request" object="service:tapestry.globals.HttpServletRequest"/>
    <inject property="context" object="service:tapestry.globals.ServletContext"/>
    <inject property="servlet" object="service-property:tapestry.globals.ApplicationGlobals:servlet"/>  
  
  </component-specification>
  
  
  
  1.1                  jakarta-tapestry/framework/src/java/org/apache/tapestry/html/RequestDisplay.java
  
  Index: RequestDisplay.java
  ===================================================================
  // Copyright 2005 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.
  
  package org.apache.tapestry.html;
  
  import java.util.Collections;
  import java.util.Iterator;
  import java.util.List;
  import java.util.Properties;
  import java.util.StringTokenizer;
  
  import org.apache.tapestry.BaseComponent;
  import org.apache.tapestry.IMarkupWriter;
  import org.apache.tapestry.IRender;
  import org.apache.tapestry.IRequestCycle;
  import org.apache.tapestry.web.WebUtils;
  
  /**
   * Supports the {@link org.apache.tapestry.pages.Exception}&nbsp;page by displaying the request,
   * session, servlet context and servlet object for the current request.
   * 
   * @author Howard M. Lewis Ship
   * @since 3.1
   */
  public abstract class RequestDisplay extends BaseComponent
  {
  
      public void renderSystemProperties(IMarkupWriter writer)
      {
  
          Properties p = System.getProperties();
  
          String pathSeparator = p.getProperty("path.separator");
  
          writer.begin("div");
          writer.attribute("class", "described-object-title");
          writer.print("JVM System Properties");
          writer.end();
          writer.println();
  
          writer.begin("table");
          writer.attribute("class", "described-object");
  
          Iterator i = WebUtils.toSortedList(p.keys()).iterator();
  
          while (i.hasNext())
          {
              String key = (String) i.next();
              String value = p.getProperty(key);
  
              renderKeyAndValue(writer, key, value, pathSeparator);
          }
  
          writer.end();
      }
  
      private void renderKeyAndValue(IMarkupWriter writer, String key, String value,
              String pathSeparator)
      {
          String[] values = split(key, value, pathSeparator);
  
          for (int i = 0; i < values.length; i++)
          {
              writer.begin("tr");
              writer.begin("th");
  
              if (i == 0)
                  writer.print(key);
  
              writer.end();
              writer.begin("td");
              writer.print(values[i]);
              writer.end("tr");
              writer.println();
          }
      }
  
      private String[] split(String key, String value, String pathSeparator)
      {
          if (!key.endsWith(".path"))
              return new String[]
              { value };
  
          StringTokenizer tokenizer = new StringTokenizer(value, pathSeparator);
          List values = Collections.list(tokenizer);
  
          return (String[]) values.toArray(new String[values.size()]);
      }
  
      public IRender getSystemPropertiesRenderer()
      {
          return new IRender()
          {
              public void render(IMarkupWriter writer, IRequestCycle cycle)
              {
                  renderSystemProperties(writer);
              }
          };
      }
  }
  
  
  1.1                  jakarta-tapestry/framework/src/java/org/apache/tapestry/html/RequestDisplay.html
  
  Index: RequestDisplay.html
  ===================================================================
  <span jwcid="$content$">
  <span jwcid="@Describe" object="ognl:request"/>
  
  <span jwcid="@Conditional" condition="ognl:request.getSession(false) != null">
  <span jwcid="@Describe" object="ognl:request.session"/>
  </span>
  
  <span jwcid="@Describe" object="ognl:servlet"/>
  <span jwcid="@Describe" object="ognl:context"/>
  
  <span jwcid="@Delegator" delegate="ognl:systemPropertiesRenderer"/> 
  </span>
  
  
  1.38      +1 -1      jakarta-tapestry/config/common.properties
  
  Index: common.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/config/common.properties,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -r1.37 -r1.38
  --- common.properties	23 Feb 2005 20:40:06 -0000	1.37
  +++ common.properties	8 Mar 2005 22:36:40 -0000	1.38
  @@ -12,7 +12,7 @@
   # See the License for the specific language governing permissions and
   # limitations under the License.
   
  -hivemind.version=1.1-alpha-2
  +hivemind.version=1.1-alpha-3-snapshot
   javassist.version=3.0-rc-1
   ognl.version=2.6.7
   codec.version=1.3
  
  
  
  1.20      +3 -3      jakarta-tapestry/framework/src/descriptor/META-INF/tapestry.request.xml
  
  Index: tapestry.request.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/descriptor/META-INF/tapestry.request.xml,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- tapestry.request.xml	8 Mar 2005 16:30:10 -0000	1.19
  +++ tapestry.request.xml	8 Mar 2005 22:36:40 -0000	1.20
  @@ -109,7 +109,7 @@
       <invoke-factory>
   		<construct class="impl.WebRequestServicerPipelineBridge">
   			<set-service property="webRequestServicer" service-id="WebRequestServicerPipeline"/>
  -			<set-service property="requestGlobals" service-id="RequestGlobals"/>
  +			<set-service property="requestGlobals" service-id="tapestry.globals.RequestGlobals"/>
   		</construct>
   	</invoke-factory>
     </service-point>  
  @@ -121,7 +121,7 @@
   	
     </configuration-point>   
     
  -  <service-point id="WebRequestServicerPipeline" interface="ServletRequestServicer">
  +  <service-point id="WebRequestServicerPipeline" interface="WebRequestServicer">
       
   	A secondary pipeline for handling each requests wrapped in the WebRequest abstraction
   	layer.
  @@ -145,7 +145,7 @@
         <construct class="impl.InvokeEngineTerminator">
           <set-service property="engineManager" service-id="EngineManager"/>
           <set-service property="infrastructure" service-id="tapestry.Infrastructure"/>
  -        <set-service property="requestGlobals" service-id="RequestGlobals"/>		
  +        <set-service property="requestGlobals" service-id="tapestry.globals.RequestGlobals"/>		
         </construct>
       </invoke-factory>
     </service-point> 
  
  
  
  1.4       +1 -1      jakarta-tapestry/examples/Workbench/src/context/WEB-INF/Border.html
  
  Index: Border.html
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/examples/Workbench/src/context/WEB-INF/Border.html,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Border.html	9 Jan 2005 20:01:52 -0000	1.3
  +++ Border.html	8 Mar 2005 22:36:40 -0000	1.4
  @@ -42,7 +42,7 @@
     <tr class="data">
       <td colspan="2">
         <span jwcid="@Conditional" condition="ognl:page.visit.requestDebug">
  -        <span jwcid="@Delegator" delegate="ognl:page.requestCycle.requestContext"/>
  +        <span jwcid="@RequestDisplay"/>
         </span>
       </td>
     </tr>
  
  
  
  1.3       +0 -64     jakarta-tapestry/framework/src/java/org/apache/tapestry/pages/Exception.css
  
  Index: Exception.css
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/pages/Exception.css,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Exception.css	7 Mar 2005 19:51:56 -0000	1.2
  +++ Exception.css	8 Mar 2005 22:36:40 -0000	1.3
  @@ -51,70 +51,6 @@
   	font-weight: bold;
   }
   
  -TABLE.request-context-border  {
  -	border-width : 1;
  -	border-color : Black;
  -}
  -
  -SPAN.request-context-object  {
  -	font-size : large;
  -	font-family : sans-serif;
  -	font-weight : bold;
  -	text-align : left;
  -}
  -
  -TR.request-context-section TH  {
  -	font-size : medium;
  -	font-family : sans-serif;
  -	font-weight : bold;
  -	text-align : center;
  -	color : White;
  -	background-color : Blue;
  -}
  -
  -TR.request-context-header TH  {
  -	font-size : small;
  -	font-family : sans-serif;
  -	font-weight : bold;
  -	text-align : center;
  -	color : White;
  -	background-color : Blue;
  -}
  -
  -TABLE.request-context-object TD
  -{
  -	width: 100%;
  -}
  -
  -TABLE.request-context-object TR.odd TD  {
  -	text-align : left;
  -	color : Black;
  -	background-color : #C0C0FF;
  -	width: 100%;
  -}
  -
  -TABLE.request-context-object TR.odd TH  {
  -	color : Black;
  -	background-color : #C0C0FF;
  -	text-align : right;
  -}
  -
  -TABLE.request-context-object TR.even TD  {
  -	text-align : left;
  -}
  -
  -TABLE.request-context-object TR.even TH  {
  -	text-align : right;
  -}
  -
  -TABLE.request-context-object  {
  -	width : 100%;
  -}
  -
  -TABLE.request-context-object TR  {
  -	vertical-align : text-top;
  -}
  -
   UL  {
   	margin-top : 0px;
   	margin-bottom : 0px;
  
  
  
  1.6       +0 -88     jakarta-tapestry/framework/src/java/org/apache/tapestry/pages/Exception.java
  
  Index: Exception.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/pages/Exception.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Exception.java	7 Mar 2005 19:51:56 -0000	1.5
  +++ Exception.java	8 Mar 2005 22:36:40 -0000	1.6
  @@ -14,21 +14,10 @@
   
   package org.apache.tapestry.pages;
   
  -import java.util.Collections;
  -import java.util.Iterator;
  -import java.util.List;
  -import java.util.Properties;
  -import java.util.StringTokenizer;
  -
  -import org.apache.tapestry.IMarkupWriter;
  -import org.apache.tapestry.IRender;
  -import org.apache.tapestry.IRequestCycle;
  -import org.apache.tapestry.describe.RenderableAdapterFactory;
   import org.apache.tapestry.event.PageDetachListener;
   import org.apache.tapestry.html.BasePage;
   import org.apache.tapestry.util.exception.ExceptionAnalyzer;
   import org.apache.tapestry.util.exception.ExceptionDescription;
  -import org.apache.tapestry.web.WebUtils;
   
   /**
    * Default exception reporting page.
  @@ -49,81 +38,4 @@
   
           setExceptions(exceptions);
       }
  -
  -    public void renderSystemProperties(IMarkupWriter writer)
  -    {
  -
  -        Properties p = System.getProperties();
  -
  -        String pathSeparator = p.getProperty("path.separator");
  -
  -        writer.begin("div");
  -        writer.attribute("class", "described-object-title");
  -        writer.print("JVM System Properties");
  -        writer.end();
  -        writer.println();
  -
  -        writer.begin("table");
  -        writer.attribute("class", "described-object");
  -
  -        Iterator i = WebUtils.toSortedList(p.keys()).iterator();
  -
  -        while (i.hasNext())
  -        {
  -            String key = (String) i.next();
  -            String value = p.getProperty(key);
  -
  -            // TODO: Split things that look like paths.
  -
  -            renderKeyAndValue(writer, key, value, pathSeparator);
  -        }
  -
  -        writer.end();
  -    }
  -
  -    private void renderKeyAndValue(IMarkupWriter writer, String key, String value,
  -            String pathSeparator)
  -    {
  -        String[] values = split(key, value, pathSeparator);
  -
  -        for (int i = 0; i < values.length; i++)
  -        {
  -            writer.begin("tr");
  -            writer.begin("th");
  -
  -            if (i == 0)
  -                writer.print(key);
  -
  -            writer.end();
  -            writer.begin("td");
  -            writer.print(values[i]);
  -            writer.end("tr");
  -            writer.println();
  -        }
  -    }
  -
  -    private String[] split(String key, String value, String pathSeparator)
  -    {
  -        if (!key.endsWith(".path"))
  -            return new String[]
  -            { value };
  -
  -        StringTokenizer tokenizer = new StringTokenizer(value, pathSeparator);
  -        List values = Collections.list(tokenizer);
  -
  -        return (String[]) values.toArray(new String[values.size()]);
  -    }
  -
  -    public IRender getSystemPropertiesRenderer()
  -    {
  -        return new IRender()
  -        {
  -            public void render(IMarkupWriter writer, IRequestCycle cycle)
  -            {
  -                renderSystemProperties(writer);
  -            }
  -        };
  -    }
  -
  -    public abstract RenderableAdapterFactory getAdapterFactory();
   }
  \ No newline at end of file
  
  
  
  1.4       +1 -10     jakarta-tapestry/framework/src/java/org/apache/tapestry/pages/Exception.html
  
  Index: Exception.html
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/pages/Exception.html,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Exception.html	7 Mar 2005 19:51:56 -0000	1.3
  +++ Exception.html	8 Mar 2005 22:36:40 -0000	1.4
  @@ -27,16 +27,7 @@
   
   <p>
   
  -<span jwcid="@Describe" object="ognl:request"/>
  -
  -<span jwcid="@Conditional" condition="ognl:request.getSession(false) != null">
  -<span jwcid="@Describe" object="ognl:request.session"/>
  -</span>
  -
  -<span jwcid="@Describe" object="ognl:servlet"/>
  -<span jwcid="@Describe" object="ognl:context"/>
  -
  -<span jwcid="@Delegator" delegate="ognl:systemPropertiesRenderer"/> 
  +<span jwcid="@RequestDisplay"/>
   
   </body>
   </html>
  
  
  
  1.6       +0 -3      jakarta-tapestry/framework/src/java/org/apache/tapestry/pages/Exception.page
  
  Index: Exception.page
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/pages/Exception.page,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Exception.page	7 Mar 2005 19:51:56 -0000	1.5
  +++ Exception.page	8 Mar 2005 22:36:40 -0000	1.6
  @@ -27,7 +27,4 @@
     
     <asset name="stylesheet" path="Exception.css"/>
     
  -  <inject property="request" object="service:tapestry.globals.HttpServletRequest"/>
  -  <inject property="context" object="service:tapestry.globals.ServletContext"/>
  -  <inject property="servlet" object="service-property:tapestry.globals.ApplicationGlobals:servlet"/>
   </page-specification>
  
  
  
  1.72      +2 -2      jakarta-tapestry/.classpath
  
  Index: .classpath
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/.classpath,v
  retrieving revision 1.71
  retrieving revision 1.72
  diff -u -r1.71 -r1.72
  --- .classpath	7 Mar 2005 19:51:57 -0000	1.71
  +++ .classpath	8 Mar 2005 22:36:40 -0000	1.72
  @@ -26,8 +26,8 @@
   	<classpathentry kind="lib" path="ext-package/lib/jCharts-0.6.0.jar"/>
   	<classpathentry kind="lib" path="ext-package/lib/cglib-full-2.0.2.jar"/>
   	<classpathentry kind="lib" path="ext-package/lib/easymockclassextension-1.1.jar"/>
  -	<classpathentry kind="lib" path="ext-package/lib/hivemind-1.1-alpha-2.jar"/>
  -	<classpathentry kind="lib" path="ext-package/lib/hivemind-lib-1.1-alpha-2.jar"/>
   	<classpathentry kind="lib" path="ext-package/lib/jboss-j2ee-3.2.1.jar"/>
  +	<classpathentry kind="lib" path="ext-package/lib/hivemind-1.1-alpha-3-snapshot.jar"/>
  +	<classpathentry kind="lib" path="ext-package/lib/hivemind-lib-1.1-alpha-3-snapshot.jar"/>
   	<classpathentry kind="output" path="bin"/>
   </classpath>
  
  
  
  1.2       +17 -44    jakarta-tapestry/examples/Workbench/src/context/css/workbench.css
  
  Index: workbench.css
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/examples/Workbench/src/context/css/workbench.css,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- workbench.css	28 Oct 2004 22:24:51 -0000	1.1
  +++ workbench.css	8 Mar 2005 22:36:40 -0000	1.2
  @@ -72,57 +72,30 @@
     margin: 0;
   }
   
  -TABLE.request-context-border  {
  -	border-width : 1;
  -	border-color : Black;
  -
  -}
  -
  -SPAN.request-context-object  {
  -	font-weight : bold;
  -	text-align : left;
  -	font-size: 12pt;
  -}
  -
  -TR.request-context-section TH  {
  -	text-align : center;
  -	color : White;
  -	background-color : #330066;
  -}
  -
  -TR.request-context-header TH  {
  -	text-align : center;
  -	color : White;
  -	background-color : #330066;
  -}
  -
  -TABLE.request-context-object TR.odd TD  {
  -	text-align : left;
  -	color : Black;
  -	background-color : Silver;
  -}
  -
  -TABLE.request-context-object TR.odd TH  {
  -	color : Black;
  -	background-color : Silver;
  -	text-align : right;
  +DIV.described-object-title
  +{
  +  font-size: large;
  +  font-weight: bold;
   }
   
  -TABLE.request-context-object TR.even TD  {
  -	text-align : left;
  +TABLE.described-object  
  +{
  +  border: 1px solid black;
  +  width: 100%;
   }
   
  -TABLE.request-context-object TR.even TH  {
  -	text-align : right;
  -}
   
  -TABLE.request-context-object  {
  -	width : 100%;
  -	font-size: 9pt;
  +TABLE.described-object TR.section TH
  +{
  +  color: white;
  +  background-color: black;
  +  text-align: center;
   }
   
  -TABLE.request-context-object TR  {
  -	vertical-align : text-top;
  +TABLE.described-object TH
  +{
  +  text-align: right;
  +  width: 1px; // Will stretch to fit.
   }
   
   TABLE.form TR
  
  
  
  1.5       +1 -0      jakarta-tapestry/framework/src/java/org/apache/tapestry/Framework.library
  
  Index: Framework.library
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/Framework.library,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Framework.library	7 Mar 2005 19:51:58 -0000	1.4
  +++ Framework.library	8 Mar 2005 22:36:40 -0000	1.5
  @@ -62,6 +62,7 @@
       <component-type type="RadioGroup" specification-path="form/RadioGroup.jwc"/>
       <component-type type="RenderBlock" specification-path="components/RenderBlock.jwc"/>
       <component-type type="RenderBody" specification-path="components/RenderBody.jwc"/>
  +    <component-type type="RequestDisplay" specification-path="html/RequestDisplay.jwc"/>
       <component-type type="Rollover" specification-path="html/Rollover.jwc"/>
       <component-type type="Select" specification-path="form/Select.jwc"/>
       <component-type type="ServiceLink" specification-path="link/ServiceLink.jwc"/>
  
  
  
  1.4       +1 -1      jakarta-tapestry/framework/src/java/org/apache/tapestry/services/impl/AbsoluteURLBuilderImpl.java
  
  Index: AbsoluteURLBuilderImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/services/impl/AbsoluteURLBuilderImpl.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- AbsoluteURLBuilderImpl.java	25 Feb 2005 15:01:54 -0000	1.3
  +++ AbsoluteURLBuilderImpl.java	8 Mar 2005 22:36:40 -0000	1.4
  @@ -37,7 +37,7 @@
   
           // Should check the length here, first.
   
  -        if (URI.substring(0, 2).equals("//"))
  +        if (URI.length()> 2 && URI.substring(0, 2).equals("//"))
           {
               buffer.append(scheme);
               buffer.append(':');
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org