diff options
Diffstat (limited to 'plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/internal/http/HTTPConnectorFactory.java')
-rw-r--r-- | plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/internal/http/HTTPConnectorFactory.java | 138 |
1 files changed, 69 insertions, 69 deletions
diff --git a/plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/internal/http/HTTPConnectorFactory.java b/plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/internal/http/HTTPConnectorFactory.java index beb2c4b49d..3e0c5a8b7e 100644 --- a/plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/internal/http/HTTPConnectorFactory.java +++ b/plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/internal/http/HTTPConnectorFactory.java @@ -1,69 +1,69 @@ -/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.net4j.internal.http;
-
-import org.eclipse.net4j.http.internal.common.bundle.OM;
-
-import org.eclipse.spi.net4j.ConnectorFactory;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-
-/**
- * @author Eike Stepper
- */
-public class HTTPConnectorFactory extends ConnectorFactory
-{
- private static final String HTTP_SCHEME_PREFIX = "http://"; //$NON-NLS-1$
-
- public static final String TYPE = "http"; //$NON-NLS-1$
-
- public HTTPConnectorFactory()
- {
- super(TYPE);
- }
-
- public HTTPClientConnector create(String description)
- {
- String userID = null;
- if (!description.startsWith(HTTP_SCHEME_PREFIX))
- {
- description = HTTP_SCHEME_PREFIX + description;
- }
-
- try
- {
- URL url = new URL(description);
- userID = url.getUserInfo();
- }
- catch (MalformedURLException ex)
- {
- OM.LOG.error(ex);
- }
-
- HTTPClientConnector connector = new HTTPClientConnector();
- connector.setURL(description);
- connector.setUserID(userID);
- return connector;
- }
-
- @Override
- public String getDescriptionFor(Object object)
- {
- if (object instanceof HTTPClientConnector)
- {
- HTTPClientConnector connector = (HTTPClientConnector)object;
- return connector.getURL();
- }
-
- return null;
- }
-}
+/* + * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Eike Stepper - initial API and implementation + */ +package org.eclipse.net4j.internal.http; + +import org.eclipse.net4j.http.internal.common.bundle.OM; + +import org.eclipse.spi.net4j.ConnectorFactory; + +import java.net.MalformedURLException; +import java.net.URL; + +/** + * @author Eike Stepper + */ +public class HTTPConnectorFactory extends ConnectorFactory +{ + private static final String HTTP_SCHEME_PREFIX = "http://"; //$NON-NLS-1$ + + public static final String TYPE = "http"; //$NON-NLS-1$ + + public HTTPConnectorFactory() + { + super(TYPE); + } + + public HTTPClientConnector create(String description) + { + String userID = null; + if (!description.startsWith(HTTP_SCHEME_PREFIX)) + { + description = HTTP_SCHEME_PREFIX + description; + } + + try + { + URL url = new URL(description); + userID = url.getUserInfo(); + } + catch (MalformedURLException ex) + { + OM.LOG.error(ex); + } + + HTTPClientConnector connector = new HTTPClientConnector(); + connector.setURL(description); + connector.setUserID(userID); + return connector; + } + + @Override + public String getDescriptionFor(Object object) + { + if (object instanceof HTTPClientConnector) + { + HTTPClientConnector connector = (HTTPClientConnector)object; + return connector.getURL(); + } + + return null; + } +} |