developerinlondon
Programmer
I need to find a way to create an object based on the type of URL we get at runtime.
eg:
the above code obviously doesnt work, but hopefully this will explain what I want to achieve. Any easy way of doing this?
eg:
Code:
URL url = new URL ("[URL unfurl="true"]http://gizmo.com");[/URL]
URLConnection conn = (URLConnection) url.openConnection();
if (url.contains("https")) {
conn = (HTTPSConnection) url.openConnection();
}