ktlili      2005/06/08 17:43:49 CEST

  Modified files:
    war/MavenWebClipping MavenWebClipping.jpx 
    war/src/conf         en_US.properties 
    war/src/java/com/jahia/clipping/Bean FormParamBean.java 
    war/src/java/com/jahia/clipping/struts BrowseAction.java 
                                           DescriptionClipperForm.java 
                                           EditAction.java 
                                           PreviewAction.java 
                                           SelectPartAction.java 
                                           TestClipperAction.java 
    war/src/java/com/jahia/clipping/struts/Util 
                                                AbstractWizardAction.java 
    war/src/java/com/jahia/clipping/web HTMLDocumentBuilder.java 
    war/src/java/com/jahia/clipping/web/html/Impl 
                                                  DefaultHTMLTransformer.java 
                                                  
StringTreeExtractorFilter.java 
    war/src/java/com/jahia/clipping/web/html/Impl/HTMLParser 
                                                             
HTMLParserTransformer.java 
    war/src/java/com/jahia/clipping/web/html/Impl/JDom 
                                                       JDomHTMLDocument.java 
                                                       JDomHTMLTransformer.java 
    war/src/java/com/jahia/clipping/web/http/impl 
                                                  HTMLUnitProcessor.java 
                                                  HttpProcessor.java 
    war/src/webapp/jsp/actions descriptionAction.jsp 
                               editAction.jsp 
    war/src/webapp/jsp/templates formTemplate.jsp 
  Added files:
    war/src/java/com/jahia/clipping/util DESUtilities.java 
  Log:
  Add DESFeatures
  Fix bug Select Form
  
  Revision  Changes    Path
  1.8       +1 -0      webclip_builder/war/MavenWebClipping/MavenWebClipping.jpx
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/webclip_builder/war/MavenWebClipping/MavenWebClipping.jpx.diff?r1=1.7&r2=1.8&f=h
  1.8       +7 -0      webclip_builder/war/src/conf/en_US.properties
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/webclip_builder/war/src/conf/en_US.properties.diff?r1=1.7&r2=1.8&f=h
  1.2       +34 -5     
webclip_builder/war/src/java/com/jahia/clipping/Bean/FormParamBean.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/webclip_builder/war/src/java/com/jahia/clipping/Bean/FormParamBean.java.diff?r1=1.1&r2=1.2&f=h
  1.5       +3 -1      
webclip_builder/war/src/java/com/jahia/clipping/struts/BrowseAction.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/webclip_builder/war/src/java/com/jahia/clipping/struts/BrowseAction.java.diff?r1=1.4&r2=1.5&f=h
  1.4       +2 -2      
webclip_builder/war/src/java/com/jahia/clipping/struts/DescriptionClipperForm.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/webclip_builder/war/src/java/com/jahia/clipping/struts/DescriptionClipperForm.java.diff?r1=1.3&r2=1.4&f=h
  1.3       +25 -9     
webclip_builder/war/src/java/com/jahia/clipping/struts/EditAction.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/webclip_builder/war/src/java/com/jahia/clipping/struts/EditAction.java.diff?r1=1.2&r2=1.3&f=h
  1.5       +17 -6     
webclip_builder/war/src/java/com/jahia/clipping/struts/PreviewAction.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/webclip_builder/war/src/java/com/jahia/clipping/struts/PreviewAction.java.diff?r1=1.4&r2=1.5&f=h
  1.4       +14 -6     
webclip_builder/war/src/java/com/jahia/clipping/struts/SelectPartAction.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/webclip_builder/war/src/java/com/jahia/clipping/struts/SelectPartAction.java.diff?r1=1.3&r2=1.4&f=h
  1.6       +4 -8      
webclip_builder/war/src/java/com/jahia/clipping/struts/TestClipperAction.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/webclip_builder/war/src/java/com/jahia/clipping/struts/TestClipperAction.java.diff?r1=1.5&r2=1.6&f=h
  1.3       +1 -2      
webclip_builder/war/src/java/com/jahia/clipping/struts/Util/AbstractWizardAction.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/webclip_builder/war/src/java/com/jahia/clipping/struts/Util/AbstractWizardAction.java.diff?r1=1.2&r2=1.3&f=h
  1.1       +181 -0    
webclip_builder/war/src/java/com/jahia/clipping/util/DESUtilities.java (new)
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/webclip_builder/war/src/java/com/jahia/clipping/util/DESUtilities.java?rev=1.1&content-type=text/plain
  1.6       +24 -14    
webclip_builder/war/src/java/com/jahia/clipping/web/HTMLDocumentBuilder.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/webclip_builder/war/src/java/com/jahia/clipping/web/HTMLDocumentBuilder.java.diff?r1=1.5&r2=1.6&f=h
  1.8       +21 -15    
webclip_builder/war/src/java/com/jahia/clipping/web/html/Impl/DefaultHTMLTransformer.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/webclip_builder/war/src/java/com/jahia/clipping/web/html/Impl/DefaultHTMLTransformer.java.diff?r1=1.7&r2=1.8&f=h
  1.5       +23 -8     
webclip_builder/war/src/java/com/jahia/clipping/web/html/Impl/HTMLParser/HTMLParserTransformer.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/webclip_builder/war/src/java/com/jahia/clipping/web/html/Impl/HTMLParser/HTMLParserTransformer.java.diff?r1=1.4&r2=1.5&f=h
  1.5       +0 -1      
webclip_builder/war/src/java/com/jahia/clipping/web/html/Impl/JDom/JDomHTMLDocument.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/webclip_builder/war/src/java/com/jahia/clipping/web/html/Impl/JDom/JDomHTMLDocument.java.diff?r1=1.4&r2=1.5&f=h
  1.7       +2 -2      
webclip_builder/war/src/java/com/jahia/clipping/web/html/Impl/JDom/JDomHTMLTransformer.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/webclip_builder/war/src/java/com/jahia/clipping/web/html/Impl/JDom/JDomHTMLTransformer.java.diff?r1=1.6&r2=1.7&f=h
  1.5       +43 -11    
webclip_builder/war/src/java/com/jahia/clipping/web/html/Impl/StringTreeExtractorFilter.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/webclip_builder/war/src/java/com/jahia/clipping/web/html/Impl/StringTreeExtractorFilter.java.diff?r1=1.4&r2=1.5&f=h
  1.4       +29 -8     
webclip_builder/war/src/java/com/jahia/clipping/web/http/impl/HTMLUnitProcessor.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/webclip_builder/war/src/java/com/jahia/clipping/web/http/impl/HTMLUnitProcessor.java.diff?r1=1.3&r2=1.4&f=h
  1.3       +31 -6     
webclip_builder/war/src/java/com/jahia/clipping/web/http/impl/HttpProcessor.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/webclip_builder/war/src/java/com/jahia/clipping/web/http/impl/HttpProcessor.java.diff?r1=1.2&r2=1.3&f=h
  1.4       +8 -8      
webclip_builder/war/src/webapp/jsp/actions/descriptionAction.jsp
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/webclip_builder/war/src/webapp/jsp/actions/descriptionAction.jsp.diff?r1=1.3&r2=1.4&f=h
  1.3       +7 -0      webclip_builder/war/src/webapp/jsp/actions/editAction.jsp
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/webclip_builder/war/src/webapp/jsp/actions/editAction.jsp.diff?r1=1.2&r2=1.3&f=h
  1.3       +0 -1      
webclip_builder/war/src/webapp/jsp/templates/formTemplate.jsp
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/webclip_builder/war/src/webapp/jsp/templates/formTemplate.jsp.diff?r1=1.2&r2=1.3&f=h
  
  
  
  Index: MavenWebClipping.jpx
  ===================================================================
  RCS file: 
/home/cvs/repository/webclip_builder/war/MavenWebClipping/MavenWebClipping.jpx,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- MavenWebClipping.jpx      7 Jun 2005 17:42:45 -0000       1.7
  +++ MavenWebClipping.jpx      8 Jun 2005 15:43:45 -0000       1.8
  @@ -100,6 +100,7 @@
     </node>
     <file 
path="../src/conf/com/jahia/clipping/database/hibernate/Filter.hbm.xml"/>
     <file 
path="../src/java/com/jahia/clipping/web/html/Impl/JDom/JDomHTMLTransformer.java"/>
  +  <file path="limitation.txt"/>
     <file path="MavenWebClipping.html"/>
     <file path="../project.properties"/>
     <file path="../project.xml"/>
  
  
  
  Index: en_US.properties
  ===================================================================
  RCS file: /home/cvs/repository/webclip_builder/war/src/conf/en_US.properties,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- en_US.properties  6 Jun 2005 13:14:10 -0000       1.7
  +++ en_US.properties  8 Jun 2005 15:43:46 -0000       1.8
  @@ -95,6 +95,12 @@
   description.button.validate = validate
   description.button.reset = Reset
   description.button.configure = Advanced configuration
  +description.name = Name and tilte
  +description.description = Description
  +description.url = Enter an absolute Url
  +description.connection = Connection Time out (s)
  +
  +
   
   # Browse
   browse.title = Browse
  @@ -146,6 +152,7 @@
   edit.ShowLabel = Show parameters label
   edit.ShowHTML = Show HTML
   edit.password.value = Password value
  +edit.visibility = Visibility
   
   # TestClipper
   testClipper.title = Test Clipper
  
  
  
  Index: FormParamBean.java
  ===================================================================
  RCS file: 
/home/cvs/repository/webclip_builder/war/src/java/com/jahia/clipping/Bean/FormParamBean.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FormParamBean.java        3 Mar 2005 18:03:52 -0000       1.1
  +++ FormParamBean.java        8 Jun 2005 15:43:46 -0000       1.2
  @@ -1,7 +1,8 @@
   package com.jahia.clipping.Bean;
   
   import java.util.*;
  -import com.jahia.clipping.util.*;
  +import com.jahia.clipping.util.DESUtilities;
  +
   
   /**
    *  Description of the Class
  @@ -12,6 +13,7 @@
        private String mapping;
        private String type;
        private String usedValue = "";
  +     private String visibility = "true";
   
        // List with paramter as string
        private ArrayList possibleValue = new ArrayList();
  @@ -109,6 +111,16 @@
   
   
        /**
  +      *  Sets the Visibility attribute of the FormParamBean object
  +      *
  +      [EMAIL PROTECTED]  visibility  The new Visibility value
  +      */
  +     public void setVisibility(String visibility) {
  +             this.visibility = visibility;
  +     }
  +
  +
  +     /**
         *  Gets the PossibleValue attribute of the ParameterBean object
         *
         [EMAIL PROTECTED]    The PossibleValue value
  @@ -147,11 +159,28 @@
                return usedValue;
        }
   
  -  public ArrayList getPossibleBeanValue() {
  -    return possibleBeanValue;
  -  }
   
  -  /**
  +     /**
  +      *  Gets the PossibleBeanValue attribute of the FormParamBean object
  +      *
  +      [EMAIL PROTECTED]    The PossibleBeanValue value
  +      */
  +     public ArrayList getPossibleBeanValue() {
  +             return possibleBeanValue;
  +     }
  +
  +
  +     /**
  +      *  Gets the Visibility attribute of the FormParamBean object
  +      *
  +      [EMAIL PROTECTED]    The Visibility value
  +      */
  +     public String getVisibility() {
  +             return visibility;
  +     }
  +
  +
  +     /**
         *  Gets the PossibleBeanValue attribute of the FormParamBean object
         *
         [EMAIL PROTECTED]    The PossibleBeanValue value
  
  
  
  Index: BrowseAction.java
  ===================================================================
  RCS file: 
/home/cvs/repository/webclip_builder/war/src/java/com/jahia/clipping/struts/BrowseAction.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- BrowseAction.java 14 Mar 2005 16:29:34 -0000      1.4
  +++ BrowseAction.java 8 Jun 2005 15:43:46 -0000       1.5
  @@ -535,7 +535,9 @@
                addErrors(httpServletRequest, actionErrors);
   
                // set the body content parameter
  -             browseForm.setBodyContent(transfDoc);
  +                String encodedHTML = new 
String(transfDoc.getBytes(),httpServletResponse.getCharacterEncoding());
  +                logger.debug("Encoding is: 
"+httpServletResponse.getCharacterEncoding());
  +             browseForm.setBodyContent(encodedHTML);
        }
   
   
  
  
  
  Index: DescriptionClipperForm.java
  ===================================================================
  RCS file: 
/home/cvs/repository/webclip_builder/war/src/java/com/jahia/clipping/struts/DescriptionClipperForm.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DescriptionClipperForm.java       14 Mar 2005 16:29:34 -0000      1.3
  +++ DescriptionClipperForm.java       8 Jun 2005 15:43:46 -0000       1.4
  @@ -138,8 +138,8 @@
                try {
                        if (getWebClippingConnectionTimeOut() == null ||
                                        
getWebClippingConnectionTimeOut().equals("")) {
  -                             errors.add("ConnectionTimeOutNull",
  -                                             new 
ActionError("error.connectionTimeOu"));
  +                             /*errors.add("ConnectionTimeOutNull",
  +                                             new 
ActionError("error.connectionTimeOu"));*/
                        }
                        else {
   
  
  
  
  Index: EditAction.java
  ===================================================================
  RCS file: 
/home/cvs/repository/webclip_builder/war/src/java/com/jahia/clipping/struts/EditAction.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- EditAction.java   7 Jun 2005 17:42:46 -0000       1.2
  +++ EditAction.java   8 Jun 2005 15:43:46 -0000       1.3
  @@ -9,6 +9,7 @@
   import com.jahia.clipping.web.html.*;
   import com.jahia.clipping.Bean.*;
   import java.util.*;
  +import java.io.*;
   
   /**
    *  Action linked whith editParams.jsp
  @@ -90,7 +91,7 @@
                activateParamsList(editParamForm, httpServletRequest);
   
                // set the document html to be printed
  -             setBodyContent(httpServletRequest, editParamForm);
  +             setBodyContent(httpServletRequest, 
httpServletResponse,editParamForm);
   
                return actionMapping.getInputForward();
        }
  @@ -117,7 +118,7 @@
                activateParamsList(editParamForm, httpServletRequest);
   
                // set the document html to be printed
  -             setBodyContent(httpServletRequest, editParamForm);
  +             setBodyContent(httpServletRequest,httpServletResponse, 
editParamForm);
   
                return actionMapping.getInputForward();
        }
  @@ -232,10 +233,11 @@
        /**
         *  process the selected Url
         *
  -      [EMAIL PROTECTED]  httpServletRequest  Description of Parameter
  -      [EMAIL PROTECTED]  editParamForm       Description of Parameter
  +      [EMAIL PROTECTED]  httpServletRequest   Description of Parameter
  +      [EMAIL PROTECTED]  httpServletResponse  The new BodyContent value
  +      [EMAIL PROTECTED]  editParamForm        Description of Parameter
         */
  -     private void setBodyContent(HttpServletRequest httpServletRequest,
  +     private void setBodyContent(HttpServletRequest httpServletRequest, 
HttpServletResponse httpServletResponse,
                        EditParamForm editParamForm) {
   
                // Get the position of url
  @@ -258,14 +260,28 @@
                        // Show label is selected: Get the document whit label
                        if (editParamForm.getShowLabel() != null) {
                                // set the content
  -                             editParamForm.setBodyContent(
  -                                             
htmlDocument.getDocumentWhithParamLabelAsString());
  +                             String html = 
htmlDocument.getDocumentWhithParamLabelAsString();
  +                             String encodedHTML = html;
  +                             try {
  +                                     encodedHTML = new 
String(html.getBytes(),httpServletResponse.getCharacterEncoding());
  +                             }
  +                             catch (UnsupportedEncodingException ex) {
  +                                     ex.printStackTrace();
  +                             }
  +                             editParamForm.setBodyContent(encodedHTML);
                        }
                        // Get the document whitout the label
                        else {
                                // set the content
  -                             editParamForm.setBodyContent(
  -                                             
htmlDocument.getTransformedDocumentAsString());
  +                             String html = 
htmlDocument.getTransformedDocumentAsString();
  +                             String encodedHTML = html;
  +                             try {
  +                                     encodedHTML = new 
String(html.getBytes(), httpServletResponse.getCharacterEncoding());
  +                             }
  +                             catch (UnsupportedEncodingException ex) {
  +                                     ex.printStackTrace();
  +                             }
  +                             editParamForm.setBodyContent(encodedHTML);
                        }
                }
                else {
  
  
  
  Index: PreviewAction.java
  ===================================================================
  RCS file: 
/home/cvs/repository/webclip_builder/war/src/java/com/jahia/clipping/struts/PreviewAction.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- PreviewAction.java        7 Jun 2005 17:42:46 -0000       1.4
  +++ PreviewAction.java        8 Jun 2005 15:43:46 -0000       1.5
  @@ -7,6 +7,7 @@
   import com.jahia.clipping.web.*;
   import com.jahia.clipping.Bean.*;
   import java.util.*;
  +import java.io.*;
   
   /**
    *  Description of the Class
  @@ -95,15 +96,16 @@
         */
        public ActionForward init(ActionMapping actionMapping, ActionForm 
actionForm, HttpServletRequest httpServletRequest, HttpServletResponse 
httpServletResponse) {
                try {
  -                     logger.debug("[view method called]");
  -                     super.init(actionMapping, actionForm, 
httpServletRequest,httpServletResponse);
  +                     logger.debug("[view method called]");
  +                     super.init(actionMapping, actionForm, 
httpServletRequest, httpServletResponse);
                        PreviewForm previewForm = (PreviewForm) actionForm;
                        previewForm.setFrom("wizard");
   
  -                     String selectedPart = 
buildSelectedPart(httpServletRequest,httpServletResponse);
  +                     String selectedPart = 
buildSelectedPart(httpServletRequest, httpServletResponse);
   
                        //Set the selected part
  -                     previewForm.setSelectedPart(selectedPart);
  +                     String encodedHTML = new 
String(selectedPart.getBytes(), httpServletResponse.getCharacterEncoding());
  +                     previewForm.setSelectedPart(encodedHTML);
                }
                catch (Exception ex) {
                        ex.printStackTrace();
  @@ -194,7 +196,15 @@
                logger.debug("[Selected part is] --> " + selectedPart);
   
                //Set the selected part
  -             previewForm.setSelectedPart(selectedPart);
  +             String encodedHTML = selectedPart;
  +             try {
  +                     encodedHTML = new String(selectedPart.getBytes(), 
httpServletResponse.getCharacterEncoding());
  +             }
  +             catch (UnsupportedEncodingException ex) {
  +                     ex.printStackTrace();
  +             }
  +
  +             previewForm.setSelectedPart(encodedHTML);
   
                return actionMapping.getInputForward();
        }
  @@ -295,7 +305,7 @@
   
                        // Get the target document
                        UrlBean uBean = bean.getLastRecordedUrlBean();
  -                        HTMLDocument doc = uBean.getDocument();
  +                     HTMLDocument doc = uBean.getDocument();
   
                        if (doc == null) {
                                logger.debug("[ Url is: " + 
bean.getLastRecordedUrlBean().getURL() + " ]");
  @@ -312,6 +322,7 @@
                finally {
   
                        //logger.debug("[Selected part is] --> " + 
selectedPart);
  +
                        return selectedPart;
                }
        }
  
  
  
  Index: SelectPartAction.java
  ===================================================================
  RCS file: 
/home/cvs/repository/webclip_builder/war/src/java/com/jahia/clipping/struts/SelectPartAction.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- SelectPartAction.java     6 Jun 2005 17:04:22 -0000       1.3
  +++ SelectPartAction.java     8 Jun 2005 15:43:46 -0000       1.4
  @@ -10,6 +10,7 @@
   import com.jahia.clipping.web.html.Impl.*;
   import com.jahia.clipping.web.html.*;
   import com.jahia.clipping.web.html.Impl.*;
  +import java.io.*;
   
   /**
    *  Description of the Class
  @@ -59,7 +60,7 @@
         [EMAIL PROTECTED]  httpServletResponse  Description of Parameter
         [EMAIL PROTECTED]                      Description of the Returned 
Value
         */
  -     public ActionForward manualPreview(ActionMapping 
actionMapping,ActionForm actionForm,HttpServletRequest 
httpServletRequest,HttpServletResponse httpServletResponse) {
  +     public ActionForward manualPreview(ActionMapping actionMapping, 
ActionForm actionForm, HttpServletRequest httpServletRequest, 
HttpServletResponse httpServletResponse) {
                SelectPartForm selectPartForm = (SelectPartForm) actionForm;
                //Get the ClipperBean object
                HttpSession session = httpServletRequest.getSession();
  @@ -75,7 +76,7 @@
                HTMLDocument doc = bean.getLastRecordedUrlBean().getDocument();
   
                //set the HTMLFilter
  -                ExtractorFilter filter = null;
  +             ExtractorFilter filter = null;
                // 0 = dynamic, 1 = static
                if 
(selectPartForm.getWebClippingTypeContent().equalsIgnoreCase("0")) {
                        filter = new StringTreeExtractorFilter(doc, 
selectedContent);
  @@ -84,14 +85,13 @@
                        filter = new SimpleExtractorFilter(selectedContent);
                }
                else {
  -                     logger.error("[Unexpected value " 
+selectPartForm.getWebClippingTypeContent() + " ]");
  +                     logger.error("[Unexpected value " + 
selectPartForm.getWebClippingTypeContent() + " ]");
                }
   
                logger.debug("[ Selected content is " + selectedContent + " ]");
                bean.setFilter(filter);
   
   
  -
                return actionMapping.findForward("preview");
        }
   
  @@ -315,10 +315,18 @@
                }
   
                // process the source url in and print the document
  -             HTMLDocument jdoc = getHTMLDocument(httpServletRequest);
  +             HTMLDocument doc = getHTMLDocument(httpServletRequest);
   
                // set the content
  -             
selectPartForm.setBodyContent(jdoc.getTransformedDocumentAsString());
  +             String html = doc.getTransformedDocumentAsString();
  +             try {
  +                     String encodedHTML = new 
String(html.getBytes(),httpServletResponse.getCharacterEncoding());
  +                     selectPartForm.setBodyContent(encodedHTML);
  +             }
  +             catch (UnsupportedEncodingException ex) {
  +                    ex.printStackTrace();
  +                    selectPartForm.setBodyContent(html);
  +             }
   
                return actionMapping.getInputForward();
        }
  
  
  
  Index: TestClipperAction.java
  ===================================================================
  RCS file: 
/home/cvs/repository/webclip_builder/war/src/java/com/jahia/clipping/struts/TestClipperAction.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- TestClipperAction.java    7 Jun 2005 17:42:46 -0000       1.5
  +++ TestClipperAction.java    8 Jun 2005 15:43:46 -0000       1.6
  @@ -139,7 +139,7 @@
   
                        //save the current values
                        int posUrl = Integer.parseInt(form.getSelectedUrl());
  -                     
updateQueryParamsValue(httpServletRequest,getClipperBean(httpServletRequest).getUrlBean(posUrl));
  +                     updateQueryParamsValue(httpServletRequest, 
getClipperBean(httpServletRequest).getUrlBean(posUrl));
   
                        //Get all the url
                        ClipperBean cBean = getClipperBean(httpServletRequest);
  @@ -151,7 +151,7 @@
                                // get the url bean
                                UrlBean uBean = (UrlBean) urlListBean.get(i);
                                //process the current urlBean
  -                             
uBean.setDocument(processUrl(httpServletRequest,httpServletResponse, uBean));
  +                             
uBean.setDocument(processUrl(httpServletRequest, httpServletResponse, uBean));
                        }
   
                        // set the body content
  @@ -220,11 +220,8 @@
                //get the header params
                Hashtable headerParamHash = getHeaderParams(request);
   
  -             // request the document
  -             String sessionId = request.getSession().getId();
  -
                //build the document
  -             HTMLDocument doc = buildTransformedDocument(request, response, 
uBean, "GET", sessionId, headerParamHash);
  +             HTMLDocument doc = buildTransformedDocument(request, response, 
uBean, "GET", headerParamHash);
                return doc;
        }
   
  @@ -267,12 +264,11 @@
         [EMAIL PROTECTED]  response         Description of Parameter
         [EMAIL PROTECTED]  uBean            Description of Parameter
         [EMAIL PROTECTED]  httpMethod       Description of Parameter
  -      [EMAIL PROTECTED]  sessionId        Description of Parameter
         [EMAIL PROTECTED]  headerParamHash  Description of Parameter
         [EMAIL PROTECTED]                  The RequestedAndTransformedDocument 
value
         [EMAIL PROTECTED]  Exception    Description of Exception
         */
  -     private HTMLDocument buildTransformedDocument(HttpServletRequest 
request, HttpServletResponse response, UrlBean uBean, String httpMethod, String 
sessionId, Hashtable headerParamHash) throws Exception {
  +     private HTMLDocument buildTransformedDocument(HttpServletRequest 
request, HttpServletResponse response, UrlBean uBean, String httpMethod, 
Hashtable headerParamHash) throws Exception {
   
                // Get a HMTLDocument builder
                HTMLDocumentBuilder builder = new HTMLDocumentBuilder(uBean, 
httpMethod);
  
  
  
  Index: AbstractWizardAction.java
  ===================================================================
  RCS file: 
/home/cvs/repository/webclip_builder/war/src/java/com/jahia/clipping/struts/Util/AbstractWizardAction.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- AbstractWizardAction.java 8 Mar 2005 17:29:44 -0000       1.2
  +++ AbstractWizardAction.java 8 Jun 2005 15:43:47 -0000       1.3
  @@ -176,13 +176,12 @@
         [EMAIL PROTECTED]                     The HeaderParams value
         */
        public Hashtable getHeaderParams(HttpServletRequest httpServletRequest) 
{
  -
                Hashtable headerParamHash = new Hashtable();
                Enumeration headerParamName = 
httpServletRequest.getHeaderNames();
                while (headerParamName.hasMoreElements()) {
                        String name = (String) headerParamName.nextElement();
                        String value = httpServletRequest.getHeader(name);
  -                     //      headerParamHash.put(name, value);
  +                     // headerParamHash.put(name, value);
                        //logger.debug(name + "=" + value);
                }
                headerParamHash.put("User-Agent", 
httpServletRequest.getHeader("User-Agent"));
  
  
  
  Index: HTMLDocumentBuilder.java
  ===================================================================
  RCS file: 
/home/cvs/repository/webclip_builder/war/src/java/com/jahia/clipping/web/HTMLDocumentBuilder.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- HTMLDocumentBuilder.java  7 Jun 2005 17:42:47 -0000       1.5
  +++ HTMLDocumentBuilder.java  8 Jun 2005 15:43:47 -0000       1.6
  @@ -130,7 +130,9 @@
        public HTMLDocument execute(HttpServletRequest request, 
HttpServletResponse response) throws Exception {
                //Execute whith the choosen client
                logger.debug("[ Get HTML as String ]");
  -             String html = getHtmlAsString(request);
  +             String[] res = getHtmlAsStringAndCharEncoding(request);
  +             String html = res[0];
  +
   
                // Execute whith the choosen parser
                logger.debug("[ Get HTML as docuement ]");
  @@ -156,22 +158,23 @@
         [EMAIL PROTECTED]  request  Description of Parameter
         [EMAIL PROTECTED]          The HtmlAsString value
         */
  -     private String getHtmlAsString(HttpServletRequest request) {
  -             String html = "";
  +     private String[] getHtmlAsStringAndCharEncoding(HttpServletRequest 
request) {
  +             String[] res = null;
  +
                try {
                        // execute webClient
                        switch (typeClient_) {
                                case (CLIENT_HTMLUNIT):
                                {
                                        logger.debug("[ Client: HTMLUnit ]");
  -                                     html = 
executeWhithHTMLUnitClient(request);
  +                                     res = 
executeWhithHTMLUnitClient(request);
                                        break;
                                }
   
                                case (CLIENT_HTTPCLIENT):
                                {
                                        logger.debug("[ Client: HttpClient ]");
  -                                     html = executeWhithHttpClient(request);
  +                                     res = executeWhithHttpClient(request);
                                        break;
                                }
                                default:
  @@ -189,7 +192,8 @@
                        addError("Exception: " + ex.toString());
                }
                finally {
  -                     return html;
  +
  +                     return res;
                }
   
        }
  @@ -259,7 +263,7 @@
         [EMAIL PROTECTED]                           Description of the 
Returned Value
         [EMAIL PROTECTED]  WebClippingException  Description of Exception
         */
  -     private String executeWhithHTMLUnitClient(HttpServletRequest request) 
throws WebClippingException {
  +     private String[] executeWhithHTMLUnitClient(HttpServletRequest request) 
throws WebClippingException {
                HTMLUnitProcessor client = new HTMLUnitProcessor(headers_, 
httpMethod_, uBean_);
   
                //set WebClient
  @@ -275,7 +279,10 @@
                //update WebClient
                
session.setAttribute(com.jahia.clipping.web.Constant.WebConstants.WEBCLIENT, 
client.getWebClient());
   
  -             return client.getHtmlAsString();
  +             String html = client.getHtmlAsString();
  +             String encoding = client.getResponseCharSet();
  +             String[] res = {html, encoding};
  +             return res;
        }
   
   
  @@ -286,7 +293,7 @@
         [EMAIL PROTECTED]                           Description of the 
Returned Value
         [EMAIL PROTECTED]  WebClippingException  Description of Exception
         */
  -     private String executeWhithHttpClient(HttpServletRequest request) 
throws WebClippingException {
  +     private String[] executeWhithHttpClient(HttpServletRequest request) 
throws WebClippingException {
                HttpProcessor client = new HttpProcessor(httpMethod_, uBean_);
   
                //set HttpState
  @@ -302,7 +309,10 @@
                //update WebClient
                
session.setAttribute(com.jahia.clipping.web.Constant.WebConstants.HTTPSTATE, 
client.getStateAfterExecution());
   
  -             return client.getHtmlAsString();
  +             String html = client.getHtmlAsString();
  +             String encoding = client.getCharEncoding();
  +             String[] res = {html, encoding};
  +             return res;
        }
   
   
  @@ -387,10 +397,10 @@
        /**
         *  Description of the Method
         *
  -      [EMAIL PROTECTED]  request   Description of Parameter
  -      [EMAIL PROTECTED]  response  Description of Parameter
  -      [EMAIL PROTECTED]  html      Description of Parameter
  -      [EMAIL PROTECTED]           Description of the Returned Value
  +      [EMAIL PROTECTED]  request       Description of Parameter
  +      [EMAIL PROTECTED]  response      Description of Parameter
  +      [EMAIL PROTECTED]  html          Description of Parameter
  +      [EMAIL PROTECTED]               Description of the Returned Value
         */
        private HTMLDocument executeWhithNekoParser(HttpServletRequest request, 
HttpServletResponse response, String html) {
                // HTML --> XHTML
  
  
  
  Index: DefaultHTMLTransformer.java
  ===================================================================
  RCS file: 
/home/cvs/repository/webclip_builder/war/src/java/com/jahia/clipping/web/html/Impl/DefaultHTMLTransformer.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- DefaultHTMLTransformer.java       7 Jun 2005 17:42:47 -0000       1.7
  +++ DefaultHTMLTransformer.java       8 Jun 2005 15:43:47 -0000       1.8
  @@ -1,8 +1,10 @@
   package com.jahia.clipping.web.html.Impl;
   import java.util.*;
   import java.util.Map;
  +
   import javax.servlet.http.*;
   import javax.swing.text.html.*;
  +
   import com.jahia.clipping.Bean.*;
   import com.jahia.clipping.util.*;
   import com.jahia.clipping.web.Constant.*;
  @@ -34,6 +36,7 @@
                setHttpServletRequest(httpServletRequest);
                setHttpServletResponse(httpServletResponse);
                enableCSS(enableCSS);
  +
        }
   
   
  @@ -58,6 +61,8 @@
        }
   
   
  +
  +
        /**
         *  Gets the HttpServletResponse attribute of the JDomHTMLTransformer 
object
         *
  @@ -139,15 +144,17 @@
         */
        public String getRewritedHrefValue(String href) throws Exception {
                //test an url.
  -     //      if (URLUtilities.isRelatif(href) || (href!=null && 
href.substring(4).equalsIgnoreCase("http"))) {
  -                     href = 
URLUtilities.getHrefAbsoluteValue(getUrlBean().getUrlValue(), href);
  -                     String[] params = {href};
  -                     UrlEncoder encoder = new 
UrlEncoder(getHttpServletRequest(),getHttpServletResponse(), "browse", params);
  -                     return encoder.getEncodedUrl();
  -             /*}
  -             else {
  -                     return href;
  -             }*/
  +             //      if (URLUtilities.isRelatif(href) || (href!=null && 
href.substring(4).equalsIgnoreCase("http"))) {
  +             href = 
URLUtilities.getHrefAbsoluteValue(getUrlBean().getUrlValue(), href);
  +             String[] params = {href};
  +             UrlEncoder encoder = new UrlEncoder(getHttpServletRequest(), 
getHttpServletResponse(), "browse", params);
  +             return encoder.getEncodedUrl();
  +             /*
  +              *  }
  +              *  else {
  +              *  return href;
  +              *  }
  +              */
        }
   
   
  @@ -209,8 +216,6 @@
                return lastParsingErrors;
        }
   
  -
  -
        /**
         *  Gets the InlineCssContent attribute of the DefaultHTMLTransformer 
object
         *
  @@ -315,10 +320,11 @@
                                        return false;
                                }
                        }
  -             }else{
  -                    // if type is null then type is submit
  -                    return false;
  -                }
  +             }
  +             else {
  +                     // if type is null then type is submit
  +                     return false;
  +             }
                return true;
        }
   
  
  
  
  Index: StringTreeExtractorFilter.java
  ===================================================================
  RCS file: 
/home/cvs/repository/webclip_builder/war/src/java/com/jahia/clipping/web/html/Impl/StringTreeExtractorFilter.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- StringTreeExtractorFilter.java    7 Jun 2005 17:42:47 -0000       1.4
  +++ StringTreeExtractorFilter.java    8 Jun 2005 15:43:47 -0000       1.5
  @@ -189,8 +189,8 @@
                        logger.error("buldKeySelectedPart error " + 
ex.getMessage());
                }
   
  -                String key = visitor.getBuildedKey();
  -                key=refactorKey(key);
  +             String key = visitor.getBuildedKey();
  +             key = refactorKey(key);
                setKeyPart(key);
   
        }
  @@ -300,7 +300,7 @@
         */
        private String refactorKey(String originalSelectedPart) {
                String realSelectedPart = originalSelectedPart;
  -                realSelectedPart = 
originalSelectedPart.replaceAll(":TBODY","");
  +             realSelectedPart = originalSelectedPart.replaceAll(":TBODY", 
"");
                return realSelectedPart;
        }
   
  @@ -365,7 +365,7 @@
   
                String selectedPart = bspv.getSelectedPart();
                //Rebuild the document
  -             setSelectedPart("<div class=\""+CssUtilities.HTML_CLASS+" 
"+CssUtilities.BODY_CLASS+" \">"+selectedPart+"\n </div>");
  +             setSelectedPart("<div class=\"" + CssUtilities.HTML_CLASS + " " 
+ CssUtilities.BODY_CLASS + " \">" + selectedPart + "\n </div>");
   
        }
   
  @@ -497,6 +497,29 @@
   
   
                /**
  +              *  Gets the SelectedTagEmbeddedInFormTag attribute of the
  +              *  BuildSelectedPartVisitor object
  +              *
  +              [EMAIL PROTECTED]  currentTag  Description of Parameter
  +              [EMAIL PROTECTED]  pTag        Description of Parameter
  +              [EMAIL PROTECTED]             The SelectedTagEmbeddedInFormTag 
value
  +              */
  +             private FormTag getSelectedTagEmbeddedInFormTag(
  +                             Tag currentTag, FormTag pTag) {
  +                     Hashtable atts = pTag.getAttributes();
  +                     pTag = new FormTag();
  +                     pTag.setAttributes(atts);
  +                     FormTag endTag = new FormTag();
  +                     endTag.setTagName("/form");
  +                     pTag.setEndTag(endTag);
  +                     NodeList children = new NodeList();
  +                     children.add(currentTag);
  +                     pTag.setChildren(children);
  +                     return pTag;
  +             }
  +
  +
  +             /**
                 *  Description of the Method
                 *
                 [EMAIL PROTECTED]  tag  Description of Parameter
  @@ -505,19 +528,28 @@
                        // add the selected tags
                        key = key + ":" + tag.getTagName();
                        Tag currentTag = (Tag) tagHash.get(key);
  +
                        if (currentTag != null) {
                                logger.debug("This tag is selected");
                                addedTagSet.add(currentTag);
  -                             Node pNode = currentTag.getParent();
  -                             if (addedTagSet.contains((Tag) pNode)) {
  +                             Tag pTag = (Tag) currentTag.getParent();
  +
  +                             if (addedTagSet.contains(pTag)) {
                                        logger.debug("This tag is already 
rendered");
                                        return;
                                }
  -                             //Tag is selected
  -                             logger.debug("Tag added");
  -                             updateCssHeritance(currentTag, pNode);
  -                             selectedPart = selectedPart + 
currentTag.toHtml();
  -
  +                             //process form parent tag
  +                             if (pTag instanceof FormTag) {
  +                                     logger.debug("Tag added whith form 
parent");
  +                                     FormTag fTag = 
getSelectedTagEmbeddedInFormTag(currentTag, (FormTag) pTag);
  +                                     selectedPart = selectedPart + 
fTag.toHtml();
  +                             }
  +                             else {
  +                                     //Tag is selected
  +                                     logger.debug("Tag added");
  +                                     updateCssHeritance(currentTag, pTag);
  +                                     selectedPart = selectedPart + 
currentTag.toHtml();
  +                             }
                        }
                }
   
  
  
  
  Index: HTMLParserTransformer.java
  ===================================================================
  RCS file: 
/home/cvs/repository/webclip_builder/war/src/java/com/jahia/clipping/web/html/Impl/HTMLParser/HTMLParserTransformer.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- HTMLParserTransformer.java        7 Jun 2005 17:42:47 -0000       1.4
  +++ HTMLParserTransformer.java        8 Jun 2005 15:43:48 -0000       1.5
  @@ -24,10 +24,10 @@
        /**
         *  Constructor for the HTMLParserTransformer object
         *
  -      [EMAIL PROTECTED]  request    Description of Parameter
  -      [EMAIL PROTECTED]  response   Description of Parameter
  -      [EMAIL PROTECTED]  document   Description of Parameter
  -      [EMAIL PROTECTED]  enableCSS  Description of Parameter
  +      [EMAIL PROTECTED]  request       Description of Parameter
  +      [EMAIL PROTECTED]  response      Description of Parameter
  +      [EMAIL PROTECTED]  document      Description of Parameter
  +      [EMAIL PROTECTED]  enableCSS     Description of Parameter
         */
        public HTMLParserTransformer(HttpServletRequest request, 
HttpServletResponse response, HTMLParserDocument document, boolean enableCSS) {
                super(request, response, enableCSS);
  @@ -113,16 +113,13 @@
                try {
                        // Get the original document
                        String originalHtml = 
getDocument().getOriginalDocumentAsString();
  -                     String charSet = null;
  -                     //logger.debug("*************************");
  +                     String charSet = "UTF-8";
                        //logger.debug(originalHtml);
                        //parser html document
                        Parser parser = Parser.createParser(originalHtml, 
charSet);
                        NodeIterator i = parser.elements();
                        Node div = walkThrougthChildrenForTransform(null, i);
   
  -                     //logger.debug(div.toHtml());
  -
                        // update transformed document
                        getDocument().setTransformedDocument(div.toHtml());
                }
  @@ -525,6 +522,24 @@
                                tag.setChildren(children);
                                
tag.removeAttribute(HTML.Attribute.SRC.toString());
                        }
  +                     else {
  +                             //inline javascript
  +                             /*
  +                              *  String content = tag.toPlainTextString();
  +                              *  if (content != null) {
  +                              *  Hashtable atts = tag.getAttributes();
  +                              *  tag = new ScriptTag();
  +                              *  tag.setAttributes(atts);
  +                              *  StyleTag endTag = new StyleTag();
  +                              *  endTag.setTagName("/script");
  +                              *  tag.setEndTag(endTag);
  +                              *  TextNode t = new TextNode("<!--" + "SORRY"+ 
"-->");
  +                              *  NodeList children = new NodeList();
  +                              *  children.add(t);
  +                              *  tag.setChildren(children);
  +                              *  }
  +                              */
  +                     }
   
                }
                catch (Exception ex) {
  
  
  
  Index: JDomHTMLDocument.java
  ===================================================================
  RCS file: 
/home/cvs/repository/webclip_builder/war/src/java/com/jahia/clipping/web/html/Impl/JDom/JDomHTMLDocument.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- JDomHTMLDocument.java     14 Mar 2005 16:29:36 -0000      1.4
  +++ JDomHTMLDocument.java     8 Jun 2005 15:43:48 -0000       1.5
  @@ -401,7 +401,6 @@
         */
        private String getDocumentAsString(org.jdom.Document doc) {
                String res = "<p> Error !!! </p>";
  -
                try {
                        org.w3c.dom.Document domDoc = new 
org.jdom.output.DOMOutputter().output(doc);
                        // get a serializer
  
  
  
  Index: JDomHTMLTransformer.java
  ===================================================================
  RCS file: 
/home/cvs/repository/webclip_builder/war/src/java/com/jahia/clipping/web/html/Impl/JDom/JDomHTMLTransformer.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- JDomHTMLTransformer.java  7 Jun 2005 17:42:47 -0000       1.6
  +++ JDomHTMLTransformer.java  8 Jun 2005 15:43:48 -0000       1.7
  @@ -790,7 +790,7 @@
                                        //Get the url
                                        int equalIndex = urlIndex + 3;
                                        String contentURL = 
content.substring(equalIndex + 1).trim();
  -                                     logger.debug("[ BEFORE meta 
http-equiv=[" + httpEquiv + "] content=[" +content + "] ]");
  +                                     logger.debug("[ BEFORE meta 
http-equiv=[" + httpEquiv + "] content=[" + content + "] ]");
                                        logger.debug("[ Refresh url is [" + 
contentURL + " ] ]");
   
                                        //Encode the url
  @@ -802,7 +802,7 @@
   
                                        //Set the new value whith the encoded 
url
                                        
ele.setAttribute(HTML.Attribute.CONTENT.toString(), contentBeforeURL + "url=" + 
encodedUrl);
  -                                     logger.debug("[ AFTER meta 
http-equiv=[" + httpEquiv + "] content=[" +contentBeforeURL + "url=" + 
encodedUrl + "] ]+");
  +                                     logger.debug("[ AFTER meta 
http-equiv=[" + httpEquiv + "] content=[" + contentBeforeURL + "url=" + 
encodedUrl + "] ]+");
                                }
                        }
                }
  
  
  
  Index: HTMLUnitProcessor.java
  ===================================================================
  RCS file: 
/home/cvs/repository/webclip_builder/war/src/java/com/jahia/clipping/web/http/impl/HTMLUnitProcessor.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- HTMLUnitProcessor.java    6 Jun 2005 13:14:11 -0000       1.3
  +++ HTMLUnitProcessor.java    8 Jun 2005 15:43:48 -0000       1.4
  @@ -1,16 +1,16 @@
   package com.jahia.clipping.web.http.impl;
   
  -import com.gargoylesoftware.htmlunit.*;
  -import com.gargoylesoftware.htmlunit.html.*;
  -import org.apache.commons.httpclient.*;
  -import com.jahia.clipping.util.*;
   import java.io.*;
  +import java.net.*;
   import java.util.*;
   
  -import java.net.*;
  +import com.gargoylesoftware.htmlunit.*;
  +import com.gargoylesoftware.htmlunit.html.*;
   import com.jahia.clipping.Bean.*;
  -import com.jahia.clipping.web.http.HTMLClient;
  -import com.jahia.clipping.web.Url.Impl.URLUtilities;
  +import com.jahia.clipping.util.*;
  +import com.jahia.clipping.web.Url.Impl.*;
  +import com.jahia.clipping.web.http.*;
  +import org.apache.commons.httpclient.*;
   
   /**
    *  Description of the Class
  @@ -43,6 +43,7 @@
        // resultiing htmlDocument
        private String finalUrl;
        private String htmlAsString;
  +     private String responseCharSet;
   
        private boolean errorHasOccured = false;
        private static org.apache.log4j.Logger logger = 
org.apache.log4j.Logger.getLogger(HTMLUnitProcessor.class);
  @@ -154,6 +155,16 @@
   
   
        /**
  +      *  Sets the ResponseCharSet attribute of the HTMLUnitProcessor object
  +      *
  +      [EMAIL PROTECTED]  responseCharSet  The new ResponseCharSet value
  +      */
  +     public void setResponseCharSet(String responseCharSet) {
  +             this.responseCharSet = responseCharSet;
  +     }
  +
  +
  +     /**
         *  Gets the UrlBean attribute of the HTMLUnitProcessor object
         *
         [EMAIL PROTECTED]    The UrlBean value
  @@ -266,6 +277,16 @@
   
   
        /**
  +      *  Gets the ResponseCharSet attribute of the HTMLUnitProcessor object
  +      *
  +      [EMAIL PROTECTED]    The ResponseCharSet value
  +      */
  +     public String getResponseCharSet() {
  +             return responseCharSet;
  +     }
  +
  +
  +     /**
         *  Gets the Header attribute of the HTMLUnitProcessor object
         *
         [EMAIL PROTECTED]    The Header value
  @@ -318,7 +339,7 @@
                        // update url after all redirections
                        logger.debug("[ URL before process is: " + 
getUrlBean().getURL().toExternalForm() + " ]");
                        setFinalUrl(response.getUrl().toExternalForm());
  -                        
getUrlBean().setRedirectUrl(URLUtilities.getURL(getFinalUrl()));
  +                     
getUrlBean().setRedirectUrl(URLUtilities.getURL(getFinalUrl()));
   
                        logger.debug("[ URL after process is: " + 
getUrlBean().getURL().toExternalForm() + " ]");
   
  
  
  
  Index: HttpProcessor.java
  ===================================================================
  RCS file: 
/home/cvs/repository/webclip_builder/war/src/java/com/jahia/clipping/web/http/impl/HttpProcessor.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- HttpProcessor.java        6 Jun 2005 13:14:11 -0000       1.2
  +++ HttpProcessor.java        8 Jun 2005 15:43:48 -0000       1.3
  @@ -1,15 +1,16 @@
   package com.jahia.clipping.web.http.impl;
   
  -import org.apache.commons.httpclient.*;
  -import org.apache.commons.httpclient.methods.*;
  -import org.apache.commons.httpclient.params.*;
   import java.io.*;
  -import com.jahia.clipping.web.html.*;
   import java.util.*;
  +
   import com.jahia.clipping.Bean.*;
  -import com.jahia.clipping.web.http.*;
   import com.jahia.clipping.util.*;
  -import com.jahia.clipping.web.Url.Impl.URLUtilities;
  +import com.jahia.clipping.web.Url.Impl.*;
  +import com.jahia.clipping.web.html.*;
  +import com.jahia.clipping.web.http.*;
  +import org.apache.commons.httpclient.*;
  +import org.apache.commons.httpclient.methods.*;
  +import org.apache.commons.httpclient.params.*;
   
   /**
    *  Give mathod to get the requested document
  @@ -40,6 +41,7 @@
        private HttpState stateBeforeExecution;
        private HttpState stateAfterExecution;
        private String htmlAsString;
  +     private String charEncoding;
   
        private boolean errorHasOccured = false;
        private static org.apache.log4j.Logger logger = 
org.apache.log4j.Logger.getLogger(HttpProcessor.class);
  @@ -220,6 +222,16 @@
   
   
        /**
  +      *  Sets the CharEncoding attribute of the HttpProcessor object
  +      *
  +      [EMAIL PROTECTED]  charEncoding  The new CharEncoding value
  +      */
  +     public void setCharEncoding(String charEncoding) {
  +             this.charEncoding = charEncoding;
  +     }
  +
  +
  +     /**
         *  Gets the JavascriptEnable attribute of the HTMLClient object
         *
         [EMAIL PROTECTED]    The JavascriptEnable value
  @@ -339,6 +351,16 @@
   
   
        /**
  +      *  Gets the CharEncoding attribute of the HttpProcessor object
  +      *
  +      [EMAIL PROTECTED]    The CharEncoding value
  +      */
  +     public String getCharEncoding() {
  +             return charEncoding;
  +     }
  +
  +
  +     /**
         *  Gets the Headers attribute of the HttpProcessor object
         *
         [EMAIL PROTECTED]    The Headers value
  @@ -528,6 +550,7 @@
   
                // Init
                String html = null;
  +                String encoding = null;
                HTMLDocument htmlDocument = null;
   
                try {
  @@ -582,10 +605,12 @@
                        }
                        else {
                                html = method.getResponseBodyAsString();
  +                             encoding = 
method.getResponseHeader("encoding").getValue();
                        }
   
                        // set html
                        setHtmlAsString(html);
  +                        setCharEncoding(encoding);
   
                }
                catch (HttpException e) {
  
  
  
  Index: descriptionAction.jsp
  ===================================================================
  RCS file: 
/home/cvs/repository/webclip_builder/war/src/webapp/jsp/actions/descriptionAction.jsp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- descriptionAction.jsp     7 Jun 2005 17:42:48 -0000       1.3
  +++ descriptionAction.jsp     8 Jun 2005 15:43:48 -0000       1.4
  @@ -66,35 +66,35 @@
           <!-- Name -->
   
         <tr>
  -        <td class="topmenugreen bold waBG">Name and default local title</td>
  +        <td class="topmenugreen bold waBG"><bean:message 
key="description.name"/></td>
           <td class="leftlevel2 waInput">
  -          <html:text property="webClippingName"/>
  +          <html:text property="webClippingName" size="15"/>
           </td>
         </tr>
         <!-- Description -->
         <tr>
  -        <td class="topmenugreen bold waBG">Description</td>
  +        <td class="topmenugreen bold waBG"><bean:message 
key="description.description"/></td>
           <td class="leftlevel2 waInput">
             <html:textarea property="webClippingDescription" rows="7" 
cols="20"/>
           </td>
         </tr>
         <!-- Url -->
         <tr>
  -        <td class="topmenugreen bold waBG">Enter absolute url</td>
  +        <td class="topmenugreen bold waBG"><bean:message 
key="description.url"/></td>
           <td class="leftlevel2 waInput">
             <logic:present name="browseForm">
  -            <html:text property="webClippingTargetUrl" disabled="true" 
size="7"/>
  +            <bean:write name="descriptionClipperForm" 
property="webClippingTargetUrl"/>
             </logic:present>
             <logic:notPresent name="browseForm">
  -            <bean:write name="descriptionClipperForm" 
property="webClippingTargetUrl"/>
  +            <html:text property="webClippingTargetUrl" size="15"/>
             </logic:notPresent>
           </td>
         </tr>
         <!-- Connection -->
         <tr>
  -        <td class="topmenugreen bold waBG">Connection Time Out (in sec)</td>
  +        <td class="topmenugreen bold waBG"><bean:message 
key="description.connection"/></td>
           <td class="leftlevel2 waInput">
  -          <html:text property="webClippingConnectionTimeOut" size="7"/>
  +          <html:text property="webClippingConnectionTimeOut" size="10"/>
           </td>
         </tr>
       </table>
  
  
  
  Index: editAction.jsp
  ===================================================================
  RCS file: 
/home/cvs/repository/webclip_builder/war/src/webapp/jsp/actions/editAction.jsp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- editAction.jsp    8 Mar 2005 17:29:47 -0000       1.2
  +++ editAction.jsp    8 Jun 2005 15:43:48 -0000       1.3
  @@ -98,6 +98,9 @@
           <td class="topmenugreen bold waBG">
             <bean:message key="edit.usedValue"/>
           </td>
  +         <td class="topmenugreen bold waBG">
  +          <bean:message key="edit.visibility"/>
  +        </td>
         </td>
         <logic:iterate name="editParamForm" 
property="actifFormParamsList"id="currentParam">
         <!-- new parameter-->
  @@ -121,6 +124,10 @@
               <bean:message key="edit.password.value"/>
             </td>
           </logic:equal>
  +        <!-- Visibility -->
  +        <td class="leftlevel2 waInput">
  +          <html:text name="currentParam" property="visibility"/>
  +        </td>
         </tr>
       </logic:iterate>
     </table>
  
  
  
  Index: formTemplate.jsp
  ===================================================================
  RCS file: 
/home/cvs/repository/webclip_builder/war/src/webapp/jsp/templates/formTemplate.jsp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- formTemplate.jsp  7 Jun 2005 17:42:48 -0000       1.2
  +++ formTemplate.jsp  8 Jun 2005 15:43:49 -0000       1.3
  @@ -10,7 +10,6 @@
       <title>
         Managing WebClippers
       </title>
  -    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" 
/>
       <link rel="stylesheet" href="web_css.jsp?colorSet=blue" type="text/css" 
/>
       <link rel="stylesheet" href="style.css" type="text/css" />
       <html:base/>
  
  
  
  Index: DESUtilities.java
  ====================================================================
  package com.jahia.clipping.util;
  import javax.crypto.*;
  import java.io.*;
  import java.security.*;
  import javax.crypto.spec.SecretKeySpec;
  import java.security.spec.*;
  
  /**
   *  Description of the Class
   *
   [EMAIL PROTECTED]    Tlili Khaled
   */
  public class DESUtilities {
        private static DESUtilities instance;
        private static org.apache.log4j.Logger logger = 
org.apache.log4j.Logger.getLogger(DESUtilities.class);
  
  
  
        /**
         *  Description of the Method
         *
         [EMAIL PROTECTED]  key      Description of Parameter
         [EMAIL PROTECTED]  message  Description of Parameter
         [EMAIL PROTECTED]          Description of the Returned Value
         */
        public String encrypt(String key, String message) {
                DESEncrypter encrypter = new DESEncrypter();
                encrypter.setKey(key);
                String encryptedMessage = encrypter.encrypt(message);
                  logger.debug("Encrypted message: "+encryptedMessage );
                return encryptedMessage;
        }
  
  
        /**
         *  Description of the Method
         *
         [EMAIL PROTECTED]  key               Description of Parameter
         [EMAIL PROTECTED]  encryptedMessage  Description of Parameter
         [EMAIL PROTECTED]                   Description of the Returned Value
         */
        public String decrypt(String key, String encryptedMessage) {
                DESEncrypter encrypter = new DESEncrypter();
                encrypter.setKey(key);
                String message = encrypter.decrypt(encryptedMessage);
                  logger.debug("Decrypted message: "+message);
                return message;
        }
  
  
  
        /**
         *  Gets the Instance attribute of the DESUtilities object
         *
         [EMAIL PROTECTED]    The Instance value
         */
        public static DESUtilities getInstance() {
                if (instance == null) {
                        instance = new DESUtilities();
                }
                return instance;
        }
  
  
        /**
         *  Constructor for the DESUtilities object
         *
         [EMAIL PROTECTED]      Tlili Khaled
         [EMAIL PROTECTED]  key  Description of Parameter
         */
        class DESEncrypter {
                private Cipher ecipher;
                private Cipher dcipher;
  
  
                /**
                 *  Constructor for the DESEncrypter object
                 */
                public DESEncrypter() {
  
                        try {
                                ecipher = Cipher.getInstance("DES");
                                dcipher = Cipher.getInstance("DES");
                        }
                        catch (NoSuchPaddingException ex) {
                                ex.printStackTrace();
                        }
                        catch (NoSuchAlgorithmException ex) {
                                ex.printStackTrace();
                        }
  
                }
  
  
  
                /**
                 *  Sets the Key attribute of the DESEncrypter object
                 *
                 [EMAIL PROTECTED]  key  The new Key value
                 */
                public void setKey(String key) {
                        try {
                                SecretKeySpec sks = new 
SecretKeySpec(key.getBytes(), "DES");
                                SecretKey sKey = 
SecretKeyFactory.getInstance(sks.getAlgorithm()).generateSecret(sks);
                                ecipher.init(Cipher.ENCRYPT_MODE, sKey);
                                dcipher.init(Cipher.DECRYPT_MODE, sKey);
                        }
                        catch (InvalidKeyException ex) {
                                ex.printStackTrace();
                        }
                        catch (NoSuchAlgorithmException ex) {
                                ex.printStackTrace();
                        }
                        catch (InvalidKeySpecException ex) {
                                ex.printStackTrace();
                        }
  
                }
  
  
                /**
                 *  Description of the Method
                 *
                 [EMAIL PROTECTED]  str  Description of Parameter
                 [EMAIL PROTECTED]      Description of the Returned Value
                 */
                public String encrypt(String str) {
  
                        try {
                                // Encode the string into bytes using utf-8
                                byte[] utf8 = str.getBytes("UTF8");
  
                                // Encrypt
                                byte[] enc = ecipher.doFinal(utf8);
  
                                // Encode bytes to base64 to get a string
                                return new sun.misc.BASE64Encoder().encode(enc);
                        }
                        catch (BadPaddingException ex) {
                                return null;
                        }
                        catch (IllegalBlockSizeException ex) {
                                return null;
                        }
                        catch (UnsupportedEncodingException ex) {
                                return null;
                        }
  
                }
  
  
                /**
                 *  Description of the Method
                 *
                 [EMAIL PROTECTED]  str  Description of Parameter
                 [EMAIL PROTECTED]      Description of the Returned Value
                 */
                public String decrypt(String str) {
                        try {
                                // Decode base64 to get bytes
                                byte[] dec = new 
sun.misc.BASE64Decoder().decodeBuffer(str);
  
                                // Decrypt
                                byte[] utf8 = dcipher.doFinal(dec);
  
                                // Decode using utf-8
                                return new String(utf8, "UTF8");
                        }
                        catch (javax.crypto.BadPaddingException e) {
                        }
                        catch (IllegalBlockSizeException e) {
                        }
                        catch (UnsupportedEncodingException e) {
                        }
                        catch (java.io.IOException e) {
                        }
                        return null;
                }
        }
  }
  
  

Reply via email to