KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jahia > clipbuilder > html > web > WebBrowserSimulator


1 package org.jahia.clipbuilder.html.web;
2 import java.util.*;
3
4 import javax.servlet.http.*;
5
6 import org.htmlparser.*;
7 import org.htmlparser.tags.*;
8 import org.htmlparser.util.*;
9 import org.jahia.clipbuilder.html.*;
10 import org.jahia.clipbuilder.html.bean.*;
11 import org.jahia.clipbuilder.html.util.*;
12 import org.jahia.clipbuilder.html.web.Constant.*;
13 import org.jahia.clipbuilder.html.web.Url.*;
14 import org.jahia.clipbuilder.html.web.html.*;
15
16 /**
17  * Description of the Class
18  *
19  *@author Tlili Khaled
20  */

21 public class WebBrowserSimulator {
22     private int urlPosition = 0;
23     private HttpServletRequest request;
24     private HttpServletResponse response;
25     private ClipperBean clipperBean;
26     private HTMLDocument finalDocument;
27     private boolean finished;
28     /**
29      * Description of the Field
30      */

31     public static final int MODE_LOOP = 0;
32     /**
33      * Description of the Field
34      */

35     public static final int MODE_REFRESH_ONLOAD = 1;
36     private static org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(WebBrowserSimulator.class);
37
38
39     /**
40      * Constructor for the WebBrowserSimulator object
41      *
42      *@param request Description of Parameter
43      *@param response Description of Parameter
44      *@param cBean Description of Parameter
45      */

46     public WebBrowserSimulator(HttpServletRequest request, HttpServletResponse response, ClipperBean cBean) {
47         setRequest(request);
48         setResponse(response);
49         setClipperBean(cBean);
50
51     }
52
53
54     /**
55      * Sets the UserPreferences attribute of the WebBrowserSimulator object
56      */

57
58     /**
59      * Sets the Request attribute of the WebBrowserSimulator object
60      *
61      *@param request The new Request value
62      */

63     public void setRequest(HttpServletRequest request) {
64         this.request = request;
65     }
66
67
68     /**
69      * Sets the Response attribute of the WebBrowserSimulator object
70      *
71      *@param response The new Response value
72      */

73     public void setResponse(HttpServletResponse response) {
74         this.response = response;
75     }
76
77
78     /**
79      * Sets the ClipperBean attribute of the WebBrowserSimulator object
80      *
81      *@param clipperBean The new ClipperBean value
82      */

83     public void setClipperBean(ClipperBean clipperBean) {
84         if (clipperBean != null) {
85             this.clipperBean = clipperBean;
86         }
87         else {
88             logger.error("[ ClipperBean is null]");
89         }
90     }
91
92
93     /**
94      * Sets the FinalDocument attribute of the WebBrowserSimulator object
95      *
96      *@param finalDocument The new FinalDocument value
97      */

98     public void setFinalDocument(HTMLDocument finalDocument) {
99         this.finalDocument = finalDocument;
100     }
101
102
103     /**
104      * Sets the UrlPosition attribute of the WebBrowserSimulator object
105      *
106      *@param urlPosition The new UrlPosition value
107      */

108     public void setUrlPosition(int urlPosition) {
109         this.urlPosition = urlPosition;
110     }
111
112
113     /**
114      * Sets the Finished attribute of the WebBrowserSimulator object
115      *
116      *@param finished The new Finished value
117      */

118     public void setFinished(boolean finished) {
119         this.finished = finished;
120     }
121
122
123
124
125     /**
126      * Gets the HTMLPart attribute of the WebBrowserSimulator object
127      *
128      *@return The HTMLPart value
129      */

130     public String JavaDoc getHTMLPart() {
131         logger.debug(" Extract html part");
132         //Get Filter
133
String JavaDoc selectedPart = null;
134
135         ClipperBean bean = getClipperBean();
136         if (bean == null) {
137             logger.error("[ClipperBean not found]");
138         }
139         FilterBean filterBean = bean.getFilterBean();
140         logger.debug("[Filter class: " + filterBean.getClass().toString() + " ]");
141
142         //Get the selected part
143
ExtractorFilter filter = ExtractorFilterFactory.getInstance().getFilterImplementation(filterBean.getName());
144         Map keyMap = filterBean.getKeyMap();
145         filter.setKeyMap(keyMap);
146         int mode = filterBean.getMode();
147         filter.setMode(mode);
148         try {
149             selectedPart = filter.getSelectedPart(getFinalDocument(), ExtractorFilter.ACTION_RETRIEVE_SELECTED_PART);
150
151         }
152         catch (Exception JavaDoc ex) {
153             ex.printStackTrace();
154             selectedPart = " Error has occured";
155         }
156         finally {
157
158             //logger.debug("[Selected part is] --> " + selectedPart);
159
return embedHtml(selectedPart);
160             //return selectedPart;
161
}
162
163     }
164
165
166     /**
167      * Gets the Request attribute of the WebBrowserSimulator object
168      *
169      *@return The Request value
170      */

171     public HttpServletRequest getRequest() {
172         return request;
173     }
174
175
176     /**
177      * Gets the Response attribute of the WebBrowserSimulator object
178      *
179      *@return The Response value
180      */

181     public HttpServletResponse getResponse() {
182         return response;
183     }
184
185
186     /**
187      * Gets the ClipperBean attribute of the WebBrowserSimulator object
188      *
189      *@return The ClipperBean value
190      */

191     public ClipperBean getClipperBean() {
192         return clipperBean;
193     }
194
195
196     /**
197      * Gets the FinalDocument attribute of the WebBrowserSimulator object
198      *
199      *@return The FinalDocument value
200      */

201     public HTMLDocument getFinalDocument() {
202         return finalDocument;
203     }
204
205
206     /**
207      * Gets the UrlPosition attribute of the WebBrowserSimulator object
208      *
209      *@return The UrlPosition value
210      */

211     public int getUrlPosition() {
212         return urlPosition;
213     }
214
215
216     /**
217      * Gets the Finished attribute of the WebBrowserSimulator object
218      *
219      *@return The Finished value
220      */

221     public boolean isFinished() {
222         return finished;
223     }
224
225
226     /**
227      * Gets the NameSpace attribute of the WebBrowserSimulator object
228      *
229      *@return The NameSpace value
230      */

231     public String JavaDoc getNameSpace() {
232         return RequestParameterManager.getNameSpace(getRequest());
233     }
234
235
236     /**
237      * Gets the HtmlResponse attribute of the WebBrowserSimulator object
238      *
239      *@return The HtmlResponse value
240      */

241     public String JavaDoc getFinalHtmlResponse() {
242         String JavaDoc html = "not Found";
243         try {
244             logger.debug("[ Get HTML Reponse ]");
245             if (false) {
246                 html = getFinalDocument().getUserDocumentAsString();
247
248                 // the simulation is on the client side
249
html = simulateUserInteraction(html, getFinalDocument().getUrlBean());
250             }
251             else {
252                 html = getFinalDocument().getUserDocumentAsString();
253             }
254         }
255         catch (NumberFormatException JavaDoc ex) {
256             ex.printStackTrace();
257         }
258         catch (Exception JavaDoc ex) {
259             ex.printStackTrace();
260         }
261         return html;
262     }
263
264
265     /**
266      * Gets the HeaderParams attribute of the WebBrowserSimulator object
267      *
268      *@return The HeaderParams value
269      */

270     public Hashtable getHeaderParams() {
271         Hashtable headerParamHash = new Hashtable();
272         /*
273          * Enumeration headerParamName = httpServletRequest.getHeaderNames();
274          * while (headerParamName.hasMoreElements()) {
275          * String name = (String) headerParamName.nextElement();
276          * String value = httpServletRequest.getHeader(name);
277          * // headerParamHash.put(name, value);
278          * //logger.debug(name + "=" + value);
279          * }
280          * headerParamHash.put("User-Agent", httpServletRequest.getHeader("User-Agent"));
281          * logger.debug("User-Agent=" + headerParamHash.get("User-Agent"));
282          */

283         return headerParamHash;
284     }
285
286
287     /**
288      * Gets the URLMap attribute of the WebBrowserSimulator object
289      *
290      *@param request Description of Parameter
291      *@return The URLMap value
292      */

293     public URLMap getURLMap(HttpServletRequest request) {
294         return SessionManager.getHTMLDocumentBuilder(request).getUrlMap();
295     }
296
297
298     /**
299      * Gets the Param attribute of the WebBrowserSimulator object
300      *
301      *@param request Description of Parameter
302      *@return The Param value
303      */

304     public Map getParam(HttpServletRequest request) {
305         return org.jahia.clipbuilder.html.struts.webBrowser.WebBrowserAction.getParam(request);
306     }
307
308
309     /**
310      * Description of the Method
311      *
312      *@param mode Description of Parameter
313      */

314     public void execute(int mode) {
315         switch (mode) {
316
317             // execute loop mode
318
case MODE_LOOP:
319             {
320                 try {
321                     executeLoop();
322                 }
323                 catch (Exception JavaDoc ex) {
324                     System.err.println("coucou erro");
325                     ex.printStackTrace();
326                 }
327                 break;
328             }
329             // execute refresh mode
330
case MODE_REFRESH_ONLOAD:
331             {
332                 try {
333                     executeWhithJavascript();
334
335                 }
336                 catch (Exception JavaDoc ex) {
337                     ex.printStackTrace();
338                 }
339                 break;
340             }
341             // loop mode for default
342
default:
343             {
344                 try {
345                     executeLoop();
346                 }
347                 catch (Exception JavaDoc ex) {
348                     ex.printStackTrace();
349                 }
350                 break;
351             }
352
353         }
354     }
355
356
357     /**
358      * Description of the Method
359      *
360      *@param request Description of Parameter
361      *@param response Description of Parameter
362      *@param mode Description of Parameter
363      */

364     public void executeForLoad(HttpServletRequest request, HttpServletResponse response, int mode) {
365         // init html document builder
366
initHTMLDocumentBuilder(request, response);
367
368         //execute
369
execute(mode);
370     }
371
372
373     /**
374      * Description of the Method
375      *
376      *@param htmlPart Description of Parameter
377      *@return Description of the Returned Value
378      */

379     private String JavaDoc embedHtml(String JavaDoc htmlPart) {
380         // init parameter
381
String JavaDoc id = getNameSpace();
382         String JavaDoc iframeJavascriptPath = getRequest().getContextPath() + "/js/iframeJavascript.js";
383         String JavaDoc waitImgPath = getRequest().getContextPath() + "/resources/work_in_progress.gif";
384
385         String JavaDoc embedHtml = " <html>";
386         embedHtml = embedHtml + "\n" + "<head>";
387         embedHtml = embedHtml + "\n" + "<script type=\"text/javascript\" SRC=\"" + iframeJavascriptPath + "\"></script>";
388         embedHtml = embedHtml + "\n" + "</head>";
389         embedHtml = embedHtml + "\n" + "<body onload=\"javascript:resizeIframe('" + id + "');\">";
390         //embedHtml = embedHtml + "\n" + " <img align=\"middle\" id=\"wait\" style=\"visibility:visible;\" SRC=\""+waitImgPath+"\"/>";
391
embedHtml = embedHtml + "\n" + "<div id=\"content\">";
392         embedHtml = embedHtml + "\n" + htmlPart;
393         embedHtml = embedHtml + "\n" + "</div>";
394         embedHtml = embedHtml + "\n" + "</body>";
395         embedHtml = embedHtml + "\n" + "</html>";
396
397         return embedHtml;
398     }
399
400
401     /**
402      * Description of the Method
403      *
404      *@exception Exception Description of Exception
405      */

406     private void executeLoop() throws Exception JavaDoc {
407         //Get all the url
408
ClipperBean cBean = getClipperBean();
409         List urlListBean = cBean.getUrlListBean();
410         HTMLDocument doc = null;
411
412         // for each url, rebuild the document whithe the new value of the parameter
413
for (int i = 0; i < urlListBean.size(); i++) {
414             UrlBean uBean = (UrlBean) urlListBean.get(i);
415             // get the url bean
416
logger.debug("[WebBrowserSimulator] Current url: " + uBean.getAbsoluteUrlValue());
417
418             //update the url bean
419
doc = updateUrlBeanAndGetDocument(getRequest(), getResponse(), uBean);
420
421             //build the user document
422
String JavaDoc html = doc.getUserDocumentAsString();
423             //String html = doc.getTransformedDocumentAsString();
424
// logger.debug(html);
425

426             uBean.setDocument(doc);
427             //SessionManager.setLastBuildedUrlBean(request, uBean);
428
urlPosition = i;
429         }
430
431         setFinished(true);
432
433         //set the document
434
setFinalDocument(doc);
435
436     }
437
438
439     /**
440      * Description of the Method
441      *
442      *@param request Description of Parameter
443      *@param response Description of Parameter
444      */

445     private void initHTMLDocumentBuilder(HttpServletRequest request, HttpServletResponse response) {
446         ClipperBean cBean = SessionManager.getClipperBean(request);
447         URLWrapper uw = new URLWrapper();
448         uw.setSourceUrl(cBean.getTargetUrl());
449         uw.setMethod("GET");
450         uw.setFrom(Constants.FIRST_URL_HASH);
451         URLMap map = new URLMap();
452         map.addSourceUrl(uw, Constants.FIRST_URL_HASH);
453         HTMLDocumentBuilder builder = new HTMLDocumentBuilder(map, UrlEncoderFactory.getServletUrlEncoder(request, response));
454
455         //Configure builder
456
ConfigureBean configBean = cBean.getConfigurationBean();
457
458         //configure ssl
459
String JavaDoc ssl = configBean.getEnableSSL();
460         if (ssl == null) {
461             org.jahia.clipbuilder.html.web.RegisterSSLProctocol.unregisterSSLProtocol();
462         }
463         else {
464             org.jahia.clipbuilder.html.web.RegisterSSLProctocol.registerSSLProtocol();
465         }
466
467         //get browser javascript configuration
468
int browserJavascriptEvent = Integer.parseInt(configBean.getBrowserJavascriptEvent());
469         int browserJavascriptCode = Integer.parseInt(configBean.getBrowserJavascriptCode());
470
471         // get the type of the client and the parser
472
int clientType = Integer.parseInt(configBean.getClient());
473         int parserType = Integer.parseInt(configBean.getHtmlDocument());
474
475         // set the javascript
476
String JavaDoc javascript = configBean.getEnableJavascript();
477         boolean javascriptBool = true;
478         if (javascript == null) {
479             javascriptBool = false;
480         }
481
482         //set Css
483
String JavaDoc css = configBean.getEnableCSS();
484         boolean cssBool = true;
485         if (css == null) {
486             cssBool = false;
487         }
488
489         //set headers
490
org.org.apache.commons.httpclient.Header[] headers = new org.org.apache.commons.httpclient.Header[1];
491         headers = null;
492         String JavaDoc encodingValue = response.getCharacterEncoding();
493
494         logger.debug("[ Encoding is " + encodingValue + " ]");
495         //headers[0] = new org.org.apache.commons.httpclient.Header("Content-Type", "text/html; charset="+encodingValue);
496

497         //configure the builder
498
builder.configure(clientType, parserType, browserJavascriptEvent, browserJavascriptCode, javascriptBool, cssBool, headers);
499
500         SessionManager.setHTMLDocumentBuilder(request, builder);
501     }
502
503
504
505     /**
506      * Description of the Method
507      *
508      *@exception Exception Description of Exception
509      */

510     private void executeWhithJavascript() throws Exception JavaDoc {
511         //Get all the url
512
ClipperBean cBean = getClipperBean();
513         List urlListBean = cBean.getUrlListBean();
514         HTMLDocument doc = null;
515         UrlBean uBean = (UrlBean) urlListBean.get(urlPosition);
516         // for each url, rebuild the document whithe the new value of the parameter
517
// get the url bean
518
logger.debug("[WebBrowserSimulator] Current url: " + uBean.getAbsoluteUrlValue());
519
520         //update the url bean
521
doc = updateUrlBeanAndGetDocument(getRequest(), getResponse(), uBean);
522         uBean.setDocument(doc);
523
524         if (urlPosition == urlListBean.size()) {
525             setFinished(true);
526         }
527         else {
528             urlPosition++;
529         }
530         //set the document
531
setFinalDocument(doc);
532
533     }
534
535
536     /**
537      * Description of the Method
538      *
539      *@param html Description of Parameter
540      *@param uBean Description of Parameter
541      *@return Description of the Returned Value
542      */

543     private String JavaDoc simulateUserInteraction(String JavaDoc html, UrlBean uBean) {
544         logger.debug(" body tag found");
545         ClipperBean cBean = uBean.getClipperBean();
546         UrlBean nextBean = cBean.getNextRecordedUrlBean(uBean);
547         String JavaDoc clickOnload = "";
548
549         // process only if its not the last url
550
if (nextBean != null) {
551             String JavaDoc from = nextBean.getFrom();
552             String JavaDoc fromHash = nextBean.getHash();
553             // case of link
554
if (from.equalsIgnoreCase(WebConstants.FROM_LINK)) {
555                 // id of link = builded hash
556
clickOnload = "document.getElementById('" + fromHash + "').click();";
557             }
558             else {
559                 //case of form
560
FormParamBean fBean = uBean.getSubmittedParamBean(fromHash);
561                 if (fBean != null) {
562                     String JavaDoc name = fBean.getName();
563                     String JavaDoc formParentName = fBean.getFormParentName();
564                     String JavaDoc formParentId = fBean.getFormParentId();
565                     if (formParentName == null || formParentName.equalsIgnoreCase("")) {
566                         clickOnload = "document.getElementById('" + formParentId + "')" + "." + name + ".click();";
567                     }
568                     else {
569                         clickOnload = "document." + formParentName + "." + name + ".click();";
570                     }
571                 }
572                 else {
573                     logger.warn("submit button not found");
574                     //getFormNameFormHash(fromHash);
575
String JavaDoc submittedFormName = HashUtilities.getFormNameFromHash(fromHash);
576                     if (submittedFormName != null) {
577                         clickOnload = "document." + submittedFormName + ".submit();";
578                     }
579                     else {
580                         String JavaDoc submittedFormId = HashUtilities.getFormIdFromHash(fromHash);
581                         clickOnload = "document.getElementById('" + submittedFormId + "')" + ".submit();";
582                     }
583
584                 }
585             }
586
587             // set the onload attribute
588
try {
589                 String JavaDoc charSet = WebConstants.ENCODING_ISO;
590                 Parser parser = Parser.createParser(html, charSet);
591                 NodeIterator it = parser.elements();
592                 Html htmlTag = null;
593                 while (it.hasMoreNodes()) {
594                     Node n = it.nextNode();
595                     if (n instanceof Html) {
596                         htmlTag = (Html) n;
597                         NodeIterator itt = parser.elements();
598                         while (itt.hasMoreNodes()) {
599                             Node nn = it.nextNode();
600                             if (nn instanceof BodyTag) {
601                                 Tag tag = (BodyTag) nn;
602                                 String JavaDoc onload = tag.getAttribute("onload");
603                                 if (onload == null) {
604                                     onload = clickOnload;
605                                 }
606                                 else {
607                                     onload = onload + ";" + clickOnload;
608                                 }
609                                 tag.setAttribute("onload", onload);
610                                 //+"alert('coucou c'est nous!!');");
611
logger.debug("[New Onload: " + onload + " ]");
612
613                             }
614
615                         }
616                     }
617
618                 }
619                 return htmlTag.toHtml();
620             }
621             catch (Exception JavaDoc ex) {
622                 ex.printStackTrace();
623                 return "Excepton has occured when setting on load!!";
624             }
625
626         }
627
628         return "No document";
629     }
630
631
632     /**
633      * Description of the Method
634      *
635      *@param httpServletRequest Description of Parameter
636      *@param httpServletResponse Description of Parameter
637      *@param uBean Description of Parameter
638      *@return Description of the Returned Value
639      *@exception Exception Description of Exception
640      */

641     private HTMLDocument updateUrlBeanAndGetDocument(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, UrlBean uBean) throws Exception JavaDoc {
642         //uBean.setQueryParamListFromMap(getParam(httpServletRequest));
643

644         // get the URLWrapper object
645
String JavaDoc hash = uBean.getHash();
646         logger.debug("looking for urlwrapper whit hash: " + hash);
647
648         //URLMap = map hash <-> url
649
URLMap map = getURLMap(httpServletRequest);
650         URLWrapper uw = map.getSourceUrl(uBean.getHash());
651
652         // get from and http method
653
String JavaDoc from = uBean.getFrom();
654         String JavaDoc httpMethod = "";
655         //String baseUrl = "";
656
String JavaDoc relativeUrl = "";
657
658         if (uw == null) {
659             logger.debug("URLWrapper not found: it must be the first step");
660             map.debug_EnumerateKey();
661
662             //set value from the url bena
663
httpMethod = "GET";
664             //baseUrl = uBean.getBaseUrlValue();
665
relativeUrl = uBean.getRelativeUrlValue();
666         }
667         else {
668             // update value from the URLWrapper
669
httpMethod = uw.getMethod();
670             relativeUrl = uw.getSourceUrl();
671
672             //set the base url
673
// get the base of the url
674
/*
675              * if (!URLUtilities.isRelatif(relativeUrl)) {
676              * baseUrl = relativeUrl;
677              * }
678              * else {
679              * // base url = base url of the previous url
680              * ClipperBean cBean = getClipperBean();
681              * if(uBean.getPosition() > 0){
682              * UrlBean lastUrlBean = cBean.getUrlBean(uBean.getPosition() - 1);
683              * baseUrl = lastUrlBean.getBaseUrlValue();
684              * }else{
685              * uBean.getBaseURL();
686              * }
687              * }
688              */

689         }
690
691         //update the url
692
//uBean.setBaseUrl(baseUrl);
693
//uBean.setRelativeUrl(relativeUrl);
694
//uBean.setRedirectUrl(uBean.getAbsoluteURL());
695

696         logger.debug("[ URL is: " + relativeUrl + " ]");
697         logger.debug("WebBrowser: from: " + from);
698         logger.debug("WebBrowse: hash: " + hash);
699         logger.debug("WebBrowser: method: " + httpMethod);
700
701         //Get the HTMLDocument
702
Hashtable headerParamHash = getHeaderParams();
703         HTMLDocument htmlDocument = buildHTMLDocument(httpServletRequest, httpServletResponse, uBean, httpMethod);
704
705         uBean.setDocument(htmlDocument);
706
707         //Reset the map
708
map.reset();
709         return htmlDocument;
710     }
711
712
713     /**
714      * Description of the Method
715      *
716      *@param request Description of Parameter
717      *@param response Description of Parameter
718      *@param uBean Description of Parameter
719      *@param httpMethod Description of Parameter
720      *@return Description of the Returned Value
721      *@exception Exception Description of Exception
722      */

723     private HTMLDocument buildHTMLDocument(HttpServletRequest request, HttpServletResponse response, UrlBean uBean, String JavaDoc httpMethod) throws Exception JavaDoc {
724
725         // Get a HMTLDocument builder
726
HTMLDocumentBuilder builder = SessionManager.getHTMLDocumentBuilder(request);
727         if (builder == null) {
728             builder = new HTMLDocumentBuilder(uBean, httpMethod, UrlEncoderFactory.getServletUrlEncoder(request, response));
729
730             //Get the configuration object
731
ConfigureBean configBean = SessionManager.getClipperBean(request).getConfigurationBean();
732
733             //configure ssl
734
String JavaDoc ssl = configBean.getEnableSSL();
735             if (ssl == null) {
736                 org.jahia.clipbuilder.html.web.RegisterSSLProctocol.unregisterSSLProtocol();
737             }
738             else {
739                 org.jahia.clipbuilder.html.web.RegisterSSLProctocol.registerSSLProtocol();
740             }
741
742             //get browser javascript configuration
743
int browserJavascriptEvent = Integer.parseInt(configBean.getBrowserJavascriptEvent());
744             int browserJavascriptCode = Integer.parseInt(configBean.getBrowserJavascriptCode());
745
746             // get the type of the client and the parser
747
int clientType = Integer.parseInt(configBean.getClient());
748             int parserType = Integer.parseInt(configBean.getHtmlDocument());
749
750             // set the javascript
751
String JavaDoc javascript = configBean.getEnableJavascript();
752             boolean javascriptBool = true;
753             if (javascript == null) {
754                 javascriptBool = false;
755             }
756
757             //set Css
758
String JavaDoc css = configBean.getEnableCSS();
759             boolean cssBool = true;
760             if (css == null) {
761                 cssBool = false;
762             }
763
764             //set headers
765
org.org.apache.commons.httpclient.Header[] headers = new org.org.apache.commons.httpclient.Header[1];
766             headers = null;
767             String JavaDoc encodingValue = response.getCharacterEncoding();
768
769             logger.debug("[ Encoding is " + encodingValue + " ]");
770             //headers[0] = new org.org.apache.commons.httpclient.Header("Content-Type", "text/html; charset="+encodingValue);
771

772             //configure the builder
773
builder.configure(clientType, parserType, browserJavascriptEvent, browserJavascriptCode, javascriptBool, cssBool, headers);
774         }
775         else {
776             builder.setHttpMethod(httpMethod);
777             builder.setUBean(uBean);
778         }
779         // execute
780
HTMLDocument doc = builder.execute(request, response);
781
782         //set in the session
783
SessionManager.setHTMLDocumentBuilder(request, builder);
784         return doc;
785     }
786
787 }
788
Popular Tags