portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From morci...@apache.org
Subject cvs commit: jakarta-jetspeed/xdocs changes.xml
Date Tue, 08 Apr 2003 21:35:31 GMT
morciuch    2003/04/08 14:35:31

  Modified:    docs/site changes.html
               src/java/org/apache/jetspeed/modules/actions
                        JetspeedSessionValidator.java
               src/java/org/apache/jetspeed/portal/portlets/viewprocessor
                        JSPViewProcessor.java
               src/java/org/apache/jetspeed/services/profiler
                        JetspeedProfilerService.java
               src/java/org/apache/jetspeed/services/template
                        JetspeedTemplateLocatorService.java
               webapp/WEB-INF/conf JetspeedResources.properties
               xdocs    changes.xml
  Log:
  1. Bug # 18829  - Screens may now be optionally included in portlet template search (see
portlet.global.search property in jr.props).
  2. Bug # 18824 - JSP templates located outside of WEB-INF may now be used as portlets
  3. Bug # 18362  - Replaced usage of deprecated LocaleDetector with JetspeedLocalizationService.
Template locator service now correctly detects language changes. Patch by Kim Thrysoe.
  
  Revision  Changes    Path
  1.126     +10 -0     jakarta-jetspeed/docs/site/changes.html
  
  Index: changes.html
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/docs/site/changes.html,v
  retrieving revision 1.125
  retrieving revision 1.126
  diff -u -r1.125 -r1.126
  --- changes.html	7 Apr 2003 19:46:27 -0000	1.125
  +++ changes.html	8 Apr 2003 21:35:30 -0000	1.126
  @@ -133,6 +133,16 @@
   </li>
   -->
   <li>
  +  Add -   Bug # 18829 - 2003/04/08 - Screens may now be optionally included in portlet
template search (MO)
  +</li>
  +<li>
  +  Add -   Bug # 18824 - 2003/04/08 - JSP templates located outside of WEB-INF may now be
used as portlets (MO)
  +</li>
  +<li>
  +  Fix -   Bug # 18362 - 2003/04/08 - Replaced usage of deprecated LocaleDetector with JetspeedLocalizationService.

  +  Template locator service now correctly detects language changes. Patch by Kim Thrysoe
(MO)
  +</li>
  +<li>
     Fix -   Bug # 18765 - 2003/04/07 - Fixed problem with last login timestamp not being
recorded (MO)
   </li>
   <li>
  
  
  
  1.22      +7 -3      jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/JetspeedSessionValidator.java
  
  Index: JetspeedSessionValidator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/JetspeedSessionValidator.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- JetspeedSessionValidator.java	4 Mar 2003 00:04:52 -0000	1.21
  +++ JetspeedSessionValidator.java	8 Apr 2003 21:35:30 -0000	1.22
  @@ -55,17 +55,19 @@
   package org.apache.jetspeed.modules.actions;
   
   import java.util.Locale;
  -import org.apache.turbine.services.localization.LocaleDetector;
   
   import org.apache.turbine.util.RunData;
   import org.apache.turbine.util.Log;
   import org.apache.turbine.services.resources.TurbineResources;
  +import org.apache.turbine.services.localization.LocalizationService;
   
   import org.apache.jetspeed.om.security.JetspeedUser;
   import org.apache.jetspeed.services.JetspeedSecurity;
   import org.apache.jetspeed.services.security.LoginException;
   import org.apache.jetspeed.services.rundata.JetspeedRunData;
   import org.apache.jetspeed.services.resources.JetspeedResources;
  +import org.apache.jetspeed.util.ServiceUtil;
  +import org.apache.jetspeed.services.customlocalization.CustomLocalizationService;
   
   /**
   Just like org.apache.turbine.modules.actions.sessionvalidator.TemplateSessionValidator
except:
  @@ -151,7 +153,9 @@
           }
           
           // Get the locale store it in the user object
  -        Locale locale = LocaleDetector.getLocale(data);
  +        CustomLocalizationService locService = (CustomLocalizationService) ServiceUtil.getServiceByName(
  +            LocalizationService.SERVICE_NAME);
  +        Locale locale = locService.getLocale(data);
           if (locale == null) {
               locale = new Locale(
                        TurbineResources.getString("locale.default.language", "en"),
  
  
  
  1.2       +114 -53   jakarta-jetspeed/src/java/org/apache/jetspeed/portal/portlets/viewprocessor/JSPViewProcessor.java
  
  Index: JSPViewProcessor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/portlets/viewprocessor/JSPViewProcessor.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- JSPViewProcessor.java	20 Mar 2003 18:09:39 -0000	1.1
  +++ JSPViewProcessor.java	8 Apr 2003 21:35:30 -0000	1.2
  @@ -51,101 +51,162 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    */
  -/*
  - * JSPViewProcessor.java
  - *
  - * Created on January 27, 2003, 5:37 PM
  - */
   package org.apache.jetspeed.portal.portlets.viewprocessor;
   
  -
   // Ecs
   import org.apache.ecs.ElementContainer;
   import org.apache.ecs.StringElement;
   
  -
   // Jetspeed portal
   import org.apache.jetspeed.portal.Portlet;
  -import org.apache.jetspeed.portal.portlets.*;
   import org.apache.jetspeed.portal.portlets.GenericMVCContext;
  -import org.apache.jetspeed.portal.portlets.viewprocessor.*;
   import org.apache.jetspeed.services.TemplateLocator;
  +import org.apache.jetspeed.services.Registry;
  +import org.apache.jetspeed.om.registry.PortletEntry;
  +import org.apache.jetspeed.util.servlet.EcsServletElement;
  +import org.apache.jetspeed.util.ServiceUtil;
   
  -import org.apache.turbine.services.TurbineServices;
  +// Turbine stuff
   import org.apache.turbine.services.jsp.JspService;
   import org.apache.turbine.util.Log;
   
   // Turbine util
   import org.apache.turbine.util.RunData;
   
  +//java stuff
  +import java.util.Iterator;
  +import javax.servlet.http.HttpServletRequest;
  +import javax.servlet.RequestDispatcher;
   
   /**
  - *
  - * @author  tkuebler
  + * <b>JspViewProcessor</b> - MVC processor for serving jsp files.
  + * <p>
  + * The .jsp file location may be specified in two different ways:
  + * <li><b>using the "template" parameter</b> - the JspTemplateService
will search portlets and then screens 
  + * folder to locate the appropriate template. The template must be specifed in the "template"

  + * portlet parameter.
  + * <li><b>using relative url</b> - the .jsp template will be served directly
bypassing the 
  + * JspTemplateService. The template must be specifed in the portlet url property. 
  + * Example: /html/welcome.jsp.
  + * <P>
  + * 
  + * @author <a href="mailto:tkuebler@cisco.com">Tod Kuebler</a>
  + * @author <a href="mailto:weaver@apache.org">Scott Weaver</a>
  + * @author <a href="mailto:morciuch@apache.org">Mark Orciuch</a>
  + * @version $Id$
    */
   public class JSPViewProcessor
  -    implements ViewProcessor
  -  {
  +implements ViewProcessor
  +{
   
       /** Creates a new instance of JSPViewProcessor */
       public JSPViewProcessor()
  -      {
  -      }
  +    {
  +    }
   
       public Object processView(GenericMVCContext context)
  -      {
  +    {
   
  +        Portlet portlet = (Portlet) context.get("portlet");
  +        RunData data = (RunData) context.get("data");
  +        HttpServletRequest request = data.getRequest();
           String template = (String) context.get("template");
           Log.info("JSPViewProcessor - processing template " + template);
   
           try
  -          {
  -
  -            //
  -            // gets the jsp page from the xreg configuration
  -            // NOTE: wouldn't it be better to get the param from the PSML?
  -            //
  -            if (-1 == template.indexOf(".jsp"))
  -              {
  -                template = template + ".jsp";
  -              }
  -
  -            Log.info("JSPViewProcessor - locating template - " + ((RunData) context.get("data")).toString()
+ " - " + template);
  -
  -            //we use the template locator to translate the template
  -            String locatedTemplate = TemplateLocator.locatePortletTemplate((RunData) context.get("data"),
template);
  -            Log.info("JSPViewProcessor - located template: " + locatedTemplate);
  -
  -            JspService service = (JspService) TurbineServices.getInstance().getService(JspService.SERVICE_NAME);
  -
  -            // this is only necessary if we ddon't run in a JSP page environment
  -            // but better be safe than sorry...
  -            service.addDefaultObjects((RunData) context.get("data"));
  +        {
   
               // Allow access to portlet from .jsp template
  -            ((RunData) context.get("data")).getRequest().setAttribute("portlet", (Portlet)
context.get("portlet"));
  +            request.setAttribute("portlet", portlet);
   
               // put context in attribute so you can get to it from .jsp template
  -            ((RunData) context.get("data")).getRequest().setAttribute("context", context);
  +            request.setAttribute("context", context);
   
               // Add js_peid out of convenience
  -            ((RunData) context.get("data")).getRequest().setAttribute("js_peid", ((Portlet)
context.get("portlet")).getID());
  +            request.setAttribute("js_peid", portlet.getID());
  +
  +            // Add rundata out of convenience (JspService.RUNDATA differs from GenericMVCPortlet.RUNDATA)
  +            request.setAttribute(JspService.RUNDATA, data);
  +
  +            // Retrieve the URL. For backward compatibility, use the URL first 
  +            // and then fallback to "template" parameter
  +            PortletEntry pe = (PortletEntry) Registry.getEntry(Registry.PORTLET, portlet.getName());
  +
  +            // Files referenced from default templates folder will be processed
  +            // using JspService. Otherwise, they will be loaded using EcsServletElement
  +            // from where ever they came from.
  +            if (pe.getURL() == null)
  +            {
  +
  +                if (template != null && -1 == template.indexOf(".jsp"))
  +                {
  +                    template = template + ".jsp";
  +                }
  +
  +                Log.info("JSPViewProcessor - locating template - " + data.toString() 
  +                         + " - " + template);
  +
  +                //we use the template locator to translate the template
  +                String locatedTemplate = TemplateLocator.locatePortletTemplate(data, template);
  +                Log.info("JSPViewProcessor - located template: " + locatedTemplate);
  +
  +                /*if (locatedTemplate == null)
  +                {
  +                    locatedTemplate = TemplateLocator.locateScreenTemplate(data, template);
  +                    if (locatedTemplate != null)
  +                    {
  +                        locatedTemplate = "/screens" + locatedTemplate;
  +                    }
  +                    Log.debug("JSPViewProcessor - located screen template: " + locatedTemplate);
  +                } */
  +
  +                JspService service = (JspService) ServiceUtil.getServiceByName(JspService.SERVICE_NAME);
  +
  +                // this is only necessary if we don't run in a JSP page environment
  +                // but better be safe than sorry...
  +                service.addDefaultObjects(data);
  +
  +                // handle request
  +                service.handleRequest(data, locatedTemplate);
  +
  +            }
  +            else
  +            {
  +                // Build parameter list to be passed with the jsp
  +                Iterator names = portlet.getPortletConfig().getInitParameterNames();
  +                while (names.hasNext()) 
  +                {
  +                    String name = (String) names.next();
  +                    String value = (String) portlet.getPortletConfig().getInitParameter(name);
  +                    data.getParameters().setString(name, value);
  +                }
  +
  +                template = pe.getURL();
  +
  +                if (Log.getLogger().isDebugEnabled())
  +                {
  +                    Log.debug("JSPViewProcessor - serving jsp directly using: " + template);
  +                }
  +
  +                // get the RequestDispatcher for the JSP
  +                RequestDispatcher dispatcher = data.getServletContext().getRequestDispatcher(template);
  +                data.getOut().flush();
  +                dispatcher.include(data.getRequest(), data.getResponse());
  +            }
   
  -            // handle request
  -            service.handleRequest((RunData) context.get("data"), locatedTemplate);
  -          }
  +        }
           catch (Exception e)
  -          {
  +        {
   
  -            String message = "JspViewProcessor: Could not include the following JSP Page:
 [" + template + "] :\n\t" + 
  -                             e.getMessage();
  +            String message = "JSPViewProcessor: Could not include the following JSP Page:
 [" + template + "] :\n\t" 
  +                             + e.getMessage();
               Log.error(message, e);
   
               return new StringElement(message);
  -          }
  +        }
   
           return new ElementContainer();
  -      }
  +    }
   
       /** Process the template passed in the context
        * (context.get("template")).  Invoked by the GenericMVCPortlet
  @@ -154,6 +215,6 @@
        *
        */
       public void init(Portlet portlet)
  -      {
  -      }
  -  }
  +    {
  +    }
  +}
  
  
  
  1.47      +7 -3      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.46
  retrieving revision 1.47
  diff -u -r1.46 -r1.47
  --- JetspeedProfilerService.java	5 Mar 2003 23:07:03 -0000	1.46
  +++ JetspeedProfilerService.java	8 Apr 2003 21:35:30 -0000	1.47
  @@ -73,7 +73,7 @@
   import org.apache.turbine.services.TurbineBaseService;
   import org.apache.turbine.services.TurbineServices;
   import org.apache.turbine.services.InitializationException;
  -import org.apache.turbine.services.localization.LocaleDetector;
  +import org.apache.turbine.services.localization.LocalizationService;
   import org.apache.turbine.services.resources.TurbineResources;
   import org.apache.turbine.services.resources.ResourceService;
   
  @@ -109,9 +109,11 @@
   import org.apache.jetspeed.services.JetspeedSecurity;
   import org.apache.jetspeed.services.PsmlManager;
   import org.apache.jetspeed.services.PortalToolkit;
  +import org.apache.jetspeed.services.customlocalization.CustomLocalizationService;
   
   // jetspeed.util
   import org.apache.jetspeed.util.MimeType;
  +import org.apache.jetspeed.util.ServiceUtil;
   /**
    * <p>This is an implementation of the <code>Profiler</code> interface.
    *
  @@ -624,7 +626,9 @@
               if (locale == null)
               {
                   // Get the locale store it in the user object
  -                locale = LocaleDetector.getLocale(rundata);
  +                CustomLocalizationService locService = (CustomLocalizationService) ServiceUtil.getServiceByName(
  +                    LocalizationService.SERVICE_NAME);
  +                locale = locService.getLocale(rundata);
                   if (locale == null)
                   {
                       locale = new Locale(
  
  
  
  1.17      +29 -4     jakarta-jetspeed/src/java/org/apache/jetspeed/services/template/JetspeedTemplateLocatorService.java
  
  Index: JetspeedTemplateLocatorService.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/services/template/JetspeedTemplateLocatorService.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- JetspeedTemplateLocatorService.java	27 Mar 2003 16:54:24 -0000	1.16
  +++ JetspeedTemplateLocatorService.java	8 Apr 2003 21:35:31 -0000	1.17
  @@ -78,12 +78,12 @@
   import org.apache.turbine.services.InitializationException;
   import org.apache.turbine.services.servlet.TurbineServlet;
   import org.apache.turbine.services.jsp.JspService;
  -import org.apache.turbine.services.localization.LocaleDetector;
   import org.apache.turbine.services.resources.TurbineResources;
   import org.apache.turbine.services.template.BaseTemplateEngineService;
   import org.apache.turbine.services.template.TurbineTemplate;
   import org.apache.turbine.services.velocity.TurbineVelocity;
   import org.apache.turbine.services.velocity.VelocityService;
  +import org.apache.turbine.services.localization.LocalizationService;
   
   // jetspeed.capability
   import org.apache.commons.configuration.Configuration;
  @@ -93,6 +93,8 @@
   import org.apache.jetspeed.services.resources.JetspeedResources;
   import org.apache.jetspeed.services.rundata.JetspeedRunData;
   import org.apache.jetspeed.services.Profiler;
  +import org.apache.jetspeed.services.customlocalization.CustomLocalizationService;
  +import org.apache.jetspeed.util.ServiceUtil;
   /**
    * <p>Implements all template location related operations.
    * Template location algorithms are different from the Velocity template location,
  @@ -117,6 +119,7 @@
       implements TemplateLocatorService
   {
       private final static String CONFIG_TEMPLATE_ROOT = ".templateRoot";
  +    private final static String CONFIG_PORTLET_GLOBAL_SEARCH = ".portlet.global.search";
       private final static String DIR_SCREENS = "/screens";
       private final static String DIR_LAYOUTS = "/layouts";
       private final static String DIR_PORTLETS = "/portlets";
  @@ -149,6 +152,9 @@
       // template name cache
       private Map templateMap = null;
   
  +    // include screens when searching for portlet template
  +    private boolean useGlobalPortletSearch = false;
  +
       /**
        * This is the early initialization method called by the
        * Turbine <code>Service</code> framework
  @@ -411,6 +417,16 @@
               }
           }
   
  +        // Use "wide" search when required
  +        if (useGlobalPortletSearch == true)
  +        {
  +            String located = locateScreenTemplate(data, template);
  +            if (located != null)
  +            {
  +                return "/screens" + located;
  +            }
  +        }
  +
           return null;
       }
   
  @@ -514,7 +530,9 @@
        */
       public String locateEmailTemplate(RunData data, String template)
       {
  -        return locateEmailTemplate(data, template, LocaleDetector.getLocale(data));
  +        CustomLocalizationService locService = (CustomLocalizationService) ServiceUtil.getServiceByName(
  +            LocalizationService.SERVICE_NAME);
  +        return locateEmailTemplate(data, template, locService.getLocale(data));
       }
   
       /**
  @@ -763,7 +781,9 @@
           }
           else
           {
  -            tmplocale = LocaleDetector.getLocale(data);
  +            CustomLocalizationService locService = (CustomLocalizationService) ServiceUtil.getServiceByName(
  +                LocalizationService.SERVICE_NAME);
  +            tmplocale = locService.getLocale(data);
           }
   
           // Get the locale store it in the user object
  @@ -923,6 +943,11 @@
                   VelocityService.SERVICE_NAME);
   
           jspService = (JspService) TurbineServices.getInstance().getService(JspService.SERVICE_NAME);
  +
  +        useGlobalPortletSearch = JetspeedResources.getBoolean(
  +                TurbineServices.SERVICE_PREFIX
  +                    + TemplateLocatorService.SERVICE_NAME
  +                    + CONFIG_PORTLET_GLOBAL_SEARCH, false);
   
       }
   
  
  
  
  1.96      +5 -1      jakarta-jetspeed/webapp/WEB-INF/conf/JetspeedResources.properties
  
  Index: JetspeedResources.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/webapp/WEB-INF/conf/JetspeedResources.properties,v
  retrieving revision 1.95
  retrieving revision 1.96
  diff -u -r1.95 -r1.96
  --- JetspeedResources.properties	13 Mar 2003 01:08:11 -0000	1.95
  +++ JetspeedResources.properties	8 Apr 2003 21:35:31 -0000	1.96
  @@ -450,6 +450,10 @@
   # Note this needs to be set in 3 places - for the jsp loader and vm loader in TR.p and
for the template locator in JR.p
   services.TemplateLocator.templateRoot=/WEB-INF/templates
   
  +# This parameter includes screen templates in portlet template search.
  +# If set to 'true', when template is not found in /portlets folder, it will be searched
for in the /screens folder
  +service.TemplateLocator.portlet.global.search = false
  +
   #########################################
   # StockQuote Web Service                #
   #########################################
  
  
  
  1.145     +11 -1     jakarta-jetspeed/xdocs/changes.xml
  
  Index: changes.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/xdocs/changes.xml,v
  retrieving revision 1.144
  retrieving revision 1.145
  diff -u -r1.144 -r1.145
  --- changes.xml	7 Apr 2003 19:46:27 -0000	1.144
  +++ changes.xml	8 Apr 2003 21:35:31 -0000	1.145
  @@ -23,6 +23,16 @@
   </li>
   -->
   <li>
  +  Add -   Bug # 18829 - 2003/04/08 - Screens may now be optionally included in portlet
template search (MO)
  +</li>
  +<li>
  +  Add -   Bug # 18824 - 2003/04/08 - JSP templates located outside of WEB-INF may now be
used as portlets (MO)
  +</li>
  +<li>
  +  Fix -   Bug # 18362 - 2003/04/08 - Replaced usage of deprecated LocaleDetector with JetspeedLocalizationService.

  +  Template locator service now correctly detects language changes. Patch by Kim Thrysoe
(MO)
  +</li>
  +<li>
     Fix -   Bug # 18765 - 2003/04/07 - Fixed problem with last login timestamp not being
recorded (MO)
   </li>
   <li>
  
  
  

---------------------------------------------------------------------
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