File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Sockets and Internet Protocols and the fly likes url connection using https? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "url connection using https?" Watch "url connection using https?" New topic

url connection using https?

sujit menon

Joined: Nov 12, 2005
Posts: 7
hi guys,

i have josso integrated web applications running on tomcat/apache web server.
i want to connect from one application java class to another servlet residing in another web application using url connection in https.
but dont know neither does it work nor does it throw any exception?
this is what i gave.

URL servletURL = new URL( connectionURL );
URLConnection servletConnection = servletURL.openConnection( );
servletConnection.setDoOutput( true );
servletConnection.setUseCaches( false );
InputStream in = servletConnection.getInputStream( );
StringBuffer response = new StringBuffer( );
int chr;

while( ( chr = ) ) != -1 ) {
response.append( ( char ) chr );

in.close( );
should i define it explicitely for https?
can someone help me on this?

thanks in advance
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
What does "it does not work" mean? What do you expect to happen, and what is actually happening?
sujit menon

Joined: Nov 12, 2005
Posts: 7
sorry for not stating what should happen.
The problem is its not getting submitted to a servlet. URLConnection is code is there in WAR file. And the servlet resides in another war file.
Its not even going to the servlet. And not no exception ios getting thrown in the URLConnection implemented class
dema rogatkin
Ranch Hand

Joined: Oct 09, 2002
Posts: 294
You should tell more about a servlet you'd like to invoke. Does it require get or post? Does it require any authentication? Did you use https based URLs?

Tough in space?, <a href="" target="_blank" rel="nofollow">Get J2EE servlet container under 150Kbytes here</a><br />Love your iPod and want it anywhere?<a href="" target="_blank" rel="nofollow">Check it here.</a><br /><a href="" target="_blank" rel="nofollow">Curious about generic in Java?</a><br /><a href="" target="_blank" rel="nofollow">Hate ant? Use bee.</a><br /><a href="" target="_blank" rel="nofollow">Need contacts anywhere?</a><br /><a href="" target="_blank" rel="nofollow">How to promote your business with a search engine</a>
sujit menon

Joined: Nov 12, 2005
Posts: 7
the servlet which i need to invoke will get parameter from the request & reply back with a does operation like insertion to all is ok it will return success.

yes our whole application is https.i did specify authentications like truststore and password.
will it block the url connection?
I agree. Here's the link:
subject: url connection using https?
It's not a secret anymore!