Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #14382
| From | Daniel Pitts <newsgroup.nospam@virtualinfinity.net> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Trying to connect to an https://domain.com URL via Java and failing to do so |
| References | <cc72f82a-3e1a-449b-840c-8af89e3de388@v2g2000vbx.googlegroups.com> |
| Message-ID | <iPWpr.2510$MY4.1021@newsfe14.iad> (permalink) |
| Date | 2012-05-07 14:06 -0700 |
On 5/7/12 1:28 PM, Rob wrote:
> Can anyone help me understand why this is not working:
>
> Here is the important part. When compiled and run:
> String Urlx="https://domain.com" // valid URL that comes up fine in a
> web browser
> System.setProperty("java.protocol.handler.pkgs",
> "com.sun.net.ssl.internal.www.protocol");
> Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
> URL url = new URL(Urlx);
> in = url.openStream(); // Currently An IoException is thrown
> :
>
> It appears an IoException is thrown: java.io.IOException: Server
> returned HTTP response code: 403 for URL: https://domain.com
>
> Does anyone know why this might be happening and what if anything is
> missing? e.g missing .jar file? A different way to accomplish this in
> Java JDK?
>
http://lmgtfy.com/?q=http+403
It means the server doesn't like something about your request. Many
websites don't allow Java's default User-Agent, for many reasons.
Likely you are (perhaps unintentionally) violating the ToS of the site
you're attempting to connect to.
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Trying to connect to an https://domain.com URL via Java and failing to do so Rob <rss245@gmail.com> - 2012-05-07 13:28 -0700 Re: Trying to connect to an https://domain.com URL via Java and failing to do so Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-05-07 14:06 -0700 Re: Trying to connect to an https://domain.com URL via Java and failing to do so Arne Vajhøj <arne@vajhoej.dk> - 2012-05-07 18:12 -0400 Re: Trying to connect to an https://domain.com URL via Java and failing to do so Roedy Green <see_website@mindprod.com.invalid> - 2012-05-07 20:09 -0700
csiph-web