portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From roger...@apache.org
Subject cvs commit: jakarta-jetspeed-2/components/jetspeed/src/java/org/apache/jetspeed/rewriter WebContentRewriter.java
Date Thu, 02 Dec 2004 01:09:19 GMT
rogerrut    2004/12/01 17:09:19

  Modified:    components/jetspeed project.xml
  Added:       components/jetspeed/src/java/org/apache/jetspeed/rewriter
                        WebContentRewriter.java
  Log:
  Initial version of WebContentPortlet & WebContentRewriter
  --> needs work on the rewriter/SSO/Preferences
  
  Revision  Changes    Path
  1.14      +5 -0      jakarta-jetspeed-2/components/jetspeed/project.xml
  
  Index: project.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/components/jetspeed/project.xml,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- project.xml	1 Dec 2004 17:06:30 -0000	1.13
  +++ project.xml	2 Dec 2004 01:09:19 -0000	1.14
  @@ -38,6 +38,11 @@
     <dependencies>
     	&spring-deps;
     	&commons-config-dep;
  +  	<dependency>
  +      <!-- portlet-api.jar must be in %MAVEN_HOME%respository/portlet-api/jars -->
  +      <id>portlet-api</id>
  +      <version>1.0</version>
  +    </dependency>
       <dependency>
         <id>jetspeed-cm</id>
         <groupId>jetspeed2</groupId>
  
  
  
  1.1                  jakarta-jetspeed-2/components/jetspeed/src/java/org/apache/jetspeed/rewriter/WebContentRewriter.java
  
  Index: WebContentRewriter.java
  ===================================================================
  /* Copyright 2004 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.jetspeed.rewriter;
  
  import javax.portlet.PortletURL;
  
  /**
   * WebContentRewriter
   *
   * @author <a href="mailto:rogerrutr@apache.org">Roger Ruttimann</a>
   * @version $Id: WebContentRewriter.java,v 1.1 2004/12/02 01:09:19 rogerrut Exp $
   */
  public class WebContentRewriter extends AbstractRewriter implements Rewriter {
  
      /** WebContentURL */
      public static final String ACTION_PARAMETER_URL = "WCURL";
  
      /*
       * Portlet URL will be used to replace all URL's 
       */
      private PortletURL actionURL = null;
      
      /**
       * Setters/getters for members
       */
      public void setActionURL(PortletURL action)
      {
          this.actionURL = action;
      }
      
      public PortletURL getActionURL()
      {
          return this.actionURL;
      }
      
  	/** rewriteURL
  	 * @param url
  	 * @param tag
  	 * @param attribute
  	 * @return the modified url which is a portlet action
  	 * 
  	 * Rewrites all urls  HREFS with a portlet action
  	 */
  	public String rewriteUrl(String url, String tag, String attribute) {
  	    
  	    /*
  	     * TODO: no default. Use default Jetspeed JIRA to make sure that the method was called
  	     */
  	    String modifiedURL = "http://nagoya.apache.org/jira/secure/BrowseProject.jspa?id=10492";
  	    if ( this.actionURL != null)
  	    {
  	        // create Action URL
  			actionURL.setParameter(this.ACTION_PARAMETER_URL, url);
  			
  			modifiedURL = actionURL.toString();
  	    }
  		
  		return modifiedURL;
  	}
  
  	/* (non-Javadoc)
  	 * @see org.apache.jetspeed.rewriter.Rewriter#shouldRemoveTag(java.lang.String)
  	 */
  	public boolean shouldRemoveTag(String tag) {
  		 if (tag.equalsIgnoreCase("html"))
  		{
  		    return true;
  		}
  		return false;	
  	}
  
  	/* (non-Javadoc)
  	 * @see org.apache.jetspeed.rewriter.Rewriter#shouldStripTag(java.lang.String)
  	 */
  	public boolean shouldStripTag(String tag) {
  		if (tag.equalsIgnoreCase("head"))
  		{
  		    return true;
  		}
  		return false;
  	}
  
  	/* (non-Javadoc)
  	 * @see org.apache.jetspeed.rewriter.Rewriter#shouldRemoveComments()
  	 */
  	public boolean shouldRemoveComments() {
  		return true;
  	}
  
  }
  
  
  

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


Mime
View raw message