KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > update > internal > core > connection > ConnectionFactory


1 /*******************************************************************************
2  * Copyright (c) 2000, 2005 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11
12 package org.eclipse.update.internal.core.connection;
13
14 import java.io.IOException JavaDoc;
15 import java.net.URL JavaDoc;
16
17 public class ConnectionFactory {
18
19     
20     public static IResponse get(URL JavaDoc url) throws IOException JavaDoc {
21         //Request request = null;
22
IResponse response = null;
23         
24         if ("file".equals(url.getProtocol())) { //$NON-NLS-1$
25
response = new FileResponse(url);
26         } else if (url != null && url.getProtocol().startsWith("http")) { //$NON-NLS-1$
27
response = new HttpResponse(url);
28         } else {
29             response = new OtherResponse(url);
30         }
31
32         return response;
33     }
34 }
35
Popular Tags