ktlili      2005/08/24 19:40:55 CEST

  Modified files:
    war/JBuilderConf     MavenAutoUpdated.library 
    war/src/java/org/jahia/clipping/html/portlet 
                                                 ClipperPortlet.java 
                                                 PortletService.java 
                                                 PortletSessionManager.java 
    war/src/webapp/templates editParameters.jsp 
                             iframeContainer.jsp 
                             targetDocument.jsp 
  Removed files:
    war/src/java/org/jahia/clipping/html/portlet Constants.java 
  Log:
  - synchronize whith clipBuiler.jar
  
  Revision  Changes    Path
  1.6       +1 -1      webclip_portlet/war/JBuilderConf/MavenAutoUpdated.library
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/webclip_portlet/war/JBuilderConf/MavenAutoUpdated.library.diff?r1=1.5&r2=1.6&f=h
  1.10      +15 -18    
webclip_portlet/war/src/java/org/jahia/clipping/html/portlet/ClipperPortlet.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/webclip_portlet/war/src/java/org/jahia/clipping/html/portlet/ClipperPortlet.java.diff?r1=1.9&r2=1.10&f=h
  1.3       +0 -7      
webclip_portlet/war/src/java/org/jahia/clipping/html/portlet/Constants.java 
(dead)
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/webclip_portlet/war/src/java/org/jahia/clipping/html/portlet/Constants.java?rev=1.2&content-type=text/plain
  1.9       +89 -80    
webclip_portlet/war/src/java/org/jahia/clipping/html/portlet/PortletService.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/webclip_portlet/war/src/java/org/jahia/clipping/html/portlet/PortletService.java.diff?r1=1.8&r2=1.9&f=h
  1.7       +318 -114  
webclip_portlet/war/src/java/org/jahia/clipping/html/portlet/PortletSessionManager.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/webclip_portlet/war/src/java/org/jahia/clipping/html/portlet/PortletSessionManager.java.diff?r1=1.6&r2=1.7&f=h
  1.9       +2 -0      
webclip_portlet/war/src/webapp/templates/editParameters.jsp
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/webclip_portlet/war/src/webapp/templates/editParameters.jsp.diff?r1=1.8&r2=1.9&f=h
  1.9       +1 -1      
webclip_portlet/war/src/webapp/templates/iframeContainer.jsp
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/webclip_portlet/war/src/webapp/templates/iframeContainer.jsp.diff?r1=1.8&r2=1.9&f=h
  1.7       +1 -15     
webclip_portlet/war/src/webapp/templates/targetDocument.jsp
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/webclip_portlet/war/src/webapp/templates/targetDocument.jsp.diff?r1=1.6&r2=1.7&f=h
  
  
  
  Index: MavenAutoUpdated.library
  ===================================================================
  RCS file: 
/home/cvs/repository/webclip_portlet/war/JBuilderConf/MavenAutoUpdated.library,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- MavenAutoUpdated.library  23 Aug 2005 14:39:39 -0000      1.5
  +++ MavenAutoUpdated.library  24 Aug 2005 17:40:54 -0000      1.6
  @@ -45,5 +45,5 @@
       <path>../../../../Documents and 
Settings/jahia/.maven/repository/nekohtml/jars/nekohtml-0.9.4.jar</path>
       <path>../../../../Documents and 
Settings/jahia/.maven/repository/commons-io/jars/commons-io-1.0.jar</path>
     </class>
  -  <lastmodsaved>1124807083203</lastmodsaved>
  +  <lastmodsaved>1124896350937</lastmodsaved>
   </library>
  
  
  
  Index: ClipperPortlet.java
  ===================================================================
  RCS file: 
/home/cvs/repository/webclip_portlet/war/src/java/org/jahia/clipping/html/portlet/ClipperPortlet.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- ClipperPortlet.java       23 Aug 2005 14:39:40 -0000      1.9
  +++ ClipperPortlet.java       24 Aug 2005 17:40:54 -0000      1.10
  @@ -28,18 +28,17 @@
   
                        super.init(conf);
   
  -                     /*String logFilePath = 
conf.getPortletContext().getRealPath(getInitParameter("logPath"));
  -
  -                     System.err.println("[ Init Log4j from " + logFilePath + 
" ]");
  -                     if (logFilePath != null) {
  -                             DOMConfigurator.configure(logFilePath);
  -                     }
  -                     else {
  -                             System.err.println("[ Can't find log4j path ]");
  -                     }
  -
  -                     logger.debug("Log4j configured, initializing the rest 
of the ...");*/
  -
  +                     /*
  +                      *  String logFilePath = 
conf.getPortletContext().getRealPath(getInitParameter("logPath"));
  +                      *  System.err.println("[ Init Log4j from " + 
logFilePath + " ]");
  +                      *  if (logFilePath != null) {
  +                      *  DOMConfigurator.configure(logFilePath);
  +                      *  }
  +                      *  else {
  +                      *  System.err.println("[ Can't find log4j path ]");
  +                      *  }
  +                      *  logger.debug("Log4j configured, initializing the 
rest of the ...");
  +                      */
                }
                catch (Exception ex) {
                        ex.printStackTrace();
  @@ -157,11 +156,9 @@
                response.setContentType("text/html");
   
                // set the portlet service object for the current request
  +             PortletSessionManager psm = 
PortletSessionManager.getInstance(response.getNamespace());
                PortletService portletService = 
PortletService.getInstance(request, response, getPortletConfig(), 
getPortletContext());
  -             PortletSessionManager.setPortletService(request, 
portletService);
  -
  -             UrlEncoderIF encoder = 
UrlEncoderFactory.getPortletUrlEncoder(request, response);
  -             PortletSessionManager.setUrlEncoder(request, encoder);
  +             psm.setPortletService(request, portletService);
   
                // Get clipping content
                try {
  @@ -188,8 +185,8 @@
                        }
                        else {
                                logger.debug("write in the portlet");
  -                             String html = portletService.getHtml();
  -                             w.write(html);
  +                             //String html = portletService.getHtml();
  +                             //w.write(html);
                        }
                }
                catch (Exception ex) {
  
  
  
  Index: PortletService.java
  ===================================================================
  RCS file: 
/home/cvs/repository/webclip_portlet/war/src/java/org/jahia/clipping/html/portlet/PortletService.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- PortletService.java       23 Aug 2005 14:39:40 -0000      1.8
  +++ PortletService.java       24 Aug 2005 17:40:54 -0000      1.9
  @@ -42,81 +42,75 @@
   
        /**
         *  Gets the Html attribute of the PortletService object
  -      *
  -      [EMAIL PROTECTED]    The Html value
         */
  -     public String getHtml() {
  -             try {
  -                     String html = "";
  -
  -                     // build key for cache
  -                     String key = buildCacheKey();
  -                     logger.debug("cache key is: " + key);
  -                     PortletSessionManager.addLogMessage(request, "cache key 
is: " + key);
  -
  -                     // Get cache from context
  -                     /*
  -                      *  ExpiringCache cache;
  -                      *  Object objExpiringCache = 
context.getAttribute("ExpiringCache");
  -                      *  if (objExpiringCache == null) {
  -                      *  logger.debug("init ExpiringCache");
  -                      *  cache = new ExpiringCache();
  -                      *  context.setAttribute("ExpiringCache", cache);
  -                      *  }
  -                      *  else {
  -                      *  logger.debug("ExpiringCache Found in conntext");
  -                      *  cache = (ExpiringCache) objExpiringCache;
  -                      *  }
  -                      */
  -                     //get html from cache if possible
  -             //      Object cachedObject = cache.recover(key);
  -                Object cachedObject = null;
  -                     if (cachedObject == null) {
  -                             logger.debug("html not in cache");
  -                             PortletSessionManager.addLogMessage(request, 
"html not in cache");
  -                             // html is not in the cache
  -                             executeWebBrowserServlet();
  -
  -                             //html is in the session
  -                             html = PortletSessionManager.getHtml(request);
  -                             //html = "toto " + (new Date());
  -                             PortletSessionManager.setHtml(request, html);
  -
  -                             // add it to the cache
  -                             ClipperBean cBean = 
PortletSessionManager.getClipperBean(request);
  -                             String cacheExpiration = 
cBean.getConfigurationBean().getPortletCacheExpiration();
  -                             if (cacheExpiration != null && 
!cacheExpiration.equalsIgnoreCase("")) {
  -                                     long ttl = 
Long.parseLong(cacheExpiration);
  -                                     logger.debug("Cache ttl: " + ttl);
  -                                     //cache.admit(key, html, ttl, ttl);
  -                             }
  -
  -                     }
  -                     else {
  -                             logger.debug("html found in cache");
  -                             PortletSessionManager.addLogMessage(request, 
"html found in cache");
  -                             //html is in the cache
  -                             html = (String) cachedObject;
  -                             PortletSessionManager.setHtml(request, html);
  -                     }
  -
  -                     return html;
  -             }
  -             catch (Exception ex) {
  -                     logger.error("Execption has occured:" + ex.toString());
  -                     ex.printStackTrace();
  -                     return ex.toString();
  -             }
  -
  -     }
  -
  -
  +     /*
  +      *  public String getHtml() {
  +      *  try {
  +      *  String html = "";
  +      *  // build key for cache
  +      *  String key = buildCacheKey();
  +      *  logger.debug("cache key is: " + key);
  +      *  //PortletSessionManager.addLogMessage(request, "cache key is: " + 
key);
  +      *  // Get cache from context
  +      *  /*
  +      *  ExpiringCache cache;
  +      *  Object objExpiringCache = context.getAttribute("ExpiringCache");
  +      *  if (objExpiringCache == null) {
  +      *  logger.debug("init ExpiringCache");
  +      *  cache = new ExpiringCache();
  +      *  context.setAttribute("ExpiringCache", cache);
  +      *  }
  +      *  else {
  +      *  logger.debug("ExpiringCache Found in conntext");
  +      *  cache = (ExpiringCache) objExpiringCache;
  +      *  }
  +      */
  +     //get html from cache if possible
  +     //      Object cachedObject = cache.recover(key);
  +     /*
  +      *  Object cachedObject = null;
  +      *  if (cachedObject == null) {
  +      *  logger.debug("html not in cache");
  +      *  //PortletSessionManager.addLogMessage(request, "html not in cache");
  +      *  // html is not in the cache
  +      *  executeWebBrowserServlet();
  +      *  //html is in the session
  +      *  html = PortletSessionManager.getHtml(request);
  +      *  //html = "toto " + (new Date());
  +      *  PortletSessionManager.setHtml(request, html);
  +      *  // add it to the cache
  +      *  ClipperBean cBean = PortletSessionManager.getClipperBean(request);
  +      *  String cacheExpiration = 
cBean.getConfigurationBean().getPortletCacheExpiration();
  +      *  if (cacheExpiration != null && 
!cacheExpiration.equalsIgnoreCase("")) {
  +      *  long ttl = Long.parseLong(cacheExpiration);
  +      *  logger.debug("Cache ttl: " + ttl);
  +      *  //cache.admit(key, html, ttl, ttl);
  +      *  }
  +      *  }
  +      *  else {
  +      *  logger.debug("html found in cache");
  +      *  PortletSessionManager.addLogMessage(request, "html found in cache");
  +      *  //html is in the cache
  +      *  html = (String) cachedObject;
  +      *  PortletSessionManager.setHtml(request, html);
  +      *  }
  +      *  return html;
  +      *  }
  +      *  catch (Exception ex) {
  +      *  logger.error("Execption has occured:" + ex.toString());
  +      *  ex.printStackTrace();
  +      *  return ex.toString();
  +      *  }
  +      *  }
  +      */
        /**
         *  Sets the UserPrefences attribute of the PortletService object
         */
        public void loadUserPrefences() {
                logger.debug("[ load user preference ]");
  -             ClipperBean cBean = 
PortletSessionManager.getClipperBean(request);
  +             String nameSpace = PortletSessionManager.getNameSpace(request);
  +             PortletSessionManager psm = 
PortletSessionManager.getInstance(nameSpace);
  +             ClipperBean cBean = psm.getClipperBean(request);
   
                //update query parameters for all url bean
                List urlBeanList = cBean.getUrlListBean();
  @@ -161,6 +155,11 @@
         */
        public void initSession() {
   
  +             // set tne nameSpace in the session in order to be accessible 
from the processAction
  +             String nameSpace = ((RenderResponse) response).getNamespace();
  +             PortletSessionManager.setNameSpace(request, nameSpace);
  +             PortletSessionManager.getNameSpace(request);
  +
                // load the clipper from the xml file
                logger.debug("load clipper from xml file");
                String clipperPath = 
config.getPortletContext().getRealPath(config.getInitParameter("clipperPath"));
  @@ -171,14 +170,16 @@
                logger.debug("[ Set user parameter for the clipperBean from the 
PortletPreferences Object]");
   
                //init session att
  -             PortletSessionManager.getPortletSession(request).invalidate();
  -             PortletSessionManager.setClipperBean(request, cBean);
  -             PortletSessionManager.setURLMap(request, new URLMap());
  +             PortletSessionManager psm = 
PortletSessionManager.getInstance(nameSpace);
  +             //PortletSessionManager.getPortletSession(request).invalidate();
  +             psm.setClipperBean(request, cBean);
  +             //PortletSessionManager.setURLMap(request, new URLMap());
                String sessionUser = request.getRemoteUser();
                if (sessionUser != null) {
                        PortletSessionManager.setSessionUser(request, 
sessionUser);
                }
  -             PortletSessionManager.removeHtml(request);
  +             //PortletSessionManager.removeHtml(request);
  +
   
        }
   
  @@ -190,7 +191,9 @@
         */
        public boolean clipperBeanHasBeenLoaded() {
                // test if the clipper bean is in the session
  -             Object o = PortletSessionManager.getClipperBean(request);
  +             String nameSpace = PortletSessionManager.getNameSpace(request);
  +             PortletSessionManager psm = 
PortletSessionManager.getInstance(nameSpace);
  +             Object o = psm.getClipperBean(request);
                if (o == null) {
                        logger.debug("Clipper Bean is null");
                        return false;
  @@ -232,7 +235,9 @@
         [EMAIL PROTECTED]  uBean    Description of Parameter
         */
        public void updateQueryParameters(PortletRequest request, UrlBean 
uBean) {
  -             ClipperBean cBean = 
PortletSessionManager.getClipperBean(request);
  +             String nameSpace = PortletSessionManager.getNameSpace(request);
  +             PortletSessionManager psm = 
PortletSessionManager.getInstance(nameSpace);
  +             ClipperBean cBean = psm.getClipperBean(request);
                //Get the user preferences
                Map queryParamNewValue = 
PortletPreferencesManager.getUserParamsPreference(request, uBean);
   
  @@ -273,7 +278,9 @@
         */
        public boolean checkUserQueryParameters() {
                boolean missingParameters = false;
  -             ClipperBean cBean = 
PortletSessionManager.getClipperBean(request);
  +             String nameSpace = PortletSessionManager.getNameSpace(request);
  +             PortletSessionManager psm = 
PortletSessionManager.getInstance(nameSpace);
  +             ClipperBean cBean = psm.getClipperBean(request);
                List urlBeanList = cBean.getUrlListBean();
   
                // check all params of all urls
  @@ -302,7 +309,7 @@
         [EMAIL PROTECTED]    Description of the Returned Value
         */
        private String buildCacheKey() {
  -             String key = ((RenderResponse) response).getNamespace();
  +             String key = PortletSessionManager.getNameSpace(request);
                String userName = request.getRemoteUser();
                if (userName != null) {
                        key = key + userName;
  @@ -319,8 +326,10 @@
         */
        private Object[] updateFormBeansAndbuildQueryMap(PortletRequest 
request) {
                //Get the urlBean from which the parameters have been submited
  +             String nameSpace = PortletSessionManager.getNameSpace(request);
  +             PortletSessionManager psm = 
PortletSessionManager.getInstance(nameSpace);
                String positionUrl = (String) 
request.getParameter("selectedUrl");
  -             UrlBean uBean = 
PortletSessionManager.getClipperBean(request).getUrlBean(Integer.parseInt(positionUrl));
  +             UrlBean uBean = 
psm.getClipperBean(request).getUrlBean(Integer.parseInt(positionUrl));
   
                Map queryParamDefaultValue = new TreeMap();
                Map params = request.getParameterMap();
  @@ -359,10 +368,10 @@
                RenderRequest renderRequest = (RenderRequest) request;
                RenderResponse renderResponse = (RenderResponse) response;
   
  -                //set url encoder
  +             //set url encoder
                //UrlEncoderIF encoder = 
UrlEncoderFactory.getPortletUrlEncoder(renderRequest, renderResponse);
                //PortletSessionManager.setUrlEncoder(request, encoder);
  -                //dispath to the servlet
  +             //dispath to the servlet
                //PortletRequestDispatcher prd = 
context.getRequestDispatcher("/webBrowserServlet.do?show=test");
                //prd.include(renderRequest, renderResponse);
   
  
  
  
  Index: PortletSessionManager.java
  ===================================================================
  RCS file: 
/home/cvs/repository/webclip_portlet/war/src/java/org/jahia/clipping/html/portlet/PortletSessionManager.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- PortletSessionManager.java        17 Aug 2005 14:00:25 -0000      1.6
  +++ PortletSessionManager.java        24 Aug 2005 17:40:54 -0000      1.7
  @@ -1,241 +1,445 @@
   package org.jahia.clipping.html.portlet;
   import javax.portlet.*;
  +
   import org.jahia.clipbuilder.html.bean.*;
  +import org.jahia.clipbuilder.html.struts.webBrowser.*;
   import org.jahia.clipbuilder.html.web.*;
  -import org.jahia.clipbuilder.html.web.Url.*;
  -import org.jahia.clipbuilder.html.util.Constants;
  +import org.jahia.clipbuilder.html.struts.Util.Constants;
   
   /**
  - *  <p>
  - *
  - *  Title: </p> <p>
  - *
  - *  Description: </p> <p>
  - *
  - *  Copyright: Copyright (c) 2005</p> <p>
  + *  Access to sesion object
    *
  - *  Company: </p>
  - *
  - [EMAIL PROTECTED]     Tlili Khaled
  - [EMAIL PROTECTED]    1.0
  + [EMAIL PROTECTED]    Tlili Khaled
    */
  -public abstract class PortletSessionManager {
  +public class PortletSessionManager {
  +     private String nameSpace;
  +     private static org.apache.log4j.Logger logger = 
org.apache.log4j.Logger.getLogger(PortletSessionManager.class);
  +
  +
        /**
  -      *  Description of the Field
  +      *  Constructor for the PortletSessionManager object
  +      *
  +      [EMAIL PROTECTED]  nameSpace  Description of Parameter
         */
  -     public static String CLIPPER_BEAN = "clipperBean";
  +     private PortletSessionManager(String nameSpace) {
  +             this.nameSpace = nameSpace;
  +     }
  +
  +
  +
        /**
  -      *  Description of the Field
  +      *  Sets the ClipperBean attribute of the SessionManager object
  +      *
  +      [EMAIL PROTECTED]  portletRequest  The new ClipperBean value
  +      [EMAIL PROTECTED]  cBean           The new ClipperBean value
         */
  -     public static String WEB_BROWSER_SIMULATOR = "WebBrowserSimulator";
  +     public void setClipperBean(PortletRequest portletRequest, ClipperBean 
cBean) {
  +             setAttribute(portletRequest, Constants.CLIPPER_BEAN, cBean);
  +     }
   
   
        /**
  -      *  Sets the URLMap attribute of the SessionManager object
  +      *  Sets the WebBrowserForm attribute of the AbstractWizardAction object
         *
  -      [EMAIL PROTECTED]  request  The new URLMap value
  -      [EMAIL PROTECTED]  map      The new URLMap value
  +      [EMAIL PROTECTED]  portletRequest  The new WebBrowserForm value
  +      [EMAIL PROTECTED]  w               The new WebBrowserForm value
         */
  -     public static void setURLMap(PortletRequest request, URLMap map) {
  -             PortletSession session = getPortletSession(request);
  -             session.setAttribute(Constants.URL_MAP, map, 
PortletSession.APPLICATION_SCOPE);
  +     public void setWebBrowserForm(PortletRequest portletRequest, 
WebBrowserForm w) {
  +             setAttribute(portletRequest, Constants.WEB_BROWSER_FORM, w);
        }
   
   
  -
        /**
  -      *  Sets the ClipperBean attribute of the SessionManager class
  +      *  Sets the Attribute attribute of the PortletSessionManager class
         *
  -      [EMAIL PROTECTED]  request  The new ClipperBean value
  -      [EMAIL PROTECTED]  c        The new ClipperBean value
  +      [EMAIL PROTECTED]  request  The new Attribute value
  +      [EMAIL PROTECTED]  key      The new Attribute value
  +      [EMAIL PROTECTED]  o        The new Attribute value
         */
  -     public static void setClipperBean(PortletRequest request, ClipperBean 
c) {
  -             getPortletSession(request).setAttribute(CLIPPER_BEAN, c, 
PortletSession.APPLICATION_SCOPE);
  +     public void setAttribute(PortletRequest request, String key, Object o) {
  +             PortletSession session = request.getPortletSession();
  +             session.setAttribute(key, o, PortletSession.APPLICATION_SCOPE);
  +
        }
   
   
  +
  +     /**
  +      *  Sets the HttpState attribute of the SessionManager object
  +      */
  +     /*
  +      *  public static void setHttpState(PortletRequest portletRequest, 
HttpState state) {
  +      *  PortletSession session = portletRequest.getPortletSession();
  +      *  
setAttribute(org.jahia.clipbuilder.html.web.Constant.WebConstants.HTTPSTATE, 
state);
  +      *  }
  +      */
  +     /**
  +      *  Sets the LastBuildedUrlBean attribute of the SessionManager class
  +      */
  +     /*
  +      *  public static void setLastBuildedUrlBean(PortletRequest 
portletRequest, UrlBean u) {
  +      *  PortletSession session = portletRequest.getPortletSession();
  +      *  
setAttribute(org.jahia.clipbuilder.html.web.Constant.WebConstants.LAST_PROCESSED_URL,
 u);
  +      *  }
  +      */
  +     /**
  +      *  Sets the WebClient attribute of the SessionManager class
  +      */
  +     /*
  +      *  public static void setWebClient(PortletRequest request, 
HTMLUnitProcessor client) {
  +      *  PortletSession session = request.getPortletSession();
  +      *  
setAttribute(org.jahia.clipbuilder.html.web.Constant.WebConstants.ADVANCED_WEBCLIENT,
 client);
  +      *  }
  +      */
  +     /**
  +      *  Sets the UrlEncoder attribute of the SessionManager class
  +      */
  +     /*
  +      *  public static void setUrlEncoder(PortletRequest request, 
UrlEncoderIF encoder) {
  +      *  PortletSession session = request.getPortletSession();
  +      *  
setAttribute(org.jahia.clipbuilder.html.web.Constant.WebConstants.URL_ENCODER, 
encoder);
  +      *  }
  +      */
  +     /**
  +      *  Sets the URLMap attribute of the AbstractWizardAction object
  +      */
  +     /*
  +      *  public static void setURLMap(PortletRequest portletRequest, URLMap 
map) {
  +      *  PortletSession session = portletRequest.getPortletSession();
  +      *  setAttribute(Constants.URL_MAP, map);
  +      *  }
  +      */
        /**
  -      *  Sets the WebBrowserSimulator attribute of the SessionManager class
  +      *  Sets the RecorderBean attribute of the SessionManager class
         *
  -      [EMAIL PROTECTED]  request  The new WebBrowserSimulator value
  -      [EMAIL PROTECTED]  o        The new WebBrowserSimulator value
  +      [EMAIL PROTECTED]  portletRequest  The new RecorderBean value
  +      [EMAIL PROTECTED]  rb              The new RecorderBean value
         */
  -     public static void setWebBrowserSimulator(RenderRequest request, 
WebBrowserSimulator o) {
  -             getPortletSession(request).setAttribute(WEB_BROWSER_SIMULATOR, 
o, PortletSession.APPLICATION_SCOPE);
  +     public void setRecorderBean(PortletRequest portletRequest, 
RecordingBean rb) {
  +             setAttribute(portletRequest, 
org.jahia.clipbuilder.html.web.Constant.WebConstants.RECORDING, rb);
        }
   
   
  +
        /**
  -      *  Sets the Html attribute of the SessionManager class
  +      *  Gets the HTMLDocumentBuilder attribute of the SessionManager class
         *
  -      [EMAIL PROTECTED]  request  The new Html value
  -      [EMAIL PROTECTED]  html     The new Html value
  +      [EMAIL PROTECTED]  portletRequest  The new HTMLDocumentBuilder value
  +      [EMAIL PROTECTED]  htd             Description of Parameter
         */
  -     public static void setHtml(PortletRequest request, String html) {
  -             PortletSession session = getPortletSession(request);
  -             session.setAttribute("html", html, 
PortletSession.APPLICATION_SCOPE);
  +     public void setHTMLDocumentBuilder(PortletRequest portletRequest, 
HTMLDocumentBuilder htd) {
  +             setAttribute(portletRequest, Constants.HTMLDOCUMENT_BUILDER, 
htd);
        }
   
   
   
        /**
  -      *  Sets the Html attribute of the SessionManager class
  +      *  Sets the WebBrowserSimulator attribute of the WebBrowserAction 
object
         *
  -      [EMAIL PROTECTED]  request  The new Html value
  -      [EMAIL PROTECTED]  ps       The new Html value
  +      [EMAIL PROTECTED]  request  The new WebBrowserSimulator value
  +      [EMAIL PROTECTED]  w        The new WebBrowserSimulator value
         */
  -     public static void setPortletService(PortletRequest request, 
PortletService ps) {
  -             PortletSession session = getPortletSession(request);
  -             session.setAttribute("portletService", ps, 
PortletSession.PORTLET_SCOPE);
  +     public void setWebBrowserSimulator(PortletRequest request, 
WebBrowserSimulator w) {
  +             
request.getPortletSession().setAttribute(Constants.WEB_BROWSER_SIMULATOR, w);
        }
   
   
        /**
  -      *  Sets the UrlEncoder attribute of the PortletSessionManager class
  +      *  Gets the WebBrowserSimulator attribute of the WebBrowserAction 
object
         *
  -      [EMAIL PROTECTED]  request  The new UrlEncoder value
  -      [EMAIL PROTECTED]  encoder  The new UrlEncoder value
  +      [EMAIL PROTECTED]  request  Description of Parameter
  +      [EMAIL PROTECTED]          The WebBrowserSimulator value
         */
  -     public static void setUrlEncoder(PortletRequest request, UrlEncoderIF 
encoder) {
  -             PortletSession session = getPortletSession(request);
  -             
session.setAttribute(org.jahia.clipbuilder.html.web.Constant.WebConstants.URL_ENCODER,
 encoder, PortletSession.APPLICATION_SCOPE);
  +     public WebBrowserSimulator getWebBrowserSimulator(PortletRequest 
request) {
  +             return (WebBrowserSimulator) 
request.getPortletSession().getAttribute(Constants.WEB_BROWSER_SIMULATOR);
  +     }
   
  +
  +     /**
  +      *  Gets the UrlEncoder attribute of the SessionManager class
  +      */
  +     /*
  +      *  public static UrlEncoderIF getUrlEncoder(PortletRequest request) {
  +      *  PortletSession session = request.getPortletSession();
  +      *  return (UrlEncoderIF) 
session.getAttribute(org.jahia.clipbuilder.html.web.Constant.WebConstants.URL_ENCODER);
  +      *  }
  +      */
  +     /**
  +      *  Gets the WebBrowserForm attribute of the SessionManager object
  +      *
  +      [EMAIL PROTECTED]  portletRequest  Description of Parameter
  +      [EMAIL PROTECTED]                 The WebBrowserForm value
  +      */
  +     public WebBrowserForm getWebBrowserForm(PortletRequest portletRequest) {
  +             PortletSession session = portletRequest.getPortletSession();
  +             WebBrowserForm w = (WebBrowserForm) 
session.getAttribute(Constants.WEB_BROWSER_FORM);
  +             return w;
        }
   
   
   
        /**
  -      *  Sets the SessionUser attribute of the PortletSessionManager class
  +      *  Gets the ClipperBean attribute of the SessionManager object
         *
  -      [EMAIL PROTECTED]  request   The new SessionUser value
  -      [EMAIL PROTECTED]  userName  The new SessionUser value
  +      [EMAIL PROTECTED]  portletRequest  Description of Parameter
  +      [EMAIL PROTECTED]                 The ClipperBean value
         */
  -     public static void setSessionUser(PortletRequest request, String 
userName) {
  -             PortletSession session = request.getPortletSession(true);
  -             session.setAttribute("user", userName, 
PortletSession.APPLICATION_SCOPE);
  +     public ClipperBean getClipperBean(PortletRequest portletRequest) {
  +             ClipperBean bean = new ClipperBean();
  +             PortletSession session = portletRequest.getPortletSession();
  +             bean = (ClipperBean) 
session.getAttribute(Constants.CLIPPER_BEAN);
  +             //Handing error
  +             if (bean == null) {
  +                     logger.error("[ClipperBean error: Not found]");
  +             }
  +             return bean;
        }
   
   
        /**
  -      *  Gets the UrlEncoder attribute of the PortletSessionManager class
  +      *  Gets the URLMap attribute of the SessionManager object
         *
  -      [EMAIL PROTECTED]  request  Description of Parameter
  -      [EMAIL PROTECTED]          The UrlEncoder value
  +      [EMAIL PROTECTED]  r  Description of Parameter
  +      [EMAIL PROTECTED]    The URLMap value
  +      */
  +     /*
  +      *  public static URLMap getURLMap(PortletRequest portletRequest) {
  +      *  PortletSession session = portletRequest.getPortletSession();
  +      *  return (URLMap) session.getAttribute(Constants.URL_MAP);
  +      *  }
         */
  -     public static UrlEncoderIF getUrlEncoder(PortletRequest request) {
  -             PortletSession session = getPortletSession(request);
  -             return (UrlEncoderIF) 
session.getAttribute(org.jahia.clipbuilder.html.web.Constant.WebConstants.URL_ENCODER);
  +     public HTMLDocumentBuilder getHTMLDocumentBuilder(PortletRequest r) {
  +             PortletSession session = r.getPortletSession();
  +             return (HTMLDocumentBuilder) 
session.getAttribute(Constants.HTMLDOCUMENT_BUILDER);
        }
   
   
  +
        /**
  -      *  Gets the Html attribute of the SessionManager class
  +      *  Gets the HttpState attribute of the SessionManager object
  +      */
  +     /*
  +      *  public static HttpState getHttpState(PortletRequest portletRequest) 
{
  +      *  PortletSession session = portletRequest.getPortletSession();
  +      *  HttpState hs = (HttpState) 
session.getAttribute(org.jahia.clipbuilder.html.web.Constant.WebConstants.HTTPSTATE);
  +      *  return hs;
  +      *  }
  +      */
  +     /**
  +      *  Gets the WebClient attribute of the SessionManager class
  +      */
  +     /*
  +      *  public static HTMLUnitProcessor getWebClient(PortletRequest 
request) {
  +      *  PortletSession session = request.getPortletSession();
  +      *  HTMLUnitProcessor client = (HTMLUnitProcessor) 
session.getAttribute(org.jahia.clipbuilder.html.web.Constant.WebConstants.ADVANCED_WEBCLIENT);
  +      *  return client;
  +      *  }
  +      */
  +     /**
  +      *  Gets the RecorderBean attribute of the SessionManager object
  +      *
  +      [EMAIL PROTECTED]  portletRequest  Description of Parameter
  +      [EMAIL PROTECTED]                 The RecorderBean value
  +      */
  +     public RecordingBean getRecorderBean(PortletRequest portletRequest) {
  +             PortletSession session = portletRequest.getPortletSession();
  +             RecordingBean rb = (RecordingBean) 
session.getAttribute(org.jahia.clipbuilder.html.web.Constant.WebConstants.RECORDING);
  +             return rb;
  +     }
  +
  +
  +
  +     /**
  +      *  Gets the LastBuildedUrlBean attribute of the SessionManager class
  +      */
  +     /*
  +      *  public static UrlBean getLastBuildedUrlBean(PortletRequest 
portletRequest) {
  +      *  PortletSession session = portletRequest.getPortletSession();
  +      *  UrlBean u = (UrlBean) 
session.getAttribute(org.jahia.clipbuilder.html.web.Constant.WebConstants.LAST_PROCESSED_URL);
  +      *  return u;
  +      *  }
  +      */
  +     /**
  +      *  Gets the ClippersManagerBean attribute of the SessionManager object
         *
         [EMAIL PROTECTED]  request  Description of Parameter
  -      [EMAIL PROTECTED]          The Html value
  +      [EMAIL PROTECTED]          The ClippersManagerBean value
         */
  -     public static String getHtml(PortletRequest request) {
  -             PortletSession session = getPortletSession(request);
  -             return (String) session.getAttribute("html");
  +     public ClippersManagerBean getClippersManagerBean(PortletRequest 
request) {
  +             PortletSession session = request.getPortletSession();
  +             ClippersManagerBean bean = (ClippersManagerBean) 
session.getAttribute(ClippersManagerBean.class.toString());
  +             //Handing error
  +             if (bean == null) {
  +                     logger.error("[ClipperBean error: Not found]");
  +             }
  +             return bean;
        }
   
   
        /**
  -      *  Gets the SessionUser attribute of the PortletSessionManager class
  +      *  Description of the Method
         *
         [EMAIL PROTECTED]  request  Description of Parameter
  -      [EMAIL PROTECTED]          The SessionUser value
         */
  -     public static String getSessionUser(PortletRequest request) {
  -             PortletSession session = getPortletSession(request);
  -             return (String) session.getAttribute("user");
  +     public void removeWebBrowserSimulator(PortletRequest request) {
  +             
request.getPortletSession().removeAttribute(Constants.WEB_BROWSER_SIMULATOR);
        }
   
   
   
        /**
  -      *  Gets the PortletService attribute of the SessionManager class
  +      *  Description of the Method
  +      *
  +      [EMAIL PROTECTED]  r  Description of Parameter
  +      */
  +     public void removeHTMLDocumentBuilder(PortletRequest r) {
  +             PortletSession session = r.getPortletSession();
  +             session.removeAttribute(Constants.HTMLDOCUMENT_BUILDER);
  +     }
  +
  +
  +     /**
  +      *  Description of the Method
         *
         [EMAIL PROTECTED]  request  Description of Parameter
  -      [EMAIL PROTECTED]          The PortletService value
         */
  -     public static PortletService getPortletService(PortletRequest request) {
  -             PortletSession session = getPortletSession(request);
  -             return (PortletService) session.getAttribute("portletService");
  +     public void initSessionAttributes(PortletRequest request) {
  +             PortletSession session = request.getPortletSession();
  +             //session.invalidate();
  +
  +             // remove all attribute from session
  +             /*
  +              *  Enumeration enume = session.getAttributeNames();
  +              *  while(enume.hasMoreElements()){
  +              *  String attName = (String)enume.nextElement();
  +              *  session.removeAttribute(attName);
  +              *  }
  +              */
  +             // init clipperManager
  +             initClippersManagerBean(request);
        }
   
   
  +     /**
  +      *  Description of the Method
  +      */
  +     /*
  +      *  public static void removeWebClient(PortletRequest portletRequest) {
  +      *  PortletSession session = portletRequest.getPortletSession();
  +      *  
session.removeAttribute(org.jahia.clipbuilder.html.web.Constant.WebConstants.SIMPLE_WEBCLIENT);
  +      *  }
  +      */
  +     /**
  +      [EMAIL PROTECTED]  portletRequest  Description of Parameter
  +      */
  +     public void removeClipperBean(PortletRequest portletRequest) {
  +             PortletSession session = portletRequest.getPortletSession();
  +             session.removeAttribute(Constants.CLIPPER_BEAN);
  +
  +     }
  +
   
        /**
  -      *  Gets the URLMap attribute of the SessionManager object
  +      *  Description of the Method
  +      */
  +     /*
  +      *  public static void removeHttpState(PortletRequest portletRequest) {
  +      *  PortletSession session = portletRequest.getPortletSession();
  +      *  
session.removeAttribute(org.jahia.clipbuilder.html.web.Constant.WebConstants.HTTPSTATE);
  +      *  }
  +      */
  +     /**
  +      *  Description of the Method
         *
  -      [EMAIL PROTECTED]  request  Description of Parameter
  -      [EMAIL PROTECTED]          The URLMap value
  +      [EMAIL PROTECTED]  portletRequest  Description of Parameter
         */
  -     public static URLMap getURLMap(PortletRequest request) {
  -             PortletSession session = getPortletSession(request);
  -             return (URLMap) session.getAttribute(Constants.URL_MAP, 
PortletSession.APPLICATION_SCOPE);
  +     public void initClippersManagerBean(PortletRequest portletRequest) {
  +             ClippersManagerBean bean = new ClippersManagerBean();
  +             setAttribute(portletRequest, 
ClippersManagerBean.class.toString(), bean);
        }
   
   
  +     /**
  +      *  Sets the NameSpace attribute of the PortletSessionManager class
  +      *
  +      [EMAIL PROTECTED]  request    The new NameSpace value
  +      [EMAIL PROTECTED]  nameSpace  The new NameSpace value
  +      */
  +     public static void setNameSpace(PortletRequest request, String 
nameSpace) {
  +             PortletSession session = request.getPortletSession();
  +             session.setAttribute("nameSpace", nameSpace);
  +     }
  +
   
        /**
  -      *  Gets the ClipperBean attribute of the SessionManager class
  +      *  Sets the PortletService attribute of the PortletSessionManager 
object
         *
  -      [EMAIL PROTECTED]  request  Description of Parameter
  -      [EMAIL PROTECTED]          The ClipperBean value
  +      [EMAIL PROTECTED]  portletRequest  The new PortletService value
  +      [EMAIL PROTECTED]  ps              The new PortletService value
         */
  -     public static ClipperBean getClipperBean(PortletRequest request) {
  -             Object o = 
getPortletSession(request).getAttribute(CLIPPER_BEAN, 
PortletSession.APPLICATION_SCOPE);
  -             return (ClipperBean) o;
  +     public static void setPortletService(PortletRequest portletRequest, 
PortletService ps) {
  +             PortletSession session = portletRequest.getPortletSession();
  +             session.setAttribute("portletService", ps);
        }
   
   
  +     /**
  +      *  Sets the SessionUser attribute of the PortletSessionManager class
  +      *
  +      [EMAIL PROTECTED]  portletRequest  The new SessionUser value
  +      [EMAIL PROTECTED]  user            The new SessionUser value
  +      */
  +     public static void setSessionUser(PortletRequest portletRequest, String 
user) {
  +             PortletSession session = portletRequest.getPortletSession();
  +             session.setAttribute("user", user);
  +     }
  +
   
        /**
  -      *  Gets the ClipperBean attribute of the SessionManager class
  +      *  Gets the NameSpace attribute of the PortletSessionManager class
         *
         [EMAIL PROTECTED]  request  Description of Parameter
  -      [EMAIL PROTECTED]          The ClipperBean value
  +      [EMAIL PROTECTED]          The NameSpace value
         */
  -     public static WebBrowserSimulator getWebBrowserSimulator(PortletRequest 
request) {
  -             Object o = 
getPortletSession(request).getAttribute(WEB_BROWSER_SIMULATOR, 
PortletSession.APPLICATION_SCOPE);
  -             return (WebBrowserSimulator) o;
  +     public static String getNameSpace(PortletRequest request) {
  +             PortletSession session = request.getPortletSession();
  +             return (String) session.getAttribute("nameSpace");
        }
   
   
        /**
  -      *  Gets the PortletSession attribute of the PortletSessionManager class
  +      *  Gets the PortletService attribute of the PortletSessionManager 
object
         *
  -      [EMAIL PROTECTED]  request  Description of Parameter
  -      [EMAIL PROTECTED]          The PortletSession value
  +      [EMAIL PROTECTED]  portletRequest  Description of Parameter
  +      [EMAIL PROTECTED]                 The PortletService value
         */
  -     public static PortletSession getPortletSession(PortletRequest request) {
  -             return request.getPortletSession(true);
  +     public static PortletService getPortletService(PortletRequest 
portletRequest) {
  +             PortletSession session = portletRequest.getPortletSession();
  +             return (PortletService) session.getAttribute("portletService");
        }
   
   
        /**
  -      *  Description of the Method
  +      *  Gets the SessionUser attribute of the PortletSessionManager class
         *
  -      [EMAIL PROTECTED]  request  Description of Parameter
  +      [EMAIL PROTECTED]  portletRequest  Description of Parameter
  +      [EMAIL PROTECTED]                 The SessionUser value
         */
  -     public static void removeHtml(PortletRequest request) {
  -             PortletSession session = getPortletSession(request);
  -             session.removeAttribute("html", 
PortletSession.APPLICATION_SCOPE);
  +     public static String getSessionUser(PortletRequest portletRequest) {
  +             PortletSession session = portletRequest.getPortletSession();
  +             return (String) session.getAttribute("user");
        }
   
   
  +
        /**
  -      *  Adds a feature to the LogMessage attribute of the SessionManager 
class
  +      *  Gets the Instance attribute of the PortletSessionManager object
         *
  -      [EMAIL PROTECTED]  request  The feature to be added to the LogMessage 
attribute
  -      [EMAIL PROTECTED]  m        The feature to be added to the LogMessage 
attribute
  +      [EMAIL PROTECTED]  nameSpace  Description of Parameter
  +      [EMAIL PROTECTED]            The Instance value
         */
  -     public static void addLogMessage(PortletRequest request, String m) {
  -             String logMessage = (String) 
getPortletSession(request).getAttribute("information", 
PortletSession.APPLICATION_SCOPE);
  -             logMessage = logMessage + "<br/>" + m;
  -             getPortletSession(request).setAttribute("information", 
logMessage, PortletSession.APPLICATION_SCOPE);
  +     public static PortletSessionManager getInstance(String nameSpace) {
  +             return new PortletSessionManager(nameSpace);
        }
   
   }
  
  
  
  Index: editParameters.jsp
  ===================================================================
  RCS file: 
/home/cvs/repository/webclip_portlet/war/src/webapp/templates/editParameters.jsp,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- editParameters.jsp        23 Aug 2005 14:39:40 -0000      1.8
  +++ editParameters.jsp        24 Aug 2005 17:40:54 -0000      1.9
  @@ -14,6 +14,8 @@
     int pos = Integer.parseInt(position);
     /*Url List*/
     String optionUrlHtml = "";
  +  String nameSpace = ((RenderResponse)renderResponse).getNamespace();
  +  org.jahia.clipping.html.portlet.PortletSessionManager psm = 
org.jahia.clipping.html.portlet.PortletSessionManager.getInstance(nameSpace);
     ClipperBean cb = 
org.jahia.clipping.html.portlet.PortletSessionManager.getClipperBean(renderRequest);
     List urlBeanList = cb.getUrlListBean();
     /*param of the selected url*/
  
  
  
  Index: iframeContainer.jsp
  ===================================================================
  RCS file: 
/home/cvs/repository/webclip_portlet/war/src/webapp/templates/iframeContainer.jsp,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- iframeContainer.jsp       17 Aug 2005 14:00:27 -0000      1.8
  +++ iframeContainer.jsp       24 Aug 2005 17:40:54 -0000      1.9
  @@ -8,7 +8,7 @@
   %>
   <iframe height="250" width="250" align="bottom" frameborder="0" 
marginheight="0" marginwidth="0" scrolling="auto" id="<%=id%>" 
src="<%=request.getContextPath()+"/webBrowser.do?show=test&id="+id%>">
     <p style="textalign:center">
  -    <a 
href="<%=request.getContextPath()+"/webBrowser.do?show=test&id="+id%>">Clipper</a>
  +    <a 
href="<%=request.getContextPath()+"/webBrowser.do?show=test&nameSpace="+id%>">Clipper</a>
     </p>
   </iframe>
   
  
  
  
  Index: targetDocument.jsp
  ===================================================================
  RCS file: 
/home/cvs/repository/webclip_portlet/war/src/webapp/templates/targetDocument.jsp,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- targetDocument.jsp        17 Aug 2005 14:00:27 -0000      1.6
  +++ targetDocument.jsp        24 Aug 2005 17:40:54 -0000      1.7
  @@ -2,18 +2,4 @@
   <[EMAIL PROTECTED] uri="http://java.sun.com/portlet"; prefix="p"%>
   <[EMAIL PROTECTED] import="javax.portlet.*"%>
   <[EMAIL PROTECTED] uri="/WEB-INF/etc/struts/struts-bean" prefix="bean"%>
  -<%
  -    String id =  request.getParameter("id");
  -%>
  -
  -<html>
  -<head>
  -    <script type="" 
src="<%=request.getContextPath()+"/js/iframeJavascript.js"%>"></script>
  -</head>
  -<body onload="javascript:resizeIframe('<%=id %>');">
  -    <img align="middle" id="wait" style="visibility:visible;" 
src="<%=request.getContextPath()+"/resources/work_in_progress.gif"%>" alt=""/>
  -    <div  id="content">
  -        <bean:write name="webBrowserForm" property="content" filter="false"/>
  -    </div>
  -</body>
  -</html>
  +<bean:write name="webBrowserForm" property="content" filter="false"/>
  

Reply via email to