From: Ronald B. <rb...@rb...> - 2016-06-22 09:04:32
|
Hi Jack, can ou please at least provide the original content/response you got for url "goalBf3.xml". The usual case is to have some bom header we have to take care of. RBRi On Wed, 22 Jun 2016 00:47:13 -0700 (MST) jack wrote: > >Hi asashour > >This is not a cross domain problem,the warning: Content is not allowed in >prolog is the key > >I solved the problem by the following code > > >new WebConnectionWrapper(wc) { > public WebResponse getResponse(WebRequest request) >throws IOException { > WebResponse response = >super.getResponse(request); > > >if(request.getUrl().toExternalForm().contains("goalBf3.xml")){ > >System.out.println(response.getContentAsString("UTF-8")); > String content = >response.getContentAsString("UTF-8"); > if(null != content && >!"".equals(content)){ > if(content.indexOf("<") != -1 && >content.lastIndexOf(">") != -1 && content.lastIndexOf(">") > >content.indexOf("<")) > content = >content.substring(content.indexOf("<"), content.lastIndexOf(">") + 1); > } > > WebResponseData data = new >WebResponseData(content.getBytes("UTF-8"), > response.getStatusCode(), >response.getStatusMessage(), response.getResponseHeaders()); > response = new WebResponse(data, >request, response.getLoadTime()); > } > return response; > } > } > > > > >-- >View this message in context: http://htmlunit.10904.n7.nabble.com/How-to-solve-the-cross-domain-problem-caused-by-the-error-tp39637p39641.html >Sent from the HtmlUnit - General mailing list archive at Nabble.com. > >------------------------------------------------------------------------------ >Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San >Francisco, CA to explore cutting-edge tech and listen to tech luminaries >present their vision of the future. This family event has something for >everyone, including kids. Get more information and register today. >http://sdm.link/attshape >_______________________________________________ >Htmlunit-user mailing list >Htm...@li... >https://lists.sourceforge.net/lists/listinfo/htmlunit-user > |