Hello All,
I am using the following program to generate HTML from a JSP URL –:
package Common;
import org.htmlparser.Parser;
import org.htmlparser.util.NodeList;
import org.htmlparser.util.ParserException;
public class GetHTML
{
public String JSPToHTML(String url)
{
String html = "";
System.out.println("Generating HTML String from " +
url + "...");
try
{
Parser parser = new Parser (url);
NodeList list = parser.parse (null);
html = list.toHtml ();
System.out.println("HTML successfully
generated!");
}
catch (ParserException pe)
{
pe.printStackTrace ();
}
return html;
}
}
This works fine for every URL I've passed to it save one. Here is a snippet
of my server output-:
org.htmlparser.util.ParserException: Exception getting input stream from
http://ptt0013:8084/ETMApp/Sales/JSVRHTMLContent.jsp?pttjsvrid=62&class=FormTable&pttqrid=9&changestring=updated&oldaddress1=Insert%20Address%201%20Here&oldaddress2=&oldcity=Insert%20City%20Here&oldcountry=Insert%20Country%20Here&olddate=2008-07-25&oldtime=&olddetails=&oldvpttemployeeid=2&email=email(Server
redirected too many times (20)).;
java.net.ProtocolException: Server redirected too many times (20)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at
sun.net.www.protocol.http.HttpURLConnection$6.run(HttpURLConnection.java:1298)
at java.security.AccessController.doPrivileged(Native Method)
at
sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1292)
at
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:948)
at org.htmlparser.lexer.Page.setConnection(Page.java:571)
at org.htmlparser.lexer.Page.<init>(Page.java:134)
at org.htmlparser.lexer.Lexer.<init>(Lexer.java:186)
at org.htmlparser.Parser.setResource(Parser.java:398)
at org.htmlparser.Parser.<init>(Parser.java:317)
at org.htmlparser.Parser.<init>(Parser.java:331)
at Common.GetHTML.JSPToHTML(GetHTML.java:15)
Everything works fine if I copy and paste the URL into my browser. What
might I be missing here? I appreciate any effort to help me. Thank you for
your time and consideration.
Sincerely,
Sisilla Sookdeo
|