Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.net4j.http')
-rw-r--r--plugins/org.eclipse.net4j.http/.settings/org.eclipse.core.resources.prefs6
-rw-r--r--plugins/org.eclipse.net4j.http/.settings/org.eclipse.jdt.launching.prefs6
-rw-r--r--plugins/org.eclipse.net4j.http/copyright.txt14
-rw-r--r--plugins/org.eclipse.net4j.http/plugin.properties22
-rw-r--r--plugins/org.eclipse.net4j.http/plugin.xml48
-rw-r--r--plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/http/HTTPUtil.java82
-rw-r--r--plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/http/package-info.java30
-rw-r--r--plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/internal/http/HTTPClientConnector.java518
-rw-r--r--plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/internal/http/HTTPConnectorFactory.java138
-rw-r--r--plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/internal/http/bundle/OM.java88
10 files changed, 476 insertions, 476 deletions
diff --git a/plugins/org.eclipse.net4j.http/.settings/org.eclipse.core.resources.prefs b/plugins/org.eclipse.net4j.http/.settings/org.eclipse.core.resources.prefs
index 75d4137cbe..75b47055af 100644
--- a/plugins/org.eclipse.net4j.http/.settings/org.eclipse.core.resources.prefs
+++ b/plugins/org.eclipse.net4j.http/.settings/org.eclipse.core.resources.prefs
@@ -1,3 +1,3 @@
-#Mon Jul 04 12:55:11 CEST 2011
-eclipse.preferences.version=1
-encoding//model/org.eclipse.emf.cdo.defs.ecorediag=UTF-8
+#Mon Jul 04 12:55:11 CEST 2011
+eclipse.preferences.version=1
+encoding//model/org.eclipse.emf.cdo.defs.ecorediag=UTF-8
diff --git a/plugins/org.eclipse.net4j.http/.settings/org.eclipse.jdt.launching.prefs b/plugins/org.eclipse.net4j.http/.settings/org.eclipse.jdt.launching.prefs
index 4658ec1435..556ed07a3c 100644
--- a/plugins/org.eclipse.net4j.http/.settings/org.eclipse.jdt.launching.prefs
+++ b/plugins/org.eclipse.net4j.http/.settings/org.eclipse.jdt.launching.prefs
@@ -1,3 +1,3 @@
-#Fri Sep 02 05:38:34 CEST 2011
-eclipse.preferences.version=1
-org.eclipse.jdt.launching.PREF_STRICTLY_COMPATIBLE_JRE_NOT_AVAILABLE=ignore
+#Fri Sep 02 05:38:34 CEST 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.launching.PREF_STRICTLY_COMPATIBLE_JRE_NOT_AVAILABLE=ignore
diff --git a/plugins/org.eclipse.net4j.http/copyright.txt b/plugins/org.eclipse.net4j.http/copyright.txt
index 8f6328980e..0a0f67e6d7 100644
--- a/plugins/org.eclipse.net4j.http/copyright.txt
+++ b/plugins/org.eclipse.net4j.http/copyright.txt
@@ -1,8 +1,8 @@
-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:
+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 \ No newline at end of file
diff --git a/plugins/org.eclipse.net4j.http/plugin.properties b/plugins/org.eclipse.net4j.http/plugin.properties
index bef686fb8a..509d08bdc1 100644
--- a/plugins/org.eclipse.net4j.http/plugin.properties
+++ b/plugins/org.eclipse.net4j.http/plugin.properties
@@ -1,11 +1,11 @@
-# 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
-
-pluginName = Net4j Signalling Platform Transport HTTP
-providerName = Eclipse Modeling Project
+# 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
+
+pluginName = Net4j Signalling Platform Transport HTTP
+providerName = Eclipse Modeling Project
diff --git a/plugins/org.eclipse.net4j.http/plugin.xml b/plugins/org.eclipse.net4j.http/plugin.xml
index 404e05d55f..c93735ce46 100644
--- a/plugins/org.eclipse.net4j.http/plugin.xml
+++ b/plugins/org.eclipse.net4j.http/plugin.xml
@@ -1,24 +1,24 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.4"?>
-<!--
- 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
--->
-
-<plugin>
-
- <extension
- point="org.eclipse.net4j.util.factories">
- <factory
- class="org.eclipse.net4j.internal.http.HTTPConnectorFactory"
- productGroup="org.eclipse.net4j.connectors"
- type="http"/>
- </extension>
-
-</plugin>
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<!--
+ 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
+-->
+
+<plugin>
+
+ <extension
+ point="org.eclipse.net4j.util.factories">
+ <factory
+ class="org.eclipse.net4j.internal.http.HTTPConnectorFactory"
+ productGroup="org.eclipse.net4j.connectors"
+ type="http"/>
+ </extension>
+
+</plugin>
diff --git a/plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/http/HTTPUtil.java b/plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/http/HTTPUtil.java
index 6eae1feda1..9c6d938884 100644
--- a/plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/http/HTTPUtil.java
+++ b/plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/http/HTTPUtil.java
@@ -1,41 +1,41 @@
-/*
- * 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.http;
-
-import org.eclipse.net4j.http.common.IHTTPConnector;
-import org.eclipse.net4j.internal.http.HTTPConnectorFactory;
-import org.eclipse.net4j.util.container.IManagedContainer;
-
-/**
- * A utility class with static convenience methods.
- *
- * @author Eike Stepper
- */
-public final class HTTPUtil
-{
- private HTTPUtil()
- {
- }
-
- public static void prepareContainer(IManagedContainer container)
- {
- container.registerFactory(new HTTPConnectorFactory());
- }
-
- /**
- * @since 2.0
- */
- public static IHTTPConnector getConnector(IManagedContainer container, String description)
- {
- return (IHTTPConnector)container.getElement(HTTPConnectorFactory.PRODUCT_GROUP, HTTPConnectorFactory.TYPE,
- description);
- }
-}
+/*
+ * 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.http;
+
+import org.eclipse.net4j.http.common.IHTTPConnector;
+import org.eclipse.net4j.internal.http.HTTPConnectorFactory;
+import org.eclipse.net4j.util.container.IManagedContainer;
+
+/**
+ * A utility class with static convenience methods.
+ *
+ * @author Eike Stepper
+ */
+public final class HTTPUtil
+{
+ private HTTPUtil()
+ {
+ }
+
+ public static void prepareContainer(IManagedContainer container)
+ {
+ container.registerFactory(new HTTPConnectorFactory());
+ }
+
+ /**
+ * @since 2.0
+ */
+ public static IHTTPConnector getConnector(IManagedContainer container, String description)
+ {
+ return (IHTTPConnector)container.getElement(HTTPConnectorFactory.PRODUCT_GROUP, HTTPConnectorFactory.TYPE,
+ description);
+ }
+}
diff --git a/plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/http/package-info.java b/plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/http/package-info.java
index 9e3edf1a15..fd766d2098 100644
--- a/plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/http/package-info.java
+++ b/plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/http/package-info.java
@@ -1,15 +1,15 @@
-/*
- * 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
- */
-
-/**
- * Transport layer extension with support for HTTP connections.
- */
-package org.eclipse.net4j.http;
+/*
+ * 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
+ */
+
+/**
+ * Transport layer extension with support for HTTP connections.
+ */
+package org.eclipse.net4j.http;
diff --git a/plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/internal/http/HTTPClientConnector.java b/plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/internal/http/HTTPClientConnector.java
index 9c887e43dd..d8b183230c 100644
--- a/plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/internal/http/HTTPClientConnector.java
+++ b/plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/internal/http/HTTPClientConnector.java
@@ -1,259 +1,259 @@
-/*
- * 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.HTTPConnector;
-import org.eclipse.net4j.util.concurrent.Worker;
-import org.eclipse.net4j.util.io.ExtendedDataInputStream;
-import org.eclipse.net4j.util.io.ExtendedDataOutputStream;
-import org.eclipse.net4j.util.io.ExtendedIOAdapter;
-import org.eclipse.net4j.util.io.ExtendedIOHandler;
-import org.eclipse.net4j.util.io.IORuntimeException;
-import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
-import org.eclipse.net4j.util.om.log.OMLogger;
-
-import org.eclipse.spi.net4j.InternalChannel;
-
-import org.apache.commons.httpclient.HttpClient;
-import org.apache.commons.httpclient.HttpException;
-import org.apache.commons.httpclient.methods.ByteArrayRequestEntity;
-import org.apache.commons.httpclient.methods.PostMethod;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.text.MessageFormat;
-
-/**
- * @author Eike Stepper
- */
-public class HTTPClientConnector extends HTTPConnector
-{
- private String url;
-
- private HttpClient httpClient;
-
- private int maxIdleTime = UNKNOWN_MAX_IDLE_TIME;
-
- private int pollInterval = DEFAULT_POLL_INTERVAL;
-
- private long lastRequest = System.currentTimeMillis();
-
- private boolean requesting;
-
- private Worker poller = new Worker()
- {
- @Override
- protected void work(WorkContext context) throws Exception
- {
- boolean moreBuffers = tryOperationsRequest();
- context.nextWork(moreBuffers ? 0 : 1000);
- }
- };
-
- public HTTPClientConnector()
- {
- }
-
- @Override
- public Location getLocation()
- {
- return Location.CLIENT;
- }
-
- @Override
- public String getURL()
- {
- return url;
- }
-
- public void setURL(String url)
- {
- this.url = url;
- }
-
- public int getMaxIdleTime()
- {
- return maxIdleTime;
- }
-
- public int getPollInterval()
- {
- return pollInterval;
- }
-
- public void setPollInterval(int pollInterval)
- {
- this.pollInterval = pollInterval;
- }
-
- @Override
- public void multiplexChannel(InternalChannel channel)
- {
- super.multiplexChannel(channel);
- tryOperationsRequest();
- }
-
- @Override
- public String toString()
- {
- if (getUserID() == null)
- {
- return MessageFormat.format("HTTPClientConnector[{0}]", getURL()); //$NON-NLS-1$
- }
-
- return MessageFormat.format("HTTPClientConnector[{1}@{0}]", getURL(), getUserID()); //$NON-NLS-1$
- }
-
- @Override
- protected void doBeforeActivate() throws Exception
- {
- super.doBeforeActivate();
- checkArg(url, "url == null"); //$NON-NLS-1$
- }
-
- @Override
- protected void doActivate() throws Exception
- {
- super.doActivate();
- poller.setDaemon(true);
- poller.activate();
- httpClient = createHTTPClient();
- doConnect();
- }
-
- @Override
- protected void doDeactivate() throws Exception
- {
- doDisconnect();
- LifecycleUtil.deactivate(poller, OMLogger.Level.WARN);
- httpClient = null;
- super.doDeactivate();
- }
-
- protected HttpClient createHTTPClient()
- {
- return new HttpClient();
- }
-
- protected PostMethod createHTTPMethod(String url)
- {
- return new PostMethod(url);
- }
-
- private void doConnect() throws IOException
- {
- request(new ExtendedIOHandler()
- {
- public void handleOut(ExtendedDataOutputStream out) throws IOException
- {
- out.writeByte(OPCODE_CONNECT);
- out.writeString(getUserID());
- }
-
- public void handleIn(ExtendedDataInputStream in) throws IOException
- {
- String connectorID = in.readString();
- maxIdleTime = in.readInt();
-
- setConnectorID(connectorID);
- leaveConnecting();
- }
- });
- }
-
- private void doDisconnect() throws IOException
- {
- request(new ExtendedIOAdapter()
- {
- @Override
- public void handleOut(ExtendedDataOutputStream out) throws IOException
- {
- out.writeByte(OPCODE_DISCONNECT);
- out.writeString(getConnectorID());
- }
- });
- }
-
- private void request(ExtendedIOHandler handler) throws IOException, HttpException
- {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- ExtendedDataOutputStream out = new ExtendedDataOutputStream(baos);
- handler.handleOut(out);
- out.flush();
-
- PostMethod method = createHTTPMethod(url);
- method.setRequestEntity(new ByteArrayRequestEntity(baos.toByteArray()));
-
- try
- {
- httpClient.executeMethod(method);
- InputStream bodyInputStream = method.getResponseBodyAsStream();
- ExtendedDataInputStream in = new ExtendedDataInputStream(bodyInputStream);
- handler.handleIn(in);
- }
- finally
- {
- method.releaseConnection();
- }
- }
-
- private boolean tryOperationsRequest()
- {
- synchronized (poller)
- {
- if (requesting)
- {
- return false;
- }
-
- if (getOutputQueue().isEmpty() && System.currentTimeMillis() - lastRequest < pollInterval)
- {
- return false;
- }
-
- requesting = true;
- }
-
- try
- {
- final boolean moreOperations[] = { false };
- request(new ExtendedIOHandler()
- {
- public void handleOut(ExtendedDataOutputStream out) throws IOException
- {
- out.writeByte(OPCODE_OPERATIONS);
- out.writeString(getConnectorID());
- moreOperations[0] = writeOutputOperations(out);
- }
-
- public void handleIn(ExtendedDataInputStream in) throws IOException
- {
- readInputOperations(in);
- }
- });
-
- lastRequest = System.currentTimeMillis();
- return moreOperations[0];
- }
- catch (IOException ex)
- {
- throw new IORuntimeException(ex);
- }
- finally
- {
- synchronized (poller)
- {
- requesting = false;
- }
- }
- }
-}
+/*
+ * 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.HTTPConnector;
+import org.eclipse.net4j.util.concurrent.Worker;
+import org.eclipse.net4j.util.io.ExtendedDataInputStream;
+import org.eclipse.net4j.util.io.ExtendedDataOutputStream;
+import org.eclipse.net4j.util.io.ExtendedIOAdapter;
+import org.eclipse.net4j.util.io.ExtendedIOHandler;
+import org.eclipse.net4j.util.io.IORuntimeException;
+import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
+import org.eclipse.net4j.util.om.log.OMLogger;
+
+import org.eclipse.spi.net4j.InternalChannel;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.methods.ByteArrayRequestEntity;
+import org.apache.commons.httpclient.methods.PostMethod;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.text.MessageFormat;
+
+/**
+ * @author Eike Stepper
+ */
+public class HTTPClientConnector extends HTTPConnector
+{
+ private String url;
+
+ private HttpClient httpClient;
+
+ private int maxIdleTime = UNKNOWN_MAX_IDLE_TIME;
+
+ private int pollInterval = DEFAULT_POLL_INTERVAL;
+
+ private long lastRequest = System.currentTimeMillis();
+
+ private boolean requesting;
+
+ private Worker poller = new Worker()
+ {
+ @Override
+ protected void work(WorkContext context) throws Exception
+ {
+ boolean moreBuffers = tryOperationsRequest();
+ context.nextWork(moreBuffers ? 0 : 1000);
+ }
+ };
+
+ public HTTPClientConnector()
+ {
+ }
+
+ @Override
+ public Location getLocation()
+ {
+ return Location.CLIENT;
+ }
+
+ @Override
+ public String getURL()
+ {
+ return url;
+ }
+
+ public void setURL(String url)
+ {
+ this.url = url;
+ }
+
+ public int getMaxIdleTime()
+ {
+ return maxIdleTime;
+ }
+
+ public int getPollInterval()
+ {
+ return pollInterval;
+ }
+
+ public void setPollInterval(int pollInterval)
+ {
+ this.pollInterval = pollInterval;
+ }
+
+ @Override
+ public void multiplexChannel(InternalChannel channel)
+ {
+ super.multiplexChannel(channel);
+ tryOperationsRequest();
+ }
+
+ @Override
+ public String toString()
+ {
+ if (getUserID() == null)
+ {
+ return MessageFormat.format("HTTPClientConnector[{0}]", getURL()); //$NON-NLS-1$
+ }
+
+ return MessageFormat.format("HTTPClientConnector[{1}@{0}]", getURL(), getUserID()); //$NON-NLS-1$
+ }
+
+ @Override
+ protected void doBeforeActivate() throws Exception
+ {
+ super.doBeforeActivate();
+ checkArg(url, "url == null"); //$NON-NLS-1$
+ }
+
+ @Override
+ protected void doActivate() throws Exception
+ {
+ super.doActivate();
+ poller.setDaemon(true);
+ poller.activate();
+ httpClient = createHTTPClient();
+ doConnect();
+ }
+
+ @Override
+ protected void doDeactivate() throws Exception
+ {
+ doDisconnect();
+ LifecycleUtil.deactivate(poller, OMLogger.Level.WARN);
+ httpClient = null;
+ super.doDeactivate();
+ }
+
+ protected HttpClient createHTTPClient()
+ {
+ return new HttpClient();
+ }
+
+ protected PostMethod createHTTPMethod(String url)
+ {
+ return new PostMethod(url);
+ }
+
+ private void doConnect() throws IOException
+ {
+ request(new ExtendedIOHandler()
+ {
+ public void handleOut(ExtendedDataOutputStream out) throws IOException
+ {
+ out.writeByte(OPCODE_CONNECT);
+ out.writeString(getUserID());
+ }
+
+ public void handleIn(ExtendedDataInputStream in) throws IOException
+ {
+ String connectorID = in.readString();
+ maxIdleTime = in.readInt();
+
+ setConnectorID(connectorID);
+ leaveConnecting();
+ }
+ });
+ }
+
+ private void doDisconnect() throws IOException
+ {
+ request(new ExtendedIOAdapter()
+ {
+ @Override
+ public void handleOut(ExtendedDataOutputStream out) throws IOException
+ {
+ out.writeByte(OPCODE_DISCONNECT);
+ out.writeString(getConnectorID());
+ }
+ });
+ }
+
+ private void request(ExtendedIOHandler handler) throws IOException, HttpException
+ {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ExtendedDataOutputStream out = new ExtendedDataOutputStream(baos);
+ handler.handleOut(out);
+ out.flush();
+
+ PostMethod method = createHTTPMethod(url);
+ method.setRequestEntity(new ByteArrayRequestEntity(baos.toByteArray()));
+
+ try
+ {
+ httpClient.executeMethod(method);
+ InputStream bodyInputStream = method.getResponseBodyAsStream();
+ ExtendedDataInputStream in = new ExtendedDataInputStream(bodyInputStream);
+ handler.handleIn(in);
+ }
+ finally
+ {
+ method.releaseConnection();
+ }
+ }
+
+ private boolean tryOperationsRequest()
+ {
+ synchronized (poller)
+ {
+ if (requesting)
+ {
+ return false;
+ }
+
+ if (getOutputQueue().isEmpty() && System.currentTimeMillis() - lastRequest < pollInterval)
+ {
+ return false;
+ }
+
+ requesting = true;
+ }
+
+ try
+ {
+ final boolean moreOperations[] = { false };
+ request(new ExtendedIOHandler()
+ {
+ public void handleOut(ExtendedDataOutputStream out) throws IOException
+ {
+ out.writeByte(OPCODE_OPERATIONS);
+ out.writeString(getConnectorID());
+ moreOperations[0] = writeOutputOperations(out);
+ }
+
+ public void handleIn(ExtendedDataInputStream in) throws IOException
+ {
+ readInputOperations(in);
+ }
+ });
+
+ lastRequest = System.currentTimeMillis();
+ return moreOperations[0];
+ }
+ catch (IOException ex)
+ {
+ throw new IORuntimeException(ex);
+ }
+ finally
+ {
+ synchronized (poller)
+ {
+ requesting = false;
+ }
+ }
+ }
+}
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;
+ }
+}
diff --git a/plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/internal/http/bundle/OM.java b/plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/internal/http/bundle/OM.java
index a60d2bc6fe..7126a72702 100644
--- a/plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/internal/http/bundle/OM.java
+++ b/plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/internal/http/bundle/OM.java
@@ -1,44 +1,44 @@
-/*
- * 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.bundle;
-
-import org.eclipse.net4j.util.om.OMBundle;
-import org.eclipse.net4j.util.om.OMPlatform;
-import org.eclipse.net4j.util.om.OSGiActivator;
-import org.eclipse.net4j.util.om.log.OMLogger;
-import org.eclipse.net4j.util.om.trace.OMTracer;
-
-/**
- * The <em>Operations & Maintenance</em> class of this bundle.
- *
- * @author Eike Stepper
- */
-public abstract class OM
-{
- public static final String BUNDLE_ID = "org.eclipse.net4j.http"; //$NON-NLS-1$
-
- public static final OMBundle BUNDLE = OMPlatform.INSTANCE.bundle(BUNDLE_ID, OM.class);
-
- public static final OMTracer DEBUG = BUNDLE.tracer("debug"); //$NON-NLS-1$
-
- public static final OMLogger LOG = BUNDLE.logger();
-
- /**
- * @author Eike Stepper
- */
- public static final class Activator extends OSGiActivator
- {
- public Activator()
- {
- super(BUNDLE);
- }
- }
-}
+/*
+ * 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.bundle;
+
+import org.eclipse.net4j.util.om.OMBundle;
+import org.eclipse.net4j.util.om.OMPlatform;
+import org.eclipse.net4j.util.om.OSGiActivator;
+import org.eclipse.net4j.util.om.log.OMLogger;
+import org.eclipse.net4j.util.om.trace.OMTracer;
+
+/**
+ * The <em>Operations & Maintenance</em> class of this bundle.
+ *
+ * @author Eike Stepper
+ */
+public abstract class OM
+{
+ public static final String BUNDLE_ID = "org.eclipse.net4j.http"; //$NON-NLS-1$
+
+ public static final OMBundle BUNDLE = OMPlatform.INSTANCE.bundle(BUNDLE_ID, OM.class);
+
+ public static final OMTracer DEBUG = BUNDLE.tracer("debug"); //$NON-NLS-1$
+
+ public static final OMLogger LOG = BUNDLE.logger();
+
+ /**
+ * @author Eike Stepper
+ */
+ public static final class Activator extends OSGiActivator
+ {
+ public Activator()
+ {
+ super(BUNDLE);
+ }
+ }
+}

Back to the top