I am developing an application in which i have to read the contents of the url and after giving request parameter to it i have to post that request back to the server. I have used Jsoup library for fetching the response. But the response is not fetched when i give my url (“http://10.100.56.55:8090”) which is for cyberoam. I am developing application for automatically make login into the cyberoam. Now if i give any other url then my code is working just fine. But for this url the exception is thrown which is written here.
Code :
ResourceBundle rb = ResourceBundle.getBundle("bundle.Configuration");
try
{
Document doc=Jsoup.connect(rb.getString("cyberlink_url")).get();
}
catch (Exception e)
{
System.out.println("Error Class is :- " + e.getClass());
e.printStackTrace();
}
Error :
Error Class is :- class java.nio.charset.IllegalCharsetNameException
java.nio.charset.IllegalCharsetNameException: UTF=8
at java.nio.charset.Charset.checkName(Charset.java:320)
at java.nio.charset.Charset.lookup2(Charset.java:496)
at java.nio.charset.Charset.lookup(Charset.java:475)
at java.nio.charset.Charset.forName(Charset.java:540)
at org.jsoup.helper.DataUtil.parseByteData(DataUtil.java:78)
at org.jsoup.helper.HttpConnection$Response.parse(HttpConnection.java:440)
at org.jsoup.helper.HttpConnection.get(HttpConnection.java:133)
at cyberoam.Cyberoam.btnLoginActionPerformed(Cyberoam.java:199)
at cyberoam.Cyberoam.access$000(Cyberoam.java:24)
at cyberoam.Cyberoam$1.actionPerformed(Cyberoam.java:82)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
.......
The problem i am facing here is why only website’s response is not fetched? What is wrong with that? I have tried the above code with other website’s url like google,yahoo and it works perfectly. This url is accessible in url. Please help me if i am missing anything important.
Since you don’t enabled port forwarding, we can’t take a look at the “content of your url”.
However, I guess the there is a line of the response is this:
Or
You have to change it to
Or
By changing, I mean: The webserver who servers the response (you set up by your own, for example XAMPP) is probably uploading an xml (or html) file. That file is the one with the wrong line.
Of course,
UTF=8doesn’t exist.UTF-8does.