java - 403 error while fetching content from URL -


I am attempting to automate a process, for that I have to kill a URL and bring XML multiple times in 1 time. Need, and then parse it for 1 run of the program, the URL can hit anywhere from 4 to 25 times. <40 p>

Interestingly, 403 always comes for every 5th or 6th time when the URL gets hit.

I am using JDOM to parse XML response

I tried the code:

  document doc = builder.bild (new input source (url.openstream ());  

and

  HttpURL Connection Kanan = (HttpURLConnection) url.openConnection (); Conn.setRequestProperty ("User-agent", "Mozilla / 5.0 (Windows; U; Windows NT 6.1; N-GB; RV: 1.9.2.13) Geico / 20101203 Firefox / 3.6.13 (Net CLR 3.5.30729)") ; Document Doc = Builder. Build (conn.getInputStream ());  

I get an exception with the other:

  org.jdom.input.JDOMParseException: Error on line 1: white spaces between public spaces Requires systemid. Can anybody please help me get rid of 403? Please note that there is no control over the source if it is necessary to make a change to talk about the source.  

Besides, I'm not sure what is helpful.

Thank you.


[UPDATE 1]: This is sleep :

  try {doc = builder.build (conn.getInputStream) ()); } Hold (IOException ioEx) {doc = builder.build (new input source (url.openstream ())); }   

means that the request is understood but the server refuses to process it gives. Send the header that you send

When you send a http connection with the request that you want to do.

One of the methods is TRACE .

By demonstrating a method, you can see that petition in response to the body. So you can see that it is still valid.

Perhaps more than his maximum number of petitions were if he had any mechanism.


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -