ktlili 2005/06/27 17:05:14 CEST
Modified files:
war/src/java/com/jahia/clipping/Bean ClipperBean.java
UrlBean.java
war/src/java/com/jahia/clipping/struts BrowseAction.java
WebBrowserAction.java
war/src/java/com/jahia/clipping/util HashUtilities.java
URLUtilities.java
war/src/java/com/jahia/clipping/web/Url/Impl UrlEncoder.java
war/src/java/com/jahia/clipping/web/html/Impl
ChewExtractorFilter.java
DefaultHTMLTransformer.java
FormExtractorFilter.java
war/src/java/com/jahia/clipping/web/html/Impl/HTMLParser
TransformBuilderVisitor.java
UserBuilderVisitor.java
war/src/java/com/jahia/clipping/web/html/Impl/JDom
JDomHTMLTransformer.java
war/src/java/com/jahia/clipping/web/html/Impl/Neko
DomHTMLTransformer.java
war/src/java/com/jahia/clipping/web/http/impl
HTMLUnitProcessor.java
HttpProcessor.java
Log:
- change HttpProcessor redirect behavior.
- change hash for form element
- handle form position att.
Revision Changes Path
1.11 +13 -9
webclip_builder/war/src/java/com/jahia/clipping/Bean/ClipperBean.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/webclip_builder/war/src/java/com/jahia/clipping/Bean/ClipperBean.java.diff?r1=1.10&r2=1.11&f=h
1.11 +18 -18
webclip_builder/war/src/java/com/jahia/clipping/Bean/UrlBean.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/webclip_builder/war/src/java/com/jahia/clipping/Bean/UrlBean.java.diff?r1=1.10&r2=1.11&f=h
1.9 +12 -89
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.8&r2=1.9&f=h
1.6 +74 -61
webclip_builder/war/src/java/com/jahia/clipping/struts/WebBrowserAction.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/webclip_builder/war/src/java/com/jahia/clipping/struts/WebBrowserAction.java.diff?r1=1.5&r2=1.6&f=h
1.3 +3 -2
webclip_builder/war/src/java/com/jahia/clipping/util/HashUtilities.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/webclip_builder/war/src/java/com/jahia/clipping/util/HashUtilities.java.diff?r1=1.2&r2=1.3&f=h
1.3 +5 -3
webclip_builder/war/src/java/com/jahia/clipping/util/URLUtilities.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/webclip_builder/war/src/java/com/jahia/clipping/util/URLUtilities.java.diff?r1=1.2&r2=1.3&f=h
1.4 +44 -44
webclip_builder/war/src/java/com/jahia/clipping/web/Url/Impl/UrlEncoder.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/webclip_builder/war/src/java/com/jahia/clipping/web/Url/Impl/UrlEncoder.java.diff?r1=1.3&r2=1.4&f=h
1.7 +1 -1
webclip_builder/war/src/java/com/jahia/clipping/web/html/Impl/ChewExtractorFilter.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/webclip_builder/war/src/java/com/jahia/clipping/web/html/Impl/ChewExtractorFilter.java.diff?r1=1.6&r2=1.7&f=h
1.16 +8 -5
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.15&r2=1.16&f=h
1.4 +20 -13
webclip_builder/war/src/java/com/jahia/clipping/web/html/Impl/FormExtractorFilter.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/webclip_builder/war/src/java/com/jahia/clipping/web/html/Impl/FormExtractorFilter.java.diff?r1=1.3&r2=1.4&f=h
1.3 +15 -7
webclip_builder/war/src/java/com/jahia/clipping/web/html/Impl/HTMLParser/TransformBuilderVisitor.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/webclip_builder/war/src/java/com/jahia/clipping/web/html/Impl/HTMLParser/TransformBuilderVisitor.java.diff?r1=1.2&r2=1.3&f=h
1.4 +2 -3
webclip_builder/war/src/java/com/jahia/clipping/web/html/Impl/HTMLParser/UserBuilderVisitor.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/webclip_builder/war/src/java/com/jahia/clipping/web/html/Impl/HTMLParser/UserBuilderVisitor.java.diff?r1=1.3&r2=1.4&f=h
1.11 +1 -1
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.10&r2=1.11&f=h
1.10 +6 -6
webclip_builder/war/src/java/com/jahia/clipping/web/html/Impl/Neko/DomHTMLTransformer.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/webclip_builder/war/src/java/com/jahia/clipping/web/html/Impl/Neko/DomHTMLTransformer.java.diff?r1=1.9&r2=1.10&f=h
1.6 +6 -3
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.5&r2=1.6&f=h
1.9 +15 -12
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.8&r2=1.9&f=h
Index: ClipperBean.java
===================================================================
RCS file:
/home/cvs/repository/webclip_builder/war/src/java/com/jahia/clipping/Bean/ClipperBean.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- ClipperBean.java 27 Jun 2005 10:06:29 -0000 1.10
+++ ClipperBean.java 27 Jun 2005 15:05:10 -0000 1.11
@@ -486,13 +486,14 @@
[EMAIL PROTECTED] posUrl Description of Parameter
[EMAIL PROTECTED] formParentName Description of Parameter
[EMAIL PROTECTED] formParentId Description of Parameter
+ [EMAIL PROTECTED] formParentPos Description of Parameter
[EMAIL PROTECTED] paramName Description of Parameter
[EMAIL PROTECTED] paramPosition Description of Parameter
[EMAIL PROTECTED] The ParameterMapping value
*/
- public String getParameterMapping(int posUrl, String formParentName,
String formParentId, String paramName, int paramPosition) {
+ public String getParameterMapping(int posUrl, String formParentName,
String formParentId, int formParentPos, String paramName, int paramPosition) {
UrlBean bean = this.getUrlBean(posUrl);
- return bean.getFormParameterMapping(formParentName,
formParentId, paramName, paramPosition);
+ return bean.getFormParameterMapping(formParentName,
formParentId, formParentPos, paramName, paramPosition);
}
@@ -527,13 +528,14 @@
[EMAIL PROTECTED] posUrl Description of Parameter
[EMAIL PROTECTED] formParentName Description of Parameter
[EMAIL PROTECTED] formParentId Description of Parameter
+ [EMAIL PROTECTED] formParentPos Description of Parameter
[EMAIL PROTECTED] paramName Description of Parameter
[EMAIL PROTECTED] paramPosition Description of Parameter
[EMAIL PROTECTED] The ParamType value
*/
- public String getParamType(int posUrl, String formParentName, String
formParentId, String paramName, int paramPosition) {
+ public String getParamType(int posUrl, String formParentName, String
formParentId, int formParentPos, String paramName, int paramPosition) {
UrlBean bean = this.getUrlBean(posUrl);
- return bean.getFormParamType(formParentName, formParentId,
paramName, paramPosition);
+ return bean.getFormParamType(formParentName, formParentId,
formParentPos, paramName, paramPosition);
}
@@ -543,13 +545,14 @@
[EMAIL PROTECTED] posUrl Description of Parameter
[EMAIL PROTECTED] formParentName Description of Parameter
[EMAIL PROTECTED] formParentId Description of Parameter
+ [EMAIL PROTECTED] formParentPos Description of Parameter
[EMAIL PROTECTED] paramName Description of Parameter
[EMAIL PROTECTED] paramPosition Description of Parameter
[EMAIL PROTECTED] The ParamAllowedValue value
*/
- public ArrayList getParamAllowedValuesBeanList(int posUrl, String
formParentName, String formParentId, String paramName, int paramPosition) {
+ public ArrayList getParamAllowedValuesBeanList(int posUrl, String
formParentName, String formParentId, int formParentPos, String paramName, int
paramPosition) {
UrlBean uBean = getUrlBean(posUrl);
- return uBean.getParamFormAllowedValueBeanList(formParentName,
formParentId, paramName, paramPosition);
+ return uBean.getParamFormAllowedValueBeanList(formParentName,
formParentId, formParentPos, paramName, paramPosition);
}
@@ -559,13 +562,14 @@
[EMAIL PROTECTED] posUrl Description of Parameter
[EMAIL PROTECTED] formParentName Description of Parameter
[EMAIL PROTECTED] formParentId Description of Parameter
+ [EMAIL PROTECTED] formParentPos Description of Parameter
[EMAIL PROTECTED] paramName Description of Parameter
[EMAIL PROTECTED] paramPosition Description of Parameter
[EMAIL PROTECTED] The ParamAllowedValuesStringList
value
*/
- public ArrayList getParamAllowedValuesStringList(int posUrl, String
formParentName, String formParentId, String paramName, int paramPosition) {
+ public ArrayList getParamAllowedValuesStringList(int posUrl, String
formParentName, String formParentId, int formParentPos, String paramName, int
paramPosition) {
UrlBean uBean = this.getUrlBean(posUrl);
- return uBean.getParamFormAllowedValueStringList(formParentName,
formParentId, paramName, paramPosition);
+ return uBean.getParamFormAllowedValueStringList(formParentName,
formParentId, formParentPos, paramName, paramPosition);
}
@@ -636,7 +640,7 @@
}
//set the mapping
String mapping = parser.getFormParamMapping(i,
j);
- uBean.setMappingFormParam(formParentName,
formParentId, name, mapping, paramPosition);
+ uBean.setMappingFormParam(formParentName,
formParentId, formParentPosition, name, mapping, paramPosition);
}
Index: UrlBean.java
===================================================================
RCS file:
/home/cvs/repository/webclip_builder/war/src/java/com/jahia/clipping/Bean/UrlBean.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- UrlBean.java 27 Jun 2005 10:20:16 -0000 1.10
+++ UrlBean.java 27 Jun 2005 15:05:10 -0000 1.11
@@ -150,8 +150,8 @@
[EMAIL PROTECTED] mapping The new MappingFormParam value
[EMAIL PROTECTED] paramPosition The new MappingFormParam value
*/
- public void setMappingFormParam(String formParentName, String
formParentId, String name, String mapping, int paramPosition) {
-
getFormParamBeanByNameAndFormParentNameAndFormParentId(formParentName,
formParentId, name, paramPosition).setMapping(mapping);
+ public void setMappingFormParam(String formParentName, String
formParentId,int formParentPos, String name, String mapping, int
paramPosition) {
+
getFormParamBeanByNameAndFormParentNameAndFormParentId(formParentName,
formParentId,formParentPos, name, paramPosition).setMapping(mapping);
}
@@ -197,8 +197,8 @@
[EMAIL PROTECTED] paramPosition The new FormParameterValue value
[EMAIL PROTECTED] Description of the Returned Value
*/
- public FormParamBean setFormParameterValue(String formParentName,
String formParentId, String param, String possibleValue, String type, String
visibility, int paramPosition) {
- FormParamBean bean =
getFormParamBeanByNameAndFormParentNameAndFormParentId(formParentName,
formParentId, param, paramPosition);
+ public FormParamBean setFormParameterValue(String formParentName,
String formParentId,int formParentPos, String param, String possibleValue,
String type, String visibility, int paramPosition) {
+ FormParamBean bean =
getFormParamBeanByNameAndFormParentNameAndFormParentId(formParentName,
formParentId,formParentPos, param, paramPosition);
if (bean != null) {
logger.debug("[ set used value for " + param + ": " +
possibleValue + "]");
bean.setUsedValue(possibleValue);
@@ -365,8 +365,8 @@
[EMAIL PROTECTED] paramPosition Description of Parameter
[EMAIL PROTECTED] The ParamAllowedValue value
*/
- public ArrayList getParamFormAllowedValueBeanList(String
formParentName, String formParentId, String paramName, int paramPosition) {
- return
this.getFormParamBeanByNameAndFormParentNameAndFormParentId(formParentName,
formParentId, paramName, paramPosition).getListPossibleBeanValue();
+ public ArrayList getParamFormAllowedValueBeanList(String
formParentName, String formParentId,int formParentPos, String paramName, int
paramPosition) {
+ return
this.getFormParamBeanByNameAndFormParentNameAndFormParentId(formParentName,
formParentId,formParentPos, paramName,
paramPosition).getListPossibleBeanValue();
}
@@ -379,8 +379,8 @@
[EMAIL PROTECTED] paramPosition Description of Parameter
[EMAIL PROTECTED] The ParamFormAllowedValueStringList
value
*/
- public ArrayList getParamFormAllowedValueStringList(String
formParentName, String formParentId, String paramName, int paramPosition) {
- return
this.getFormParamBeanByNameAndFormParentNameAndFormParentId(formParentName,
formParentId, paramName, paramPosition).getListPossibleStringValue();
+ public ArrayList getParamFormAllowedValueStringList(String
formParentName, String formParentId,int formParentPos, String paramName, int
paramPosition) {
+ return
this.getFormParamBeanByNameAndFormParentNameAndFormParentId(formParentName,
formParentId,formParentPos, paramName,
paramPosition).getListPossibleStringValue();
}
@@ -393,8 +393,8 @@
[EMAIL PROTECTED] paramPosition Description of Parameter
[EMAIL PROTECTED] The ParameterMapping value
*/
- public String getFormParameterMapping(String formParentName, String
formParentId, String paramName, int paramPosition) {
- FormParamBean bean =
getFormParamBeanByNameAndFormParentNameAndFormParentId(formParentName,
formParentId, paramName, paramPosition);
+ public String getFormParameterMapping(String formParentName, String
formParentId,int formParentPos, String paramName, int paramPosition) {
+ FormParamBean bean =
getFormParamBeanByNameAndFormParentNameAndFormParentId(formParentName,
formParentId,formParentPos, paramName, paramPosition);
return bean.getMapping();
}
@@ -421,8 +421,8 @@
[EMAIL PROTECTED] paramPosition Description of Parameter
[EMAIL PROTECTED] The ParamType value
*/
- public String getFormParamType(String formParentName, String
formParentId, String paramName, int paramPosition) {
- FormParamBean bean =
getFormParamBeanByNameAndFormParentNameAndFormParentId(formParentName,
formParentId, paramName, paramPosition);
+ public String getFormParamType(String formParentName, String
formParentId,int formParentPos, String paramName, int paramPosition) {
+ FormParamBean bean =
getFormParamBeanByNameAndFormParentNameAndFormParentId(formParentName,
formParentId,formParentPos, paramName, paramPosition);
return bean.getType();
}
@@ -484,9 +484,9 @@
[EMAIL PROTECTED] paramPosition Description of Parameter
[EMAIL PROTECTED] The FormParamBean value
*/
- public FormParamBean
getFormParamBeanByNameAndFormParentNameAndFormParentId(String formParentName,
String formParentId, String name, int paramPosition) {
+ public FormParamBean
getFormParamBeanByNameAndFormParentNameAndFormParentId(String formParentName,
String formParentId,int formParentPos, String name, int paramPosition) {
// find the FormParamBean object
- String formHash = HashUtilities.buildFormHash(formParentName,
formParentId);
+ String formHash = HashUtilities.buildFormHash(formParentName,
formParentId,formParentPos);
return getFormParamByNameAndFormParentHash(name, paramPosition,
formHash);
}
@@ -596,8 +596,8 @@
[EMAIL PROTECTED] Description of the Returned Value
*/
public FormParamBean addFormParameter(String formParentName, String
formParentId, int formParentPosition, String paramName, String possibleValue,
String type, String visibility, boolean editable, int paramPosition) {
- String formParentHah =
HashUtilities.buildFormHash(formParentName, formParentId);
- FormParamBean bean =
getFormParamBeanByNameAndFormParentNameAndFormParentId(formParentName,
formParentId, paramName, paramPosition);
+ String formParentHah =
HashUtilities.buildFormHash(formParentName, formParentId,formParentPosition);
+ FormParamBean bean =
getFormParamBeanByNameAndFormParentNameAndFormParentId(formParentName,
formParentId,formParentPosition, paramName, paramPosition);
if (bean != null &&
type.equalsIgnoreCase(WebConstants.TYPE_RADIO)) {
logger.debug("[ Add posiible value for " + paramName +
" ]");
if (!editable) {
@@ -668,8 +668,8 @@
[EMAIL PROTECTED] paramPosition Description of Parameter
[EMAIL PROTECTED] Description of the Returned Value
*/
- public boolean formParamExist(String formParentName, String
formParentId, String paramName, int paramPosition) {
- return
(getFormParamBeanByNameAndFormParentNameAndFormParentId(formParentName,
formParentId, paramName, paramPosition) != null);
+ public boolean formParamExist(String formParentName, String
formParentId,int formParentPos, String paramName, int paramPosition) {
+ return
(getFormParamBeanByNameAndFormParentNameAndFormParentId(formParentName,
formParentId,formParentPos, paramName, paramPosition) != null);
}
Index: BrowseAction.java
===================================================================
RCS file:
/home/cvs/repository/webclip_builder/war/src/java/com/jahia/clipping/struts/BrowseAction.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- BrowseAction.java 27 Jun 2005 10:06:29 -0000 1.8
+++ BrowseAction.java 27 Jun 2005 15:05:11 -0000 1.9
@@ -121,14 +121,13 @@
HttpSession session = httpServletRequest.getSession();
RecordingBean rb = (RecordingBean)
session.getAttribute(WebConstants.RECORDING);
- // add the bean of the recording bean
-
getClipperBean(httpServletRequest).addUrlBean(rb.getCurrentUrlBean());
+ // add the bean of the recording bean
+
getClipperBean(httpServletRequest).addUrlBean(rb.getCurrentUrlBean());
rb.setStatut(RecordingBean.START);
- session.setAttribute(WebConstants.RECORDING, rb);
-
- // updtade the webBrowser state
-
getWebBrowserForm(httpServletRequest).setShow(Constants.WEB_BROWSER_SHOW_LAST_DOCUMENT);
+ session.setAttribute(WebConstants.RECORDING, rb);
+ // updtade the webBrowser state
+
getWebBrowserForm(httpServletRequest).setShow(Constants.WEB_BROWSER_SHOW_LAST_DOCUMENT);
return actionMapping.getInputForward();
}
@@ -152,8 +151,8 @@
RecordingBean rb = (RecordingBean)
session.getAttribute(WebConstants.RECORDING);
rb.setStatut(RecordingBean.STOP);
- // updtade the webBrowser state
-
getWebBrowserForm(httpServletRequest).setShow(Constants.WEB_BROWSER_SHOW_LAST_DOCUMENT);
+ // updtade the webBrowser state
+
getWebBrowserForm(httpServletRequest).setShow(Constants.WEB_BROWSER_SHOW_LAST_DOCUMENT);
session.setAttribute(WebConstants.RECORDING, rb);
return actionMapping.getInputForward();
@@ -284,19 +283,8 @@
return actionMapping.findForward("description");
}
- //set the content
- //addUrlandUpdateHTMLContent(httpServletRequest,
httpServletResponse, browseForm);
}
- /*
- * catch (WebClippingException ex) {
- * logger.error("[ Error has occured ]");
- * ActionError e = new ActionError("errors.exception",
ex.getType());
- * errors.add("errors.exception", e);
- * e = new ActionError("errors.exception", ex.toString());
- * errors.add("errors.exception", e);
- * ex.printStackTrace();
- * }
- */
+
catch (Exception ex) {
ActionError e = new ActionError("errors.exception",
ex.getStackTrace()[0].toString());
e = new ActionError("errors.exception", ex.toString());
@@ -346,7 +334,7 @@
//set the content
removeLastUrlandSetHTMLContent(httpServletRequest,
httpServletResponse, browseForm);
-
this.getWebBrowserForm(httpServletRequest).setShow(Constants.WEB_BROWSER_SHOW_LAST_DOCUMENT);
+
this.getWebBrowserForm(httpServletRequest).setShow(Constants.WEB_BROWSER_SHOW_LAST_DOCUMENT);
//logger.debug("[
"+uBean.getDocument().getTransformedDocumentAsString()+" ]");
return actionMapping.getInputForward();
@@ -478,72 +466,7 @@
}
- /**
- * Sets the ContentType attribute of the BrowseAction object
- */
- /*
- * private void addUrlandUpdateHTMLContent(HttpServletRequest
httpServletRequest, HttpServletResponse httpServletResponse, BrowseForm
browseForm) throws Exception {
- * //Build UrlBean
- * //String url = URLUtilities.decode(browseForm.getSourceUrl());
- * String hash = browseForm.getLinkHash();
- * URLWrapper uw = getURLMap(httpServletRequest).getSourceUrl(hash);
- * if (uw == null) {
- * logger.error("URLWrapper not found");
- * }
- * String url = uw.getSourceUrl();
- * //synchronize browseForme
- * browseForm.setSourceUrl(url);
- * browseForm.setFrom(uw.getFrom());
- * browseForm.setHttpMethod(uw.getMethod());
- * String from = browseForm.getFrom();
- * logger.debug("[ URL is: " + url + " ]");
- * logger.debug("Browse action: from: " + from);
- * logger.debug("Browse action: hash: " + hash);
- * if (hash == null) {
- * hash = "";
- * }
- * if (from == null) {
- * from = "";
- * }
- * UrlBean uBean = buildUrlBeanWhithDoument(httpServletRequest,
httpServletResponse, url, browseForm.getHttpMethod(), from, hash);
- * // Get beans
- * ClipperBean bean = getClipperBean(httpServletRequest);
- * RecordingBean rBean = getRecorderBean(httpServletRequest);
- * //Get the statut of the recording
- * boolean recording = rBean.getStatut() == RecordingBean.START;
- * // wizard is in recording statut
- * if (recording) {
- * // add the url to the clipper bean
- * logger.debug("[add the url " + url + " to the clipper bean]");
- * //the source url has been set by an action on the previous page
- * bean.addUrlBean(uBean);
- * }
- * else {
- * // update the bean sourceUrl
- * logger.debug("[ Statut = Not Recording : " + url + "]");
- * // update the url of the recording bean
- * rBean.setCurrentUrlBean(uBean);
- * }
- * //Set the used value for the previous url
- * setUsedValueForPreviousUrl(httpServletRequest, uBean, bean);
- * //Get the HTMDocument
- * HTMLDocument doc = uBean.getDocument();
- * //Get the transformation and set the body content parameter
- * String transfDoc = doc.getTransformedDocumentAsString();
- * String encodedHTML = new String(transfDoc.getBytes(),
httpServletResponse.getCharacterEncoding());
- * logger.debug("Encoding is: " +
httpServletResponse.getCharacterEncoding());
- * browseForm.setBodyContent(encodedHTML);
- * //Get and save all errors that's occured during tansformation
- * List errors = doc.getTransformationErrors();
- * ActionErrors actionErrors = new ActionErrors();
- * for (int i = 0; i < errors.size(); i++) {
- * String error = errors.get(i).toString();
- * ActionError e = new ActionError("errors.message", error);
- * actionErrors.add("errors.message", e);
- * }
- * addErrors(httpServletRequest, actionErrors);
- * }
- */
+
/**
* Description of the Method
*
@@ -570,8 +493,8 @@
}
- //update browser form
-
getWebBrowserForm(httpServletRequest).setShow(Constants.WEB_BROWSER_SHOW_LAST_DOCUMENT);
+ //update browser form
+
getWebBrowserForm(httpServletRequest).setShow(Constants.WEB_BROWSER_SHOW_LAST_DOCUMENT);
}
Index: WebBrowserAction.java
===================================================================
RCS file:
/home/cvs/repository/webclip_builder/war/src/java/com/jahia/clipping/struts/WebBrowserAction.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- WebBrowserAction.java 27 Jun 2005 10:06:29 -0000 1.5
+++ WebBrowserAction.java 27 Jun 2005 15:05:11 -0000 1.6
@@ -139,74 +139,85 @@
[EMAIL PROTECTED] Exception Description of Exception
*/
public ActionForward execute(ActionMapping actionMapping, ActionForm
actionForm, HttpServletRequest httpServletRequest, HttpServletResponse
httpServletResponse) throws Exception {
- logger.debug("[WebBrowser - Execute ]");
- WebBrowserForm form = (WebBrowserForm) actionForm;
+ try {
+ logger.debug("[WebBrowser - Execute ]");
+ WebBrowserForm form = (WebBrowserForm) actionForm;
- ClipperBean bean = getClipperBean(httpServletRequest);
- //Handing error
- logger.debug("[WebBrowser - Execute - Handle Error ]");
- if (bean == null) {
- logger.error("[WebBrowser - Execute - ClipperBean not
found ]");
- //return actionMapping.findForward("description");
- }
-
- //init
- if (form.getLinkHash() == null) {
- logger.debug("[WebBrowser - Execute - Init link hash
]");
- form.setLinkHash(Constants.FIRST_URL_HASH);
- form.setFrom(Constants.FIRST_URL_FROM);
- }
-
- //process only if it'st a new action (does'nt load from wizard)
- logger.debug("[ WebBrowser ]");
-
- //set the html content
- //show request document
- String showParam = form.getShow();
- logger.debug("Show Param: " + showParam);
- String html = "Error HTML not Set";
- if (showParam != null) {
- if
(showParam.equalsIgnoreCase(Constants.WEB_BROWSER_SHOW_BROWSE)) {
- logger.debug(" SHOW BROWSE DOCUMENT ");
- HTMLDocument doc =
addUrlBeanAndGetHTMLDocument(httpServletRequest, httpServletResponse, form);
- html = doc.getTransformedDocumentAsString();
+ ClipperBean bean = getClipperBean(httpServletRequest);
+ //Handing error
+ logger.debug("[WebBrowser - Execute - Handle Error ]");
+ if (bean == null) {
+ logger.error(
+ "[WebBrowser - Execute -
ClipperBean not found ]");
+ //return
actionMapping.findForward("description");
}
- else if
(showParam.equalsIgnoreCase(Constants.WEB_BROWSER_SHOW_LAST_DOCUMENT)) {
- logger.debug(" SHOW LAST DOCUMENT ");
- HTMLDocument doc =
getLastRecordedHTMLDocument(httpServletRequest, httpServletResponse, form);
- html = doc.getTransformedDocumentAsString();
- }
- else if
(showParam.equalsIgnoreCase(Constants.WEB_BROWSER_SHOW_EDIPARAMS)) {
- logger.debug(" SHOW EDIT PARAMS DOCUMENT ");
- int positionUrl = form.getPositionUrl();
- HTMLDocument doc =
getClipperBean(httpServletRequest).getUrlBean(positionUrl).getDocument();
- html = doc.getDocumentWhithParamLabelAsString();
- }
- else if
(showParam.equalsIgnoreCase(Constants.WEB_BROWSER_SHOW_CHEW)) {
- logger.debug(" SHOW CHEW DOCUMENT ");
- HTMLDocument doc =
getLastRecordedHTMLDocument(httpServletRequest, httpServletResponse, form);
- html = doc.getChewDocumentAsString();
+ //init
+ if (form.getLinkHash() == null) {
+ logger.debug("[WebBrowser - Execute - Init link
hash ]");
+ form.setLinkHash(Constants.FIRST_URL_HASH);
+ form.setFrom(Constants.FIRST_URL_FROM);
}
- else if
(showParam.equalsIgnoreCase(Constants.WEB_BROWSER_SHOW_PREVIEW)) {
- logger.debug(" SHOW PREVIEW");
- html = buildSelectedPart(httpServletRequest);
- }
- else if
(showParam.equalsIgnoreCase(Constants.WEB_BROWSER_SHOW_TEST)) {
- logger.debug(" TEST PREVIEW");
- html = runWebSimulator(httpServletRequest,
httpServletResponse, form, bean);
- }
+ //process only if it'st a new action (does'nt load from
wizard)
+ logger.debug("[ WebBrowser ]");
+
+ //set the html content
+ //show request document
+ String showParam = form.getShow();
+ logger.debug("Show Param: " + showParam);
+ String html = "Error HTML not Set";
+ if (showParam != null) {
+ if
(showParam.equalsIgnoreCase(Constants.WEB_BROWSER_SHOW_BROWSE)) {
+ logger.debug(" SHOW BROWSE DOCUMENT ");
+ HTMLDocument doc =
addUrlBeanAndGetHTMLDocument(httpServletRequest, httpServletResponse,form);
+ html =
doc.getTransformedDocumentAsString();
+ }
+
+ else if (showParam.equalsIgnoreCase(
+
Constants.WEB_BROWSER_SHOW_LAST_DOCUMENT)) {
+ logger.debug(" SHOW LAST DOCUMENT ");
+ HTMLDocument doc =
getLastRecordedHTMLDocument(httpServletRequest, httpServletResponse,form);
+ html =
doc.getTransformedDocumentAsString();
+ }
+ else if
(showParam.equalsIgnoreCase(Constants.WEB_BROWSER_SHOW_EDIPARAMS)) {
+ logger.debug(" SHOW EDIT PARAMS
DOCUMENT ");
+ int positionUrl = form.getPositionUrl();
+ HTMLDocument doc =
getClipperBean(httpServletRequest).getUrlBean(positionUrl).getDocument();
+ html =
doc.getDocumentWhithParamLabelAsString();
+ }
+ else if
(showParam.equalsIgnoreCase(Constants.WEB_BROWSER_SHOW_CHEW)) {
+ logger.debug(" SHOW CHEW DOCUMENT ");
+ HTMLDocument doc =
getLastRecordedHTMLDocument(httpServletRequest, httpServletResponse,form);
+ html = doc.getChewDocumentAsString();
+ }
+ else if (showParam.equalsIgnoreCase(
+
Constants.WEB_BROWSER_SHOW_PREVIEW)) {
+ logger.debug(" SHOW PREVIEW");
+ html =
buildSelectedPart(httpServletRequest);
+ }
+ else if (showParam.equalsIgnoreCase(
+
Constants.WEB_BROWSER_SHOW_TEST)) {
+ logger.debug(" TEST PREVIEW");
+ html =
runWebSimulator(httpServletRequest,
+ httpServletResponse,
form, bean);
+ }
+
+ else {
+ logger.error("Show Param Value not
expected: " +
+ form);
+ }
+ }
else {
- logger.error("Show Param Value not expected: "
+ form);
+ logger.error("Show Param not found");
}
+
+ form.setContent(html);
}
- else {
- logger.error("Show Param not found");
+ catch (Exception ex) {
+ ex.printStackTrace();
}
-
- form.setContent(html);
return actionMapping.getInputForward();
}
@@ -286,10 +297,10 @@
}
//update form properties
- form.setFrom(uBean.getFrom());
+ // form.setFrom(uBean.getFrom());
form.setLinkHash(uBean.getHash());
- form.setPositionUrl(uBean.getPosition());
- form.setSourceUrl(uBean.getUrlValue());
+ // form.setPositionUrl(uBean.getPosition());
+ // form.setSourceUrl(uBean.getUrlValue());
return htmlDocument;
}
@@ -487,6 +498,8 @@
String error = errors.get(i).toString();
ActionError e = new ActionError("errors.message",
error);
actionErrors.add("errors.message", e);
+ BrowseForm bForm =
(BrowseForm)httpServletRequest.getAttribute(Constants.BROWSE_FORM);
+ bForm.getErrors().add("errors.message", e);
}
addErrors(httpServletRequest, actionErrors);
Index: HashUtilities.java
===================================================================
RCS file:
/home/cvs/repository/webclip_builder/war/src/java/com/jahia/clipping/util/HashUtilities.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- HashUtilities.java 24 Jun 2005 15:43:36 -0000 1.2
+++ HashUtilities.java 27 Jun 2005 15:05:11 -0000 1.3
@@ -95,9 +95,10 @@
*
[EMAIL PROTECTED] formName Description of Parameter
[EMAIL PROTECTED] formId Description of Parameter
+ [EMAIL PROTECTED] position Description of Parameter
[EMAIL PROTECTED] The FormHash value
*/
- public static String buildFormHash(String formName, String formId) {
+ public static String buildFormHash(String formName, String formId, int
position) {
/*
* if(formId != null && !formId.equalsIgnoreCase("")){
* return formId;
@@ -105,7 +106,7 @@
*/
if (formName == null || formName.equalsIgnoreCase("")) {
if (formId == null || formId.equalsIgnoreCase("")) {
- return "position";
+ return ""+position;
}
}
return formName + ":" + formId;
Index: URLUtilities.java
===================================================================
RCS file:
/home/cvs/repository/webclip_builder/war/src/java/com/jahia/clipping/util/URLUtilities.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- URLUtilities.java 23 Jun 2005 16:15:47 -0000 1.2
+++ URLUtilities.java 27 Jun 2005 15:05:11 -0000 1.3
@@ -97,9 +97,11 @@
[EMAIL PROTECTED] MalformedURLException Description of Exception
*/
public static String getHrefAbsoluteValue(String baseUrl, String url)
throws MalformedURLException {
- //logger.debug("[ Get absolute url of: " + url + " ]");
-
- return getAbsolutURL(getURL(baseUrl), url).toExternalForm();
+ logger.debug("[ Get absolute url of: " + url + " ]");
+ logger.debug("[ Base url: " + baseUrl + " ]");
+ String res = getAbsolutURL(getURL(baseUrl),
url).toExternalForm();;
+ logger.debug("[ Result: " + res + " ]");
+ return res;
}
Index: UrlEncoder.java
===================================================================
RCS file:
/home/cvs/repository/webclip_builder/war/src/java/com/jahia/clipping/web/Url/Impl/UrlEncoder.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- UrlEncoder.java 23 Jun 2005 16:15:48 -0000 1.3
+++ UrlEncoder.java 27 Jun 2005 15:05:12 -0000 1.4
@@ -135,7 +135,6 @@
-
/**
* Sets the Type attribute of the UrlEncoder object
*
@@ -221,52 +220,53 @@
* perform the encoding
*/
public void encodeUrl() {
- logger.debug("[ Encoding the url ]");
- String action = getAction();
- encodedUrl = getHttpServletRequest().getContextPath();
- // if it's a link, the attributs must be specified in the query
-
-
- //Get the url to encode
- String sourceUrl = getParameters()[0];
- String from = getParameters()[2];
-
- //update url map
- URLWrapper uw = new URLWrapper();
- uw.setFrom(from);
- uw.setSourceUrl(sourceUrl);
- uw.setMethod(method);
-
- String hash = "";
- if (getType() == WebConstants.URLENCODER_TYPE_LINK) {
- String position = getParameters()[1];
- from = getParameters()[2];
- String id = getParameters()[3];
- hash = HashUtilities.buildLinkHash(sourceUrl, id,
position);
- }
- else if (getType() == WebConstants.URLENCODER_TYPE_FORM) {
- String formName = getParameters()[1];
- String formId = getParameters()[2];
- from = getParameters()[3];
- hash = HashUtilities.buildFormHash(formName, formId);
- }
- else if (getType() == WebConstants.URLENCODER_TYPE_JAVASCRIPT) {
- String position = getParameters()[1];
- hash =
HashUtilities.buildJavascriptLocationHash(position);
- }
- else if (getType() == WebConstants.URLENCODER_TYPE_METALINK) {
- String id = "meta_id";
- String position = "meta_pos";
- hash = HashUtilities.buildLinkHash(sourceUrl, id,
position);
- }
+ try {
+ logger.debug("[ Encoding the url ]");
+ String action = getAction();
+ encodedUrl = getHttpServletRequest().getContextPath();
+ // if it's a link, the attributs must be specified in
the query
+
+
+ //Get the url to encode
+ String sourceUrl = getParameters()[0];
+ String from = getParameters()[2];
+
+ //update url map
+ URLWrapper uw = new URLWrapper();
+ uw.setFrom(from);
+ uw.setSourceUrl(sourceUrl);
+ uw.setMethod(method);
+
+ String hash = "";
+ if (getType() == WebConstants.URLENCODER_TYPE_LINK) {
+ String position = getParameters()[1];
+ from = getParameters()[2];
+ String id = getParameters()[3];
+ hash = HashUtilities.buildLinkHash(sourceUrl,
id, position);
+ }
+ else if (getType() ==
WebConstants.URLENCODER_TYPE_FORM) {
+ String formName = getParameters()[1];
+ String formId = getParameters()[2];
+ from = getParameters()[3];
+ String formPos = getParameters()[4];
+ hash = HashUtilities.buildFormHash(formName,
formId, Integer.parseInt(formPos));
+ }
+ else if (getType() ==
WebConstants.URLENCODER_TYPE_JAVASCRIPT) {
+ String position = getParameters()[1];
+ hash =
HashUtilities.buildJavascriptLocationHash(position);
+ }
+ else if (getType() ==
WebConstants.URLENCODER_TYPE_METALINK) {
+ String id = "meta_id";
+ String position = "meta_pos";
+ hash = HashUtilities.buildLinkHash(sourceUrl,
id, position);
+ }
- URLMap map = (URLMap)
getHttpServletRequest().getSession().getAttribute(com.jahia.clipping.struts.Util.Constants.URL_MAP);
- map.addSourceUrl(uw, hash);
+ URLMap map = (URLMap)
getHttpServletRequest().getSession().getAttribute(com.jahia.clipping.struts.Util.Constants.URL_MAP);
+ map.addSourceUrl(uw, hash);
- // build the new url
- encodedUrl = encodedUrl + "/webBrowser.do?show=" + action +
"&linkHash=" + hash;
+ // build the new url
+ encodedUrl = encodedUrl + "/webBrowser.do?show=" +
action + "&linkHash=" + hash;
- try {
encodedUrl =
getHttpServletResponse().encodeURL(encodedUrl);
}
catch (Exception ex) {
Index: ChewExtractorFilter.java
===================================================================
RCS file:
/home/cvs/repository/webclip_builder/war/src/java/com/jahia/clipping/web/html/Impl/ChewExtractorFilter.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ChewExtractorFilter.java 24 Jun 2005 14:27:49 -0000 1.6
+++ ChewExtractorFilter.java 27 Jun 2005 15:05:12 -0000 1.7
@@ -79,7 +79,7 @@
[EMAIL PROTECTED] The SelectedPart value
*/
public String getSelectedPart(HTMLDocument doc) {
- String selectedPart = "Not found";
+ String selectedPart = "SelectePart Not found";
String html = doc.getTransformedDocumentAsString();
String charSet = "";
Parser parser = Parser.createParser(html, charSet);
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.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- DefaultHTMLTransformer.java 27 Jun 2005 08:51:01 -0000 1.15
+++ DefaultHTMLTransformer.java 27 Jun 2005 15:05:12 -0000 1.16
@@ -181,11 +181,13 @@
*
[EMAIL PROTECTED] formParentName Description of Parameter
[EMAIL PROTECTED] formParentId Description of Parameter
+ [EMAIL PROTECTED] formParentPos Description of Parameter
[EMAIL PROTECTED] name Description of Parameter
+ [EMAIL PROTECTED] paramPosition Description of Parameter
[EMAIL PROTECTED] The FormParamBean value
*/
- public FormParamBean getFormParamBean(String formParentName, String
formParentId, String name, int paramPosition) {
- FormParamBean fBean =
getUrlBean().getFormParamBeanByNameAndFormParentNameAndFormParentId(formParentName,
formParentId, name, paramPosition);
+ public FormParamBean getFormParamBean(String formParentName, String
formParentId, int formParentPos, String name, int paramPosition) {
+ FormParamBean fBean =
getUrlBean().getFormParamBeanByNameAndFormParentNameAndFormParentId(formParentName,
formParentId, formParentPos, name, paramPosition);
return fBean;
}
@@ -199,11 +201,12 @@
[EMAIL PROTECTED] method Description of Parameter
[EMAIL PROTECTED] formName Description of Parameter
[EMAIL PROTECTED] formId Description of Parameter
+ [EMAIL PROTECTED] formPos Description of Parameter
[EMAIL PROTECTED] webBrowserAction Description of Parameter
[EMAIL PROTECTED] The RewritedActionValue value
[EMAIL PROTECTED] Exception Description of Exception
*/
- public String getRewritedActionValue(String action, String method,
String formName, String formId, String webBrowserAction) throws Exception {
+ public String getRewritedActionValue(String action, String method,
String formName, String formId, String formPos, String webBrowserAction) throws
Exception {
// aseert not null
if (method == null || method.equalsIgnoreCase("")) {
method = "GET";
@@ -217,8 +220,8 @@
}
logger.debug("Rewrite action form: " + action + "," + method +
"," + formName + "," + formId);
- action =
URLUtilities.getHrefAbsoluteValue(getUrlBean().getUrlValue(), action);
- String[] params = {action, formName, formId, "submitForm"};
+ action =
URLUtilities.getHrefAbsoluteValue(getUrlBean().getRedirectUrl(), action);
+ String[] params = {action, formName, formId, "submitForm",
formPos};
UrlEncoder encoder = new UrlEncoder(getHttpServletRequest(),
getHttpServletResponse(), webBrowserAction, WebConstants.URLENCODER_TYPE_FORM,
params, false, method, true);
return encoder.getEncodedUrl();
}
Index: FormExtractorFilter.java
===================================================================
RCS file:
/home/cvs/repository/webclip_builder/war/src/java/com/jahia/clipping/web/html/Impl/FormExtractorFilter.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- FormExtractorFilter.java 23 Jun 2005 16:15:49 -0000 1.3
+++ FormExtractorFilter.java 27 Jun 2005 15:05:12 -0000 1.4
@@ -17,7 +17,7 @@
*/
public class FormExtractorFilter implements ExtractorFilter {
private String key;
- private final String NAME = "FormExtractorFilter";
+ private final String NAME = "FormExtractorFilter";
@@ -32,11 +32,12 @@
/**
* Constructor for the FormExtractorFilter object
*
- [EMAIL PROTECTED] name Description of Parameter
- [EMAIL PROTECTED] id Description of Parameter
+ [EMAIL PROTECTED] name Description of Parameter
+ [EMAIL PROTECTED] id Description of Parameter
+ [EMAIL PROTECTED] position Description of Parameter
*/
- public FormExtractorFilter(String name, String id) {
- String key = buildKey(name, id);
+ public FormExtractorFilter(String name, String id, int position) {
+ String key = buildKey(name, id, position);
this.setKeyPart(key);
}
@@ -51,9 +52,14 @@
}
- public String getName() {
- return NAME.toString();
- }
+ /**
+ * Gets the Name attribute of the FormExtractorFilter object
+ *
+ [EMAIL PROTECTED] The Name value
+ */
+ public String getName() {
+ return NAME.toString();
+ }
@@ -102,12 +108,13 @@
/**
* Description of the Method
*
- [EMAIL PROTECTED] name Description of Parameter
- [EMAIL PROTECTED] id Description of Parameter
- [EMAIL PROTECTED] Description of the Returned Value
+ [EMAIL PROTECTED] name Description of Parameter
+ [EMAIL PROTECTED] id Description of Parameter
+ [EMAIL PROTECTED] position Description of Parameter
+ [EMAIL PROTECTED] Description of the Returned Value
*/
- private String buildKey(String name, String id) {
- return HashUtilities.buildFormHash(name, id);
+ private String buildKey(String name, String id, int position) {
+ return HashUtilities.buildFormHash(name, id, position);
}
}
Index: TransformBuilderVisitor.java
===================================================================
RCS file:
/home/cvs/repository/webclip_builder/war/src/java/com/jahia/clipping/web/html/Impl/HTMLParser/TransformBuilderVisitor.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- TransformBuilderVisitor.java 27 Jun 2005 08:51:02 -0000 1.2
+++ TransformBuilderVisitor.java 27 Jun 2005 15:05:12 -0000 1.3
@@ -34,7 +34,7 @@
/**
* Description of the Field
*/
- protected int formParentPosition = -1;
+ protected int formParentPosition = 0;
/**
* Description of the Field
*/
@@ -94,7 +94,7 @@
String name =
WebConstants.JAVASCRIPT_EVENT_NAMES_ARRAY[i];
String value = tag.getAttribute(name);
if (value != null) {
- String url =
transformer.getDocument().getUrlBean().getUrlValue();
+ String url =
transformer.getDocument().getUrlBean().getRedirectUrl().toExternalForm();
String newValue =
transformer.getRefactoredJavascript(url, Constants.WEB_BROWSER_SHOW_BROWSE,
value);
tag.setAttribute(name, newValue);
}
@@ -107,6 +107,7 @@
logger.debug("Nb link = " + nbLinks);
}
catch (WebClippingException ex) {
+ ex.printStackTrace();
transformer.addParsingErrors(ex.getMessage());
}
}
@@ -117,6 +118,8 @@
processSrcAttribute(tag);
}
catch (WebClippingException ex) {
+ ex.printStackTrace();
+
transformer.addParsingErrors(ex.getMessage());
}
}
@@ -131,6 +134,8 @@
processMetaTag((MetaTag) tag,
Constants.WEB_BROWSER_SHOW_BROWSE);
}
catch (WebClippingException ex) {
+ ex.printStackTrace();
+
transformer.addParsingErrors(ex.getMessage());
}
}
@@ -164,6 +169,7 @@
}
catch (WebClippingException ex) {
+ ex.printStackTrace();
transformer.addParsingErrors(ex.getMessage());
}
}
@@ -174,6 +180,7 @@
processInputTag((InputTag) tag);
}
catch (WebClippingException ex) {
+ ex.printStackTrace();
transformer.addParsingErrors(ex.getMessage());
}
}
@@ -184,6 +191,7 @@
processStyleTag((StyleTag) tag);
}
catch (WebClippingException ex) {
+ ex.printStackTrace();
transformer.addParsingErrors(ex.getMessage());
}
}
@@ -338,11 +346,11 @@
method = "GET";
}
-
tag.setFormLocation(transformer.getRewritedActionValue(url, method,
formParentName, formParentId, webBrowserAction));
+
tag.setFormLocation(transformer.getRewritedActionValue(url, method,
formParentName, formParentId, "" + formParentPosition, webBrowserAction));
tag.setAttribute("method", "post");
tag.removeAttribute("target");
- //update positon valur
+ //update positon valur
formParentPosition++;
paramPosition = 0;
}
@@ -559,7 +567,7 @@
[EMAIL PROTECTED] WebClippingException Description of Exception
*/
protected void processMetaTag(MetaTag tag, String webBrowserAction)
throws WebClippingException {
-
+ logger.debug("[process meta tag]");
try {
//Get the http-equiv value
String httpEquiv =
tag.getAttribute(HTML.Attribute.HTTPEQUIV.toString());
@@ -590,6 +598,7 @@
}
}
catch (Exception ex) {
+ ex.printStackTrace();
throw new WebClippingException("Meta", ex);
}
finally {
@@ -617,7 +626,6 @@
*/
// tag.removeAttribute("onload");
-
}
catch (Exception ex) {
throw new WebClippingException("Body tag", ex);
@@ -647,7 +655,7 @@
type = transformer.notNullValue(type);
transformer.recordFormParam(type, formParentName,
formParentId, formParentPosition, name, possibleValue, visibility,
paramPosition);
- // update position value
+ // update position value
paramPosition++;
}
catch (Exception ex) {
Index: UserBuilderVisitor.java
===================================================================
RCS file:
/home/cvs/repository/webclip_builder/war/src/java/com/jahia/clipping/web/html/Impl/HTMLParser/UserBuilderVisitor.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- UserBuilderVisitor.java 27 Jun 2005 08:51:02 -0000 1.3
+++ UserBuilderVisitor.java 27 Jun 2005 15:05:12 -0000 1.4
@@ -3,7 +3,6 @@
import com.jahia.clipping.Bean.*;
import javax.swing.text.html.HTML;
import org.htmlparser.tags.*;
-import org.htmlparser.util.*;
import org.htmlparser.Tag;
import com.jahia.clipping.util.*;
import com.jahia.clipping.web.Constant.*;
@@ -209,8 +208,8 @@
logger.debug(" Input tag found");
try {
String name =
tag.getAttribute(HTML.Attribute.NAME.toString());
- FormParamBean fBean =
getTransformer().getFormParamBean(formParentName, formParentId,
name,paramPosition);
- String formHash =
HashUtilities.buildFormHash(formParentName, formParentId);
+ FormParamBean fBean =
getTransformer().getFormParamBean(formParentName,
formParentId,formParentPosition, name,paramPosition);
+ String formHash =
HashUtilities.buildFormHash(formParentName, formParentId,formParentPosition);
if (fBean == null) {
logger.warn("FormParamBean not found for hash "
+ formHash + " and input name " + name + " whith type " +
tag.getAttribute("type"));
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.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- JDomHTMLTransformer.java 27 Jun 2005 08:51:02 -0000 1.10
+++ JDomHTMLTransformer.java 27 Jun 2005 15:05:13 -0000 1.11
@@ -796,7 +796,7 @@
String method = ele.getAttributeValue("method");
String formName = ele.getAttributeValue("name");
String formId = ele.getAttributeValue("id");
- ele.setAttribute("action", getRewritedActionValue(url,
method, formName, formId, Constants.WEB_BROWSER_SHOW_BROWSE));
+ ele.setAttribute("action", getRewritedActionValue(url,
method, formName, formId, ""+formParentPos,Constants.WEB_BROWSER_SHOW_BROWSE));
ele.setAttribute("method", "post");
// add action input elements params
Index: DomHTMLTransformer.java
===================================================================
RCS file:
/home/cvs/repository/webclip_builder/war/src/java/com/jahia/clipping/web/html/Impl/Neko/DomHTMLTransformer.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- DomHTMLTransformer.java 27 Jun 2005 08:51:02 -0000 1.9
+++ DomHTMLTransformer.java 27 Jun 2005 15:05:13 -0000 1.10
@@ -526,7 +526,7 @@
try {
Attr att = (Attr) atts.item(i);
String value = att.getValue();
- String refactoredValue =
getRefactoredJavascript(getUrlBean().getUrlValue(), webBrowseAction, value);
+ String refactoredValue =
getRefactoredJavascript(getUrlBean().getRedirectUrl().toExternalForm(),
webBrowseAction, value);
att.setNodeValue(value);
}
@@ -825,8 +825,8 @@
for (int inputPos = 0; inputPos <
inputList.getLength(); inputPos++) {
Element inputEle = (Element)
inputList.item(inputPos);
String name =
inputEle.getAttribute(HTML.Attribute.NAME.toString());
- FormParamBean fBean =
getFormParamBean(formParentName, formParentId, name,inputPos);
- String formHash =
HashUtilities.buildFormHash(formParentName, formParentId);
+ FormParamBean fBean =
getFormParamBean(formParentName, formParentId,formPos, name,inputPos);
+ String formHash =
HashUtilities.buildFormHash(formParentName, formParentId,formPos);
if (fBean == null) {
logger.warn("FormParamBean not
found for hash " + formHash + " and input name: " + name + " whith type: " +
inputEle.getAttribute("type"));
@@ -891,14 +891,14 @@
// add action input elements params
NodeList formList = DomUtilities.getNodeListByXPath(doc,
FORM_ELE_XPATH);
- for (int i = 0; i < formList.getLength(); i++) {
+ for (int formPos = 0; formPos < formList.getLength();
formPos++) {
try {
- Element formEle = (Element) formList.item(i);
+ Element formEle = (Element)
formList.item(formPos);
String url = formEle.getAttribute("action");
String method = formEle.getAttribute("method");
String formName = formEle.getAttribute("name");
String formId = formEle.getAttribute("id");
- formEle.setAttribute("action",
getRewritedActionValue(url, method, formName, formId, webBrowserAction));
+ formEle.setAttribute("action",
getRewritedActionValue(url, method, formName, formId,""+formPos,
webBrowserAction));
formEle.setAttribute("method", "post");
formEle.removeAttribute("target");
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.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- HTMLUnitProcessor.java 14 Jun 2005 16:04:42 -0000 1.5
+++ HTMLUnitProcessor.java 27 Jun 2005 15:05:13 -0000 1.6
@@ -352,15 +352,18 @@
}
catch (FailingHttpStatusCodeException ex) {
- logger.debug("[ FailingHttpStatusCodeException: " +
ex.getMessage() + " ]");
+ logger.error("[ FailingHttpStatusCodeException: " +
ex.getMessage() + " ]");
+ ex.printStackTrace();
throw new WebClippingException("Failing Http Status
Code", ex);
}
catch (MalformedURLException ex) {
- logger.debug("[ MalformedURLException: " +
ex.getMessage() + " ]");
+ logger.error("[ MalformedURLException: " +
ex.getMessage() + " ]");
+ ex.printStackTrace();
throw new WebClippingException("Malformed URL", ex);
}
catch (IOException ex) {
- logger.debug("[ IOException occured: " +
ex.getMessage() + " ]");
+ logger.error("[ IOException occured: " +
ex.getMessage() + " ]");
+ ex.printStackTrace();
throw new WebClippingException("IOException", ex);
}
catch (Exception ex) {
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.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- HttpProcessor.java 27 Jun 2005 10:20:17 -0000 1.8
+++ HttpProcessor.java 27 Jun 2005 15:05:13 -0000 1.9
@@ -5,7 +5,7 @@
import com.jahia.clipping.Bean.*;
import com.jahia.clipping.util.*;
-import com.jahia.clipping.web.html.*;
+import java.net.URL;
import com.jahia.clipping.web.http.*;
import org.apache.commons.httpclient.*;
import org.apache.commons.httpclient.methods.*;
@@ -99,12 +99,14 @@
logger.debug("[ Method is " + httpMethod + "]");
if (httpMethod.equalsIgnoreCase("GET")) {
GetMethod method = new GetMethod();
+ method.setFollowRedirects(false);
method.addRequestHeader("User-Agent", "Mozilla/5.0
(Macintosh; U; PPC MacOS X; en)");
setObjectMethod(method);
}
else if (httpMethod.equalsIgnoreCase("POST")) {
PostMethod method = new PostMethod();
+ method.setFollowRedirects(false);
method.addRequestHeader("User-Agent", "Mozilla/5.0
(Macintosh; U; PPC MacOS X; en)");
setObjectMethod(method);
((PostMethod)
getObjectMethod()).addParameters(getParamAndValue());
@@ -136,7 +138,6 @@
-
/**
* Sets the UrlBean attribute of the HttpProcessor object
*
@@ -245,7 +246,6 @@
-
/**
* Gets the UrlBean attribute of the HttpProcessor object
*
@@ -432,8 +432,9 @@
*/
private void setRequestedFileFromUrlBean() {
HttpMethod method = getObjectMethod();
- String path = getUrlBean().getUrlValue();
- method.setQueryString(getUrlBean().getURL().getQuery());
+ URL processedUrl = getUrlBean().getRedirectUrl();
+ String path = processedUrl.getPath();
+ method.setQueryString(processedUrl.getQuery());
method.setPath(path);
}
@@ -551,7 +552,6 @@
logger.debug("[ Success whith simple client ]");
// Use caution: ensure correct character encoding and
is not binary data
-
logger.debug("[status code is " + statusCode + " ]");
// Handle redirection by tsting the status code
@@ -561,15 +561,17 @@
(statusCode ==
HttpStatus.SC_TEMPORARY_REDIRECT)) {
//Get the redirection
- Header header =
method.getResponseHeader("location");
- logger.debug("[ Redirection: " + header + " ]");
- if (header != null) {
- String newuri = header.getValue();
+ Header locationHeader =
method.getResponseHeader("location");
+ logger.debug("[ Redirection: " + locationHeader
+ " ]");
+ if (locationHeader != null) {
+ String newuri =
locationHeader.getValue();
if ((newuri == null) ||
(newuri.equals(""))) {
newuri = "/";
}
logger.debug("[ Redirect target: " +
newuri + "");
- redirect = new GetMethod(newuri);
+ String absoluteRedirect =
URLUtilities.getHrefAbsoluteValue(getUrlBean().getUrlValue(),newuri);
+
+ redirect = new
GetMethod(absoluteRedirect);
client.executeMethod(redirect);
// Get the reponse
@@ -577,7 +579,8 @@
logger.debug("[ Redirect: " +
redirect.getStatusLine().toString() + " ]");
// set redirectedUrl
-
getUrlBean().setRedirectUrl(URLUtilities.getURL(newuri));
+
getUrlBean().setRedirectUrl(URLUtilities.getURL(absoluteRedirect));
+ logger.debug("Redirect url is: " +
URLUtilities.getURL(newuri));
}
else {