raphael     2002/11/08 15:21:52

  Modified:    src/java/org/apache/jetspeed/services Profiler.java
               src/java/org/apache/jetspeed/services/profiler
                        JetspeedProfilerService.java ProfilerService.java
               src/java/org/apache/jetspeed/util/template
                        BaseJetspeedLink.java
  Log:
  Fix a bugwhere wml profile customization would set the media-type of current profile 
to wml
  
  Revision  Changes    Path
  1.19      +2 -1      
jakarta-jetspeed/src/java/org/apache/jetspeed/services/Profiler.java
  
  Index: Profiler.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/services/Profiler.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- Profiler.java     8 Nov 2002 10:02:44 -0000       1.18
  +++ Profiler.java     8 Nov 2002 23:21:51 -0000       1.19
  @@ -128,6 +128,7 @@
   
       /**
        * @see ProfilerService#getProfile
  +     * @deprecated Do not use a profiler method based on MimeType
        */
       public static Profile getProfile(RunData data, MimeType mt)
           throws ProfileException
  
  
  
  1.41      +17 -42    
jakarta-jetspeed/src/java/org/apache/jetspeed/services/profiler/JetspeedProfilerService.java
  
  Index: JetspeedProfilerService.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/services/profiler/JetspeedProfilerService.java,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- JetspeedProfilerService.java      8 Nov 2002 10:04:12 -0000       1.40
  +++ JetspeedProfilerService.java      8 Nov 2002 23:21:51 -0000       1.41
  @@ -215,7 +215,7 @@
   
           if (data == null)
           {
  -            map = CapabilityMapFactory.getCapabilityMap( data );
  +            map = CapabilityMapFactory.getDefaultCapabilityMap();
           }
           else
           {
  @@ -271,32 +271,6 @@
        }
   
       /**
  -     * This is the lateinitialization method called by the
  -     * Turbine <code>Service</code> framework
  -     *
  -     * @exception throws a <code>InitializationException</code> if the service
  -     * fails to initialize
  -     */
  -    public void init() throws InitializationException
  -    {
  -        if (Log.getLogger().isInfoEnabled())
  -        {
  -            Log.info( "Profiler: Late init for JetspeedProfilerService called" );
  -        }
  -        /*
  -        while( !getInit() ) {
  -            //Not yet...
  -            try {
  -                Thread.sleep( 100 );
  -                Log.info( "Waiting for init of JetspeedProfilerService..." );
  -            } catch (InterruptedException ie ) {
  -                Log.error( ie );
  -            }
  -        }
  -        */
  -    }
  -
  -    /**
        * This is the shutdown method called by the
        * Turbine <code>Service</code> framework
        */
  @@ -608,6 +582,8 @@
       /**
        *  get the Profile object using the Rundata state and specific mimetype
        *
  +     * @deprecated Do not use a profiler method based on MimeType
  +     *
        * @param rundata the rundata object for the current request
        * @param mt the <code>MimeType</code> of the current requesting device
        * @return a new Profile object
  @@ -839,21 +815,20 @@
       protected String getMediaType(RunData rundata, CapabilityMap cm)
       {
           String paramMediaType;
  +        String media = null;
  +
           if (null != rundata)
           {
               paramMediaType = rundata.getParameters().getString( 
Profiler.PARAM_MEDIA_TYPE );
               if (null != paramMediaType)
  +            {
                   return paramMediaType;
  -            paramMediaType = rundata.getParameters().getString( "mtype" );
  -            if (null != paramMediaType)
  -                return paramMediaType;
  +            }
           }
   
  -        String media = cm.getPreferredMediaType();
  -
  -        if (media == null)
  +        if (cm != null)
           {
  -            media = "";
  +            media = cm.getPreferredMediaType();
           }
   
           return media;
  @@ -928,6 +903,13 @@
       {
           DynamicURI uri = new DynamicURI( data );
   
  +       // check mediatype to add to the uri
  +        String mtype = locator.getMediaType();
  +        if (null != mtype)
  +        {
  +            uri.addPathInfo(Profiler.PARAM_MEDIA_TYPE, mtype);
  +        }
  +
           // check User, Group or Role to add to the uri
           JetspeedUser user = locator.getUser();
           if (null != user)
  @@ -957,13 +939,6 @@
           if (null != page)
           {
               uri.addPathInfo(Profiler.PARAM_PAGE, page);
  -        }
  -
  -       // check mediatype to add to the uri
  -        String mtype = data.getParameters().getString("mtype");
  -        if (null != mtype)
  -        {
  -            uri.addPathInfo(Profiler.PARAM_MEDIA_TYPE, mtype);
           }
   
           return uri;
  
  
  
  1.16      +2 -1      
jakarta-jetspeed/src/java/org/apache/jetspeed/services/profiler/ProfilerService.java
  
  Index: ProfilerService.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/services/profiler/ProfilerService.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- ProfilerService.java      8 Nov 2002 10:03:03 -0000       1.15
  +++ ProfilerService.java      8 Nov 2002 23:21:52 -0000       1.16
  @@ -104,6 +104,7 @@
        * get the Profile object using the Rundata state and capability map
        * this is the mapping functionality of the profiler
        *
  +     * @deprecated Do not use a profiler method based on MimeType
        * @param rundata the rundata object for the current request
        * @return a new Profile object
        */
  
  
  
  1.17      +92 -92    
jakarta-jetspeed/src/java/org/apache/jetspeed/util/template/BaseJetspeedLink.java
  
  Index: BaseJetspeedLink.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/util/template/BaseJetspeedLink.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- BaseJetspeedLink.java     23 Oct 2002 17:16:04 -0000      1.16
  +++ BaseJetspeedLink.java     8 Nov 2002 23:21:52 -0000       1.17
  @@ -90,42 +90,42 @@
    */
   public class BaseJetspeedLink implements ApplicationTool, JetspeedLink
   {
  -    
  +
       /**
        *<p>Request to which we refer.</p>
        */
       private JetspeedRunData rundata = null;
  -    
  +
       /**
        * Profile locator from <code>rundata</code>.  This is here
        * for performance reasons.
        */
       private ProfileLocator locator = null;
  -    
  +
       /**
        * Profile from <code>rundata</code>.  This is here
        * for performance reasons.
        */
       private Profile profile = null;
  -    
  +
       /**
        * Has the initialization for the current rundata been performed?.  This is
        * here for performance reasons.
        */
       private boolean initDone = false;
  -    
  +
       /**
        *<p>The portlet that will be used to build the reference.</p>
        */
       protected Portlet activePortlet = null;
  -    
  +
       /**
        * Empty constructor.for introspection
        */
       public BaseJetspeedLink()
       {
       }
  -    
  +
       /**
        * Constructor required by ApplicationTool interface
        *
  @@ -135,7 +135,7 @@
       {
           init((Object) data);
       }
  -    
  +
       /**
        * This will initialise a JetspeedLink object that was
        * constructed with the default constructor
  @@ -146,7 +146,7 @@
       {
           init( (Object) rundata);
       }
  -    
  +
       /**
        * Adds a name=value pair to the query string.
        *
  @@ -165,7 +165,7 @@
               return null;
           }
       }
  -    
  +
       /**
        * Adds a name=value pair to the path_info string.
        *
  @@ -184,7 +184,7 @@
               return null;
           }
       }
  -    
  +
       /**
        * Return an link to a specific portal element
        *
  @@ -202,7 +202,7 @@
           else
               return setPaneById(peid);
       }
  -    
  +
       /**
        * Return an link to a specific portlet using the portet's id
        *
  @@ -215,7 +215,7 @@
       {
           return getPortletById( peid);
       }
  -    
  +
       /**
        * Return link to the home page without user,
        * page, group, role, template, action, media type, language, or country
  @@ -227,7 +227,7 @@
       {
           return getLink( 
JetspeedLink.DEFAULT,null,"",JetspeedLink.DEFAULT,null,"","","","","");
       }
  -    
  +
       /**
        * Return a link that includes the template
        * from rundata
  @@ -239,7 +239,7 @@
           String template = rundata.getRequestedTemplate();
           return getLink( JetspeedLink.CURRENT, null, null, JetspeedLink.DEFAULT, 
null, null, template, null, null, null);
       }
  -    
  +
       /**
        * Return a link to the template.
        *
  @@ -252,7 +252,7 @@
       {
           return getTemplate(template);
       }
  -    
  +
       /**
        * Return a link that includes an action
        *
  @@ -265,7 +265,7 @@
       {
           return getAction(action);
       }
  -    
  +
       /**
        * Return a link that includes an action to a specific portlet, as defined
        * by a portlets
  @@ -280,7 +280,7 @@
       {
           return getAction( action, (Portlets) portlets);
       }
  -    
  +
       /**
        * Return a link that includes an action to a specific portlet
        *
  @@ -294,7 +294,7 @@
       {
           return getAction( action, (Portlet) portlet);
       }
  -    
  +
       /**
        * Return a link that includes an action to a specific portlet, as defined
        * by an entry
  @@ -309,7 +309,7 @@
       {
           return getAction( action, (Entry) entry);
       }
  -    
  +
       /**
        * Return a link that includes an action to a specific portlet, as defined
        * by a PEID
  @@ -323,7 +323,7 @@
       {
           return getAction( action, (String) peid);
       }
  -    
  +
       /**
        * Return a link to a default page for the group
        *
  @@ -336,7 +336,7 @@
       {
           return getGroup( group);
       }
  -    
  +
       /**
        * Return a link to a desired page for the group
        *
  @@ -350,7 +350,7 @@
       {
           return getGroup( group, page);
       }
  -    
  +
       /**
        * Return a link to a default page for the
        * current user, group, or role.
  @@ -363,7 +363,7 @@
       {
           return getPage();
       }
  -    
  +
       /**
        * Return a link to a desired page for the
        * current user, group, or role.
  @@ -377,7 +377,7 @@
       {
           return getPage(page);
       }
  -    
  +
       /**
        * Return a link to a desired page and pane for the
        * current user, group, or role.
  @@ -391,8 +391,8 @@
       {
           return getPage( page, paneName);
       }
  -    
  -    
  +
  +
       /**
        * Return a link to a default page for the role
        *
  @@ -405,7 +405,7 @@
       {
           return getRole(role);
       }
  -    
  +
       /**
        * Return a link to a desired page for the role
        *
  @@ -419,7 +419,7 @@
       {
           return getRole( role, page);
       }
  -    
  +
       /**
        * Return a link to a default page for the user
        *
  @@ -432,7 +432,7 @@
       {
           return getUser(user);
       }
  -    
  +
       /**
        * Return a link to a desired page for the user
        *
  @@ -446,7 +446,7 @@
       {
           return getUser( user, page);
       }
  -    
  +
       /**
        * Return a link to a specific pane using the pane's id
        *
  @@ -459,7 +459,7 @@
       {
           return getPaneById( paneId);
       }
  -    
  +
       /**
        * Return a link to a specific pane using the pane's id
        *
  @@ -471,7 +471,7 @@
       {
           return getPaneByName( paneName);
       }
  -    
  +
       /**
        * Return a link to a desired page.  This is allows the inclusion of a 
Group/Role/User,
        * page, template, action, media type, language, and country.
  @@ -509,7 +509,7 @@
           try
           {
               DynamicURI uri = getRoot();
  -            
  +
               // Set Group/Role/User in path
               switch (rootType)
               {
  @@ -526,18 +526,18 @@
                       uriPathType = Profiler.PARAM_USER;
                       break;
               }
  -            
  +
               if (rootType != JetspeedLink.CURRENT )
               {
                   // Cleanup URI
                   uri.removePathInfo( Profiler.PARAM_GROUP);
                   uri.removePathInfo( Profiler.PARAM_ROLE);
                   uri.removePathInfo( Profiler.PARAM_USER);
  -                
  +
                   if ((rootType != JetspeedLink.DEFAULT ) && (rootValue != null) && 
(rootValue.trim().length() > 0))
                       uri.addPathInfo( uriPathType, rootValue);
               }
  -            
  +
               // Set Page in path
               if (pageName != null)
               {
  @@ -547,7 +547,7 @@
                       uri.addPathInfo( Profiler.PARAM_PAGE, pageName);
                   }
               }
  -            
  +
               // Set Portlet/Pane in path
               switch (elementType)
               {
  @@ -567,7 +567,7 @@
                       uriPathElement = JetspeedResources.PATH_PORTLET_KEY;
                       break;
               }
  -            
  +
               if (elementType != JetspeedLink.CURRENT )
               {
                   // Remove Group/Role/User in URI
  @@ -575,11 +575,11 @@
                   uri.removePathInfo( JetspeedResources.PATH_PANENAME_KEY);
                   uri.removePathInfo( JetspeedResources.PATH_PORTLETID_KEY);
                   uri.removePathInfo( JetspeedResources.PATH_PORTLET_KEY);
  -                
  +
                   if ((elementType != JetspeedLink.DEFAULT ) && (elementValue != 
null) && (elementValue.length() > 0))
                       uri.addPathInfo( uriPathElement, elementValue);
               }
  -            
  +
               // Set Template in path
               if (templateName != null)
               {
  @@ -588,7 +588,7 @@
                   else
                       uri.removePathInfo( JetspeedResources.PATH_TEMPLATE_KEY);
               }
  -            
  +
               // Set Action in path
               if (actionName != null)
               {
  @@ -597,7 +597,7 @@
                   else
                       uri.removeQueryData( JetspeedResources.PATH_ACTION_KEY);
               }
  -            
  +
               // Set MediaType in path
               if (mediaType != null)
               {
  @@ -606,7 +606,7 @@
                   else
                       uri.removePathInfo( Profiler.PARAM_MEDIA_TYPE);
               }
  -            
  +
               // Set Language in path
               if (language != null)
               {
  @@ -615,7 +615,7 @@
                   else
                       uri.removePathInfo( Profiler.PARAM_LANGUAGE);
               }
  -            
  +
               // Set Country in path
               if (country != null)
               {
  @@ -624,7 +624,7 @@
                   else
                       uri.removePathInfo( Profiler.PARAM_COUNTRY);
               }
  -            
  +
               return uri;
           } catch (ProfileException e)
           {
  @@ -636,29 +636,29 @@
       {
           return getLink(rootType, rootValue, pageName, elementType, elementValue, 
actionName, templateName, mediaType, language, null);
       }
  -    
  +
       public DynamicURI getLink(int rootType, String rootValue, String pageName, int 
elementType, String elementValue, String actionName, String templateName, String 
mediaType)
       {
           return getLink(rootType, rootValue, pageName, elementType, elementValue, 
actionName, templateName, mediaType, null, null);
       }
  -    
  +
       public DynamicURI getLink(int rootType, String rootValue, String pageName, int 
elementType, String elementValue, String actionName, String templateName)
       {
           return getLink(rootType, rootValue, pageName, elementType, elementValue, 
actionName, actionName, null, null, null);
       }
  -    
  +
       public DynamicURI getLink(int rootType, String rootValue, String pageName, int 
elementType, String elementValue, String actionName)
       {
           return getLink(rootType, rootValue, pageName, elementType, elementValue, 
actionName, null, null, null, null);
       }
  -    
  +
       /**
  -     */    
  +     */
       public DynamicURI getLink(int rootType, String rootValue, String pageName, int 
elementType, String elementValue)
       {
           return getLink(rootType, rootValue, pageName, elementType, elementValue, 
null, null, null, null, null);
       }
  -    
  +
       /**
        * Return a link that includes an action
        *
  @@ -669,7 +669,7 @@
       {
           return getLink( JetspeedLink.CURRENT, null, null, JetspeedLink.CURRENT, 
null, action, null, null, null, null);
       }
  -    
  +
       /**
        * Return a link that includes an action to a specific portlet, as defined
        * by an entry
  @@ -685,7 +685,7 @@
           else
               return getLink( JetspeedLink.CURRENT, null, null, 
JetspeedLink.PORTLET_ID, null, null, action, null, null, null);
       }
  -    
  +
       /**
        * Return a link that includes an action to a specific portlet
        *
  @@ -700,7 +700,7 @@
           else
               return getLink( JetspeedLink.CURRENT, null, null, 
JetspeedLink.PORTLET_ID, null, action, null, null, null, null);
       }
  -    
  +
       /**
        * Return a link that includes an action to a specific portlet, as defined
        * by a portlets
  @@ -716,7 +716,7 @@
           else
               return getLink( JetspeedLink.CURRENT, null, null, 
JetspeedLink.PORTLET_ID, null, action, null, null, null, null);
       }
  -    
  +
       /**
        * Return a link that includes an action to a specific portlet, as defined
        * by a PEID
  @@ -729,7 +729,7 @@
       {
           return getLink( JetspeedLink.CURRENT, null, null, JetspeedLink.PORTLET_ID, 
peid, action, null, null, null, null);
       }
  -    
  +
       /**
        * Return a link to a default page for the group
        *
  @@ -740,7 +740,7 @@
       {
           return getLink( JetspeedLink.GROUP, group, "", JetspeedLink.DEFAULT, null, 
null,null,null,null,null);
       }
  -    
  +
       /**
        * Return a link to a desired page for the group
        *
  @@ -762,7 +762,7 @@
       {
           return getLink( JetspeedLink.CURRENT, null, "", JetspeedLink.DEFAULT, null, 
null,null,null,null,null);
       }
  -    
  +
       /**
        * Return a link to a desired page for the
        * current user, group, or role.
  @@ -774,7 +774,7 @@
       {
           return getLink( JetspeedLink.CURRENT, null, page, JetspeedLink.DEFAULT, 
null, null,null,null,null,null);
       }
  -    
  +
       /**
        * Return a link to a desired page and pane for the
        * current user, group, or role.
  @@ -797,7 +797,7 @@
       {
           return getLink( JetspeedLink.CURRENT, null, this.getPageName(), 
JetspeedLink.PANE_ID, paneId, null,null,null,null,null);
       }
  -    
  +
       /**
        * Return a link to a specific pane using the pane's id
        *
  @@ -808,7 +808,7 @@
       {
           return getLink( JetspeedLink.CURRENT, null, this.getPageName(), 
JetspeedLink.PANE_NAME, paneName, null,null,null,null,null);
       }
  -    
  +
       /**
        * Return an link to a specific portlet using the portet's id
        *
  @@ -842,7 +842,7 @@
       {
           return getLink( JetspeedLink.ROLE, role, "", JetspeedLink.DEFAULT, null, 
null,null,null,null,null);
       }
  -    
  +
       /**
        * Return a link to a desired page for the role
        *
  @@ -854,7 +854,7 @@
       {
           return getLink( JetspeedLink.ROLE, role, page, JetspeedLink.DEFAULT, null, 
null, null, null, null, null);
       }
  -    
  +
       /**
        * Return a link to the template.
        *
  @@ -865,7 +865,7 @@
       {
           return getLink( JetspeedLink.CURRENT, null, null, JetspeedLink.DEFAULT, 
null, null, template, null, null, null);
       }
  -    
  +
       /**
        * Return a link to a default page for the user
        *
  @@ -876,7 +876,7 @@
       {
           return getLink( JetspeedLink.USER, user, "", JetspeedLink.DEFAULT, null, 
null,null,null,null,null);
       }
  -    
  +
       /**
        * Return a link to a desired page for the user
        *
  @@ -888,17 +888,17 @@
       {
           return getLink( JetspeedLink.USER, user, page, JetspeedLink.DEFAULT, null, 
null,null,null,null,null);
       }
  -    
  +
       private void initLink()
       {
           if (initDone == true)
               return;
  -        
  +
           try
           {
               // get the profile that is set in the rundata
               profile = rundata.getProfile();
  -            
  +
               // if there was no profile, try making one from the rundata
               if (profile == null)
               {
  @@ -920,7 +920,7 @@
           }
           initDone = true;
       }
  -    
  +
       /**
        * Return a link to the root portlet or pane
        *
  @@ -933,10 +933,10 @@
           initLink();
           if (locator != null)
               uri = Profiler.makeDynamicURI(rundata, locator);
  -        
  +
           if (uri == null)
               uri = new DynamicURI( rundata);
  -        
  +
           // check if we need to force to a secure (https) link
           if (JetspeedResources.getBoolean("force.ssl", false))
           {
  @@ -945,7 +945,7 @@
   
           return uri;
       }
  -    
  +
       /**
        * Return a URL, as a string, the the root page or pane.
        *
  @@ -962,7 +962,7 @@
               return null;
           }
       }
  -    
  +
       /**
        * Return the action key.  Used by velocity templates, i.e. $jlink.ActionKey
        *
  @@ -972,7 +972,7 @@
       {
           return JetspeedResources.PATH_ACTION_KEY;
       }
  -    
  +
       /**
        * Is the PSML for the anonymous user?
        *
  @@ -990,7 +990,7 @@
               return true;
           }
       }
  -    
  +
       /**
        * Return country of the PSML file
        *
  @@ -1008,7 +1008,7 @@
               return null;
           }
       }
  -    
  +
       /**
        * Return Group name of the PSML file
        *
  @@ -1026,7 +1026,7 @@
               return null;
           }
       }
  -    
  +
       /**
        * Return Language of the PSML file
        *
  @@ -1044,7 +1044,7 @@
               return null;
           }
       }
  -    
  +
       /**
        * Return Media Type of the PSML file
        *
  @@ -1062,7 +1062,7 @@
               return null;
           }
       }
  -    
  +
       /**
        * Return Page name of the PSML file
        *
  @@ -1080,7 +1080,7 @@
               return null;
           }
       }
  -    
  +
       /**
        * Return Role name of the PSML file
        *
  @@ -1098,7 +1098,7 @@
               return null;
           }
       }
  -    
  +
       /**
        * Return User name of the PSML file
        *
  @@ -1116,7 +1116,7 @@
               return null;
           }
       }
  -    
  +
       /**
        * The following methods used by Velocity to get value of constants
        */
  @@ -1160,11 +1160,11 @@
       {
           return "";
       }
  -    
  +
       /**
        * deprecated methods from JetspeedTemplateLink.
        */
  -    
  +
       /**
        * <p> Set the portlet giving context to this Link object.</p>
        *
  @@ -1180,8 +1180,8 @@
       {
           this.activePortlet=portlet;
       }
  -    
  -    
  +
  +
       /**
        * Add a portlet reference in the link.
        *
  @@ -1206,12 +1206,12 @@
               uri.addPathInfo(JetspeedResources.PATH_PORTLET_KEY, portletName);
           return uri;
       }
  -    
  +
       /**
        * Methods required by ApplictionTool interface
        *
        */
  -    
  +
       /**
        * This will initialise a JetspeedLink object that was
        * constructed with the default constructor (ApplicationTool
  @@ -1219,7 +1219,7 @@
        *
        * @param data assumed to be a RunData object
        */
  -    
  +
       public void init(Object data)
       {
           // Keeping init small and fast
  @@ -1239,7 +1239,7 @@
       {
           // empty
       }
  -    
  +
       public DynamicURI setMediaType(String mediaType)
       {
           return getLink( JetspeedLink.CURRENT, null, null, JetspeedLink.DEFAULT, 
null, null,null,mediaType);
  
  
  

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

Reply via email to