summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2008-05-26 17:49:30 (EDT)
committerEike Stepper2008-05-26 17:49:30 (EDT)
commit9b4ec530dc684dc75fb0d0e281d2969192975742 (patch)
tree8c6f5a1c1529ef01cd129f5bdb9eb072e603325c
parent8e0624551c5fabdac9293b4ba0223e147a343189 (diff)
downloadcdo-9b4ec530dc684dc75fb0d0e281d2969192975742.zip
cdo-9b4ec530dc684dc75fb0d0e281d2969192975742.tar.gz
cdo-9b4ec530dc684dc75fb0d0e281d2969192975742.tar.bz2
[232648] Provide an HTTPConnector
https://bugs.eclipse.org/bugs/show_bug.cgi?id=232648
-rw-r--r--plugins/org.eclipse.net4j.http.common/src/org/eclipse/net4j/http/internal/common/HTTPConnector.java2
-rw-r--r--plugins/org.eclipse.net4j.http/HTTPServer.launch374
-rw-r--r--plugins/org.eclipse.net4j.http/HTTPTest.launch19
-rw-r--r--plugins/org.eclipse.net4j.http/META-INF/MANIFEST.MF18
-rw-r--r--plugins/org.eclipse.net4j.http/plugin.xml23
-rw-r--r--plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/http/HTTPUtil.java10
-rw-r--r--plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/http/IHTTPAcceptor.java23
-rw-r--r--plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/http/INet4jTransportServlet.java43
-rw-r--r--plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/internal/http/HTTPAcceptor.java254
-rw-r--r--plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/internal/http/HTTPAcceptorFactory.java38
-rw-r--r--plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/internal/http/HTTPChannel.java107
-rw-r--r--plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/internal/http/HTTPClientConnector.java7
-rw-r--r--plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/internal/http/HTTPConnector.java551
-rw-r--r--plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/internal/http/HTTPServerConnector.java89
-rw-r--r--plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/internal/http/Net4jTransportServlet.java249
-rw-r--r--plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/internal/http/RandomizerInjector.java47
-rw-r--r--plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/internal/http/bundle/OM.java3
-rw-r--r--plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/internal/http/tests/HTTPTest.java135
-rw-r--r--plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/internal/http/tests/Net4jEchoTestServlet.java73
19 files changed, 11 insertions, 2054 deletions
diff --git a/plugins/org.eclipse.net4j.http.common/src/org/eclipse/net4j/http/internal/common/HTTPConnector.java b/plugins/org.eclipse.net4j.http.common/src/org/eclipse/net4j/http/internal/common/HTTPConnector.java
index a1c6ab1..bc43d92 100644
--- a/plugins/org.eclipse.net4j.http.common/src/org/eclipse/net4j/http/internal/common/HTTPConnector.java
+++ b/plugins/org.eclipse.net4j.http.common/src/org/eclipse/net4j/http/internal/common/HTTPConnector.java
@@ -495,7 +495,6 @@ public abstract class HTTPConnector extends Connector implements IHTTPConnector
for (int i = 0; i < length; i++)
{
byte b = in.readByte();
- System.out.println("READ " + b);
byteBuffer.put(b);
}
@@ -517,7 +516,6 @@ public abstract class HTTPConnector extends Connector implements IHTTPConnector
for (int i = 0; i < length; i++)
{
byte b = byteBuffer.get();
- System.out.println("WRITE " + b);
out.writeByte(b);
}
diff --git a/plugins/org.eclipse.net4j.http/HTTPServer.launch b/plugins/org.eclipse.net4j.http/HTTPServer.launch
deleted file mode 100644
index 7a2ff15..0000000
--- a/plugins/org.eclipse.net4j.http/HTTPServer.launch
+++ /dev/null
@@ -1,374 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<launchConfiguration type="org.eclipse.pde.ui.EquinoxLauncher">
-<booleanAttribute key="append.args" value="true"/>
-<booleanAttribute key="automaticAdd" value="false"/>
-<booleanAttribute key="automaticValidate" value="true"/>
-<stringAttribute key="bootstrap" value=""/>
-<stringAttribute key="checked" value="org.eclipse.net4j,org.eclipse.net4j.http,org.eclipse.net4j.util"/>
-<booleanAttribute key="clearConfig" value="false"/>
-<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/HTTPServer"/>
-<booleanAttribute key="default_auto_start" value="true"/>
-<intAttribute key="default_start_level" value="4"/>
-<booleanAttribute key="includeOptional" value="true"/>
-<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
-<listEntry value="org.eclipse.debug.ui.launchGroup.debug"/>
-<listEntry value="org.eclipse.debug.ui.launchGroup.run"/>
-</listAttribute>
-<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -console"/>
-<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
-<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Declipse.ignoreApp=true -Dosgi.noShutdown=true&#13;&#10;-Dorg.osgi.service.http.port=8080"/>
-<stringAttribute key="pde.version" value="3.3"/>
-<stringAttribute key="selectedPlugin" value="org.eclipse.net4j.util"/>
-<booleanAttribute key="show_selected_only" value="false"/>
-<stringAttribute key="target_bundles" value="org.eclipse.equinox.http.jetty@default:default,org.eclipse.osgi.services@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.equinox.common@default:default,org.eclipse.equinox.http.registry@default:default,org.eclipse.core.runtime@default:default,org.eclipse.equinox.http.servlet@default:default,org.apache.commons.codec*1.3.0.v200803061910@default:default,org.apache.commons.httpclient*3.1.0.v200803061910@default:default,org.eclipse.core.runtime.compatibility.registry@default:false,org.eclipse.core.runtime.compatibility.auth@default:default,org.eclipse.equinox.preferences@default:default,org.apache.commons.logging*1.1.1.v200803061910@default:default,org.eclipse.core.jobs@default:default,org.mortbay.jetty*5.1.14.v200804221617@default:default,org.junit*3.8.2.v20080327@default:default,org.eclipse.equinox.app@default:default,javax.servlet*2.5.0.v200804152124@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.osgi@:"/>
-<booleanAttribute key="tracing" value="true"/>
-<mapAttribute key="tracingOptions">
-<mapEntry key="org.eclipse.emf.cdo.protocol/debug.id" value="true"/>
-<mapEntry key="org.eclipse.emf.cdo/debug.resource" value="true"/>
-<mapEntry key="org.eclipse.help.ui/debug/embeddedBrowser" value="false"/>
-<mapEntry key="org.eclipse.ui/perf/part.create" value="800"/>
-<mapEntry key="org.eclipse.core.resources/build/needbuildstack" value="false"/>
-<mapEntry key="org.eclipse.core.resources/save/mastertable" value="false"/>
-<mapEntry key="org.eclipse.osgi/debug" value="false"/>
-<mapEntry key="org.eclipse.ui.intro.universal/debug" value="true"/>
-<mapEntry key="org.eclipse.net4j.util.ui/debug" value="true"/>
-<mapEntry key="org.eclipse.jdt.core/debug/selection" value="false"/>
-<mapEntry key="org.eclipse.core.resources/strings" value="false"/>
-<mapEntry key="org.eclipse.ui.ide/debug/internalerror/openDialog" value="false"/>
-<mapEntry key="org.eclipse.net4j.util/debug.lifecycle" value="true"/>
-<mapEntry key="org.eclipse.net4j.db/debug" value="true"/>
-<mapEntry key="org.eclipse.ui/listeners/IWorkbenchPage.IPartListener" value="false"/>
-<mapEntry key="org.eclipse.pde.core/validation" value="false"/>
-<mapEntry key="org.eclipse.ui/perf/page.listeners" value="200"/>
-<mapEntry key="org.eclipse.core.resources/save/tree" value="false"/>
-<mapEntry key="org.eclipse.jdt.core/debug/postaction" value="false"/>
-<mapEntry key="org.eclipse.emf.cdo/debug.session" value="true"/>
-<mapEntry key="org.eclipse.jdt.ui/perf/content_assist_sorters/extensions" value=""/>
-<mapEntry key="org.eclipse.net4j/debug" value="true"/>
-<mapEntry key="org.eclipse.net4j.ui/debug" value="true"/>
-<mapEntry key="org.eclipse.core.runtime/url/debug/cachelookup" value="false"/>
-<mapEntry key="org.eclipse.emf.cdo/debug.util" value="true"/>
-<mapEntry key="org.eclipse.emf.cdo.protocol/perf.revision.writing" value="false"/>
-<mapEntry key="org.eclipse.team.cvs.core/debug" value="false"/>
-<mapEntry key="org.eclipse.emf.cdo.server/debug" value="true"/>
-<mapEntry key="org.eclipse.osgi/monitor/resources" value="false"/>
-<mapEntry key="org.eclipse.emf.cdo/debug.protocol" value="true"/>
-<mapEntry key="org.eclipse.core.resources/restore/markers" value="false"/>
-<mapEntry key="org.eclipse.help/debug/toc" value="false"/>
-<mapEntry key="org.eclipse.jdt.apt.core/debug/generatedFileMaps" value="false"/>
-<mapEntry key="org.eclipse.ui.intro.universal/trace/logInfo" value="true"/>
-<mapEntry key="org.eclipse.osgi/debug/messageBundles" value="false"/>
-<mapEntry key="org.eclipse.ui.ide/debug/undomonitor" value="false"/>
-<mapEntry key="org.eclipse.update.core/debug/parsing" value="false"/>
-<mapEntry key="org.eclipse.core.runtime/url/debug/connect" value="false"/>
-<mapEntry key="org.eclipse.pde.core/cache" value="false"/>
-<mapEntry key="org.eclipse.team.core/streams" value="false"/>
-<mapEntry key="org.eclipse.net4j.tcp/protocol.registration.timeout" value="10000"/>
-<mapEntry key="org.eclipse.team.cvs.core/threading" value="false"/>
-<mapEntry key="org.eclipse.osgi/eclipseadaptor/debug/platformadmin/resolver" value="false"/>
-<mapEntry key="org.eclipse.emf.cdo/debug.model" value="true"/>
-<mapEntry key="org.eclipse.net4j.db.mysql/debug.sql" value="true"/>
-<mapEntry key="org.eclipse.ui/perf/perspective.switch" value="800"/>
-<mapEntry key="org.eclipse.net4j/debug.selector" value="true"/>
-<mapEntry key="org.eclipse.emf.cdo/debug.view" value="true"/>
-<mapEntry key="org.eclipse.emf.cdo/perf.revision.loading" value="false"/>
-<mapEntry key="org.eclipse.emf.cdo/debug" value="true"/>
-<mapEntry key="org.eclipse.emf.cdo.server/debug.types" value="true"/>
-<mapEntry key="org.eclipse.ui/debug/declaredImages" value="false"/>
-<mapEntry key="org.eclipse.ui/perf/contentTypes" value="200"/>
-<mapEntry key="org.eclipse.ui/debug/swtdebug" value="false"/>
-<mapEntry key="org.eclipse.jdt.core/perf/selection" value="300"/>
-<mapEntry key="org.eclipse.emf.cdo.server/debug.store" value="true"/>
-<mapEntry key="org.eclipse.osgi/profile/debug" value="false"/>
-<mapEntry key="org.eclipse.core.resources/contenttype/cache" value="false"/>
-<mapEntry key="org.eclipse.ui.ide/debug/gc" value="false"/>
-<mapEntry key="org.eclipse.jdt.core/debug/indexmanager" value="false"/>
-<mapEntry key="org.eclipse.emf.cdo.server/debug.resource" value="true"/>
-<mapEntry key="org.eclipse.jdt.apt.pluggable.core/debug" value="false"/>
-<mapEntry key="org.eclipse.emf.cdo.ui/test" value="false"/>
-<mapEntry key="org.eclipse.net4j.db.derby/debug" value="true"/>
-<mapEntry key="org.eclipse.net4j.util/debug" value="true"/>
-<mapEntry key="org.eclipse.net4j.http/protocol.registration.timeout" value="10000"/>
-<mapEntry key="org.eclipse.net4j.jms.admin/debug.protocol" value="true"/>
-<mapEntry key="org.eclipse.debug.ui/debug/viewers/model" value="false"/>
-<mapEntry key="org.eclipse.help.ui/debug/embeddedBrowser/inprocess" value="false"/>
-<mapEntry key="org.eclipse.jdt.core/debug/compiler" value="false"/>
-<mapEntry key="org.eclipse.debug.ui/debug/viewers/stateSaveRestore" value="false"/>
-<mapEntry key="org.eclipse.debug.ui/debug/viewers/deltas" value="false"/>
-<mapEntry key="org.eclipse.net4j.buddies.protocol/debug" value="true"/>
-<mapEntry key="org.eclipse.team.cvs.core/syncchangeevents" value="false"/>
-<mapEntry key="org.eclipse.ltk.core.refactoring/perf/participants/checkConditions" value="300"/>
-<mapEntry key="org.eclipse.core.jobs/jobs/locks" value="false"/>
-<mapEntry key="org.eclipse.jdt.ui/perf/explorer/makeActions" value="1000"/>
-<mapEntry key="org.eclipse.ui/perf/workbench.start" value="45000"/>
-<mapEntry key="org.eclipse.ui/debug/swtdebugglobal" value="false"/>
-<mapEntry key="org.eclipse.core.resources/perf/listeners" value="500"/>
-<mapEntry key="org.eclipse.jface.text/debug/FastPartitioner/PositionCache" value="false"/>
-<mapEntry key="org.eclipse.ui/trace/keyBindings.verbose" value="false"/>
-<mapEntry key="org.eclipse.emf.cdo/perf" value="false"/>
-<mapEntry key="org.eclipse.osgi/debug/services" value="false"/>
-<mapEntry key="org.eclipse.update.core/debug/reconciler" value="false"/>
-<mapEntry key="org.eclipse.jdt.core/perf/completion" value="300"/>
-<mapEntry key="org.eclipse.help/debug/search" value="false"/>
-<mapEntry key="org.eclipse.ui/perf/part.control" value="800"/>
-<mapEntry key="org.eclipse.ui/experimental/menus" value="false"/>
-<mapEntry key="org.eclipse.ui/debug/job.stale" value="false"/>
-<mapEntry key="org.eclipse.ui/perf/uijob" value="200"/>
-<mapEntry key="org.eclipse.ui/trace/multipageeditor" value="false"/>
-<mapEntry key="org.eclipse.osgi/resolver/generics" value="false"/>
-<mapEntry key="org.eclipse.emf.cdo.protocol/debug.model" value="true"/>
-<mapEntry key="org.eclipse.jdt.core/debug/resolution" value="false"/>
-<mapEntry key="org.eclipse.emf.cdo.protocol/perf.revision" value="false"/>
-<mapEntry key="org.eclipse.ui.intro/debug" value="true"/>
-<mapEntry key="org.eclipse.jdt.core/perf/containerinitializer" value="5000"/>
-<mapEntry key="org.eclipse.osgi/eclipseadaptor/debug" value="false"/>
-<mapEntry key="org.eclipse.core.resources/build/invoking" value="false"/>
-<mapEntry key="org.eclipse.core.resources/restore/tree" value="false"/>
-<mapEntry key="org.eclipse.osgi/monitor/classes" value="false"/>
-<mapEntry key="org.eclipse.net4j.chat/debug" value="true"/>
-<mapEntry key="org.eclipse.net4j.util/debug.concurrency" value="true"/>
-<mapEntry key="org.eclipse.jdt.ui/debug/TypeConstraints" value="false"/>
-<mapEntry key="org.eclipse.net4j/debug.buffer" value="true"/>
-<mapEntry key="org.eclipse.osgi/eclipseadaptor/debug/location" value="false"/>
-<mapEntry key="org.eclipse.core.resources/save" value="false"/>
-<mapEntry key="org.eclipse.net4j.db.mysql/debug" value="true"/>
-<mapEntry key="org.eclipse.ui.intro/trace/logPerformance" value="false"/>
-<mapEntry key="org.eclipse.core.resources/restore/syncinfo" value="false"/>
-<mapEntry key="org.eclipse.debug.core/debug" value="false"/>
-<mapEntry key="org.eclipse.ui/debug/showAllJobs" value="false"/>
-<mapEntry key="org.eclipse.osgi/resolver/requires" value="false"/>
-<mapEntry key="org.eclipse.ui/trace/sources" value="false"/>
-<mapEntry key="org.eclipse.net4j/debug.signal" value="true"/>
-<mapEntry key="org.eclipse.emf.cdo.protocol/perf.revision.reading" value="false"/>
-<mapEntry key="org.eclipse.jdt.ui/perf/search/participants" value="300"/>
-<mapEntry key="org.eclipse.net4j.jms/debug.protocol" value="true"/>
-<mapEntry key="org.eclipse.core.contenttype/debug" value="false"/>
-<mapEntry key="org.eclipse.core.resources/build/needbuild" value="false"/>
-<mapEntry key="org.eclipse.core.resources/restore/snapshots" value="false"/>
-<mapEntry key="org.eclipse.help.ui/debug" value="true"/>
-<mapEntry key="org.eclipse.debug.ui/debug/viewers/viewer" value="false"/>
-<mapEntry key="org.eclipse.osgi/profile/startup" value="false"/>
-<mapEntry key="org.eclipse.jdt.apt.core/debug" value="false"/>
-<mapEntry key="org.eclipse.net4j.chat.ui/debug" value="true"/>
-<mapEntry key="org.eclipse.jdt.core/perf/javadeltalistener" value="500"/>
-<mapEntry key="org.eclipse.net4j/debug.acceptor" value="true"/>
-<mapEntry key="org.eclipse.jdt.core/debug/javamodel" value="false"/>
-<mapEntry key="org.eclipse.update.core/debug/install" value="false"/>
-<mapEntry key="org.eclipse.core.jobs/jobs/errorondeadlock" value="false"/>
-<mapEntry key="org.eclipse.update.core/debug/warning" value="false"/>
-<mapEntry key="org.eclipse.debug.ui/debug/viewers/updateSequence" value="false"/>
-<mapEntry key="org.eclipse.jdt.ui/perf/explorer/createPartControl" value="1300"/>
-<mapEntry key="org.eclipse.net4j.buddies/debug" value="true"/>
-<mapEntry key="org.eclipse.debug.core/debug/commands" value="false"/>
-<mapEntry key="org.eclipse.net4j.buddies.ui/debug" value="true"/>
-<mapEntry key="org.eclipse.core.jobs/jobs" value="false"/>
-<mapEntry key="org.eclipse.core.jobs/jobs/beginend" value="false"/>
-<mapEntry key="org.eclipse.pde.core/debug" value="true"/>
-<mapEntry key="org.eclipse.osgi/monitor/activation" value="false"/>
-<mapEntry key="org.eclipse.core.resources/perf/builders" value="10000"/>
-<mapEntry key="org.eclipse.ui.workbench/debug" value="false"/>
-<mapEntry key="org.eclipse.jdt.apt.core/debug/generatedFiles" value="false"/>
-<mapEntry key="org.eclipse.core.runtime/debug" value="false"/>
-<mapEntry key="org.eclipse.ui/perf/part.activate" value="200"/>
-<mapEntry key="org.eclipse.help/debug" value="true"/>
-<mapEntry key="org.eclipse.jdt.core/debug/builder" value="false"/>
-<mapEntry key="org.eclipse.emf.cdo/perf.revision" value="false"/>
-<mapEntry key="org.eclipse.core.resources/restore/metainfo" value="false"/>
-<mapEntry key="org.eclipse.debug.ui/debug/contextlaunching" value="false"/>
-<mapEntry key="org.eclipse.ui/trace/handlers.performance" value="false"/>
-<mapEntry key="org.eclipse.emf.cdo.server/debug.transaction" value="true"/>
-<mapEntry key="org.eclipse.team.cvs.ssh/ssh_protocol" value="false"/>
-<mapEntry key="org.eclipse.jdt.core/perf/reconcile" value="1000"/>
-<mapEntry key="org.eclipse.ui/trace/contexts" value="false"/>
-<mapEntry key="org.eclipse.ui.intro/flags/noBrowser" value="false"/>
-<mapEntry key="org.eclipse.emf.cdo/debug.revision" value="true"/>
-<mapEntry key="org.eclipse.net4j.db.derby/debug.sql" value="true"/>
-<mapEntry key="org.eclipse.jdt.ui/debug" value="true"/>
-<mapEntry key="org.eclipse.equinox.security/debug" value="false"/>
-<mapEntry key="org.eclipse.ui/perf/part.input" value="200"/>
-<mapEntry key="org.eclipse.emf.cdo.examples/debug" value="true"/>
-<mapEntry key="org.eclipse.net4j.util/debug.registry" value="true"/>
-<mapEntry key="org.eclipse.emf.cdo.examples.spring/debug" value="true"/>
-<mapEntry key="org.eclipse.jdt.core/debug/cpresolution" value="false"/>
-<mapEntry key="org.eclipse.team.cvs.core/cvsprotocol" value="true"/>
-<mapEntry key="org.eclipse.debug.ui/debug/launchhistory" value="false"/>
-<mapEntry key="org.eclipse.emf.cdo.protocol/debug" value="true"/>
-<mapEntry key="org.eclipse.osgi/resolver/cycles" value="false"/>
-<mapEntry key="org.eclipse.osgi/eclipseadaptor/converter/debug" value="false"/>
-<mapEntry key="org.eclipse.jdt.core/debug/cpresolution/advanced" value="false"/>
-<mapEntry key="org.eclipse.net4j/set.signal.thread.name" value="false"/>
-<mapEntry key="org.eclipse.net4j.http/debug" value="true"/>
-<mapEntry key="org.eclipse.ui/listeners/IWorkbenchPartReference" value="false"/>
-<mapEntry key="org.eclipse.emf.cdo.protocol/perf" value="false"/>
-<mapEntry key="org.eclipse.core.resources/history" value="false"/>
-<mapEntry key="org.eclipse.ui/listeners/IWorkbenchWindow.IPartListener2" value="false"/>
-<mapEntry key="org.eclipse.help.webapp/debug/workingsets" value="false"/>
-<mapEntry key="org.eclipse.jdt.core/debug/buffermanager" value="false"/>
-<mapEntry key="org.eclipse.core.resources/build/delta" value="false"/>
-<mapEntry key="org.eclipse.osgi/resolver/imports" value="false"/>
-<mapEntry key="org.eclipse.osgi/defaultprofile/logsynchronously" value="false"/>
-<mapEntry key="org.eclipse.core.resources/save/syncinfo" value="false"/>
-<mapEntry key="org.eclipse.jdt.ui/debug/ResultCollector" value="false"/>
-<mapEntry key="org.eclipse.core.expressions/tracePropertyResolving" value="false"/>
-<mapEntry key="org.eclipse.net4j.jms.server/debug.store" value="true"/>
-<mapEntry key="org.eclipse.ui/perf/showHeapStatus" value="true"/>
-<mapEntry key="org.eclipse.net4j/debug.channel" value="true"/>
-<mapEntry key="org.eclipse.ui/perf/part.listeners" value="200"/>
-<mapEntry key="org.eclipse.osgi/resolver/wiring" value="false"/>
-<mapEntry key="org.eclipse.emf.cdo.ui/debug" value="true"/>
-<mapEntry key="org.eclipse.core.runtime/url/debug/cachecopy" value="false"/>
-<mapEntry key="org.eclipse.jdt.ui/perf/explorer/RefactorActionGroup" value="150"/>
-<mapEntry key="org.eclipse.jface.text/debug/AbstractInformationControlManager" value="false"/>
-<mapEntry key="org.eclipse.jdt.ui/perf/content_assist/extensions" value="1000"/>
-<mapEntry key="org.eclipse.pde.core/classpath" value="false"/>
-<mapEntry key="org.eclipse.core.resources/restore" value="false"/>
-<mapEntry key="org.eclipse.equinox.security/debug/loginFramework" value="false"/>
-<mapEntry key="org.eclipse.update.core/debug/web" value="false"/>
-<mapEntry key="org.eclipse.emf.cdo.server/debug.protocol" value="true"/>
-<mapEntry key="org.eclipse.help.webapp/debug" value="true"/>
-<mapEntry key="org.eclipse.net4j.jms/debug" value="true"/>
-<mapEntry key="org.eclipse.jdt.core/debug/search" value="false"/>
-<mapEntry key="org.eclipse.emf.cdo.protocol/debug.protocol" value="true"/>
-<mapEntry key="org.eclipse.osgi/defaultprofile/logfilename" value=""/>
-<mapEntry key="org.eclipse.emf.cdo.server.hibernate.id/debug" value="true"/>
-<mapEntry key="org.eclipse.osgi/debug/startlevel" value="false"/>
-<mapEntry key="org.eclipse.jdt.core/debug/sourcemapper" value="false"/>
-<mapEntry key="org.eclipse.osgi/defaultprofile/buffersize" value="256"/>
-<mapEntry key="org.eclipse.ui/trace/commands" value="false"/>
-<mapEntry key="org.eclipse.core.resources/save/markers" value="false"/>
-<mapEntry key="org.eclipse.osgi/debug/manifest" value="false"/>
-<mapEntry key="org.eclipse.ui.intro/trace/logInfo" value="true"/>
-<mapEntry key="org.eclipse.core.runtime/perf" value="false"/>
-<mapEntry key="org.eclipse.jdt.core/debug/hierarchy" value="false"/>
-<mapEntry key="org.eclipse.net4j.buddies.server/debug" value="true"/>
-<mapEntry key="org.eclipse.emf.cdo/debug.object" value="true"/>
-<mapEntry key="org.eclipse.core.resources/refresh" value="false"/>
-<mapEntry key="org.eclipse.debug.ui/debug" value="false"/>
-<mapEntry key="org.eclipse.update.core/debug/installhandler" value="false"/>
-<mapEntry key="org.eclipse.core.resources/save/metainfo" value="false"/>
-<mapEntry key="org.eclipse.ui/debug/contributions" value="false"/>
-<mapEntry key="org.eclipse.ui/trace/operations.verbose" value="false"/>
-<mapEntry key="org.eclipse.emf.cdo.protocol/debug.revision" value="true"/>
-<mapEntry key="org.eclipse.jface.text.source/debug/RevisionRulerColumn" value="false"/>
-<mapEntry key="org.eclipse.equinox.registry/debug/events" value="false"/>
-<mapEntry key="org.eclipse.net4j.db.hsqldb/debug.sql" value="true"/>
-<mapEntry key="org.eclipse.core.resources/restore/mastertable" value="false"/>
-<mapEntry key="org.eclipse.osgi/trace/activation" value="false"/>
-<mapEntry key="org.eclipse.ui.ide/debug" value="false"/>
-<mapEntry key="org.eclipse.ui/trace/keyBindings" value="false"/>
-<mapEntry key="org.eclipse.update.core/debug/type" value="false"/>
-<mapEntry key="org.eclipse.jdt.apt.core/debug/compilationEnv" value="false"/>
-<mapEntry key="org.eclipse.debug.core/debug/events" value="false"/>
-<mapEntry key="org.eclipse.core.runtime/preferences/plugin" value="false"/>
-<mapEntry key="org.eclipse.core.jobs/jobs/timing" value="false"/>
-<mapEntry key="org.eclipse.ui.browser/debug" value="false"/>
-<mapEntry key="org.eclipse.jdt.core/debug/builder/stats" value="false"/>
-<mapEntry key="org.eclipse.core.resources/build/interrupt" value="false"/>
-<mapEntry key="org.eclipse.net4j.util/debug.lifecycle.dump" value="true"/>
-<mapEntry key="org.eclipse.jdt.core/perf/variableinitializer" value="5000"/>
-<mapEntry key="org.eclipse.help/debug/context" value="false"/>
-<mapEntry key="org.eclipse.update.core/debug/configuration" value="false"/>
-<mapEntry key="org.eclipse.emf.cdo.server.db/debug" value="true"/>
-<mapEntry key="org.eclipse.osgi/debug/packageadmin" value="false"/>
-<mapEntry key="org.eclipse.equinox.security.ui/debug/storage" value="false"/>
-<mapEntry key="org.eclipse.ui.intro.universal/trace/logPerformance" value="false"/>
-<mapEntry key="org.eclipse.net4j.jms.admin/debug" value="true"/>
-<mapEntry key="org.eclipse.jdt.core/debug/completion" value="false"/>
-<mapEntry key="org.eclipse.equinox.preferences/set" value="false"/>
-<mapEntry key="org.eclipse.pde.build/debug" value="false"/>
-<mapEntry key="org.eclipse.equinox.preferences/general" value="false"/>
-<mapEntry key="org.eclipse.ui/debug/workingSets" value="false"/>
-<mapEntry key="org.eclipse.jface.text/debug/ContentAssistSubjectAdapters" value="false"/>
-<mapEntry key="org.eclipse.net4j.examples/debug" value="true"/>
-<mapEntry key="org.eclipse.osgi/debug/security" value="false"/>
-<mapEntry key="org.eclipse.core.runtime/compatibility/debug" value="false"/>
-<mapEntry key="org.eclipse.ui/trace/graphics" value="false"/>
-<mapEntry key="org.eclipse.jdt.core/debug/formatter" value="false"/>
-<mapEntry key="org.eclipse.update.core/debug" value="true"/>
-<mapEntry key="org.eclipse.emf.cdo/debug.adapter" value="true"/>
-<mapEntry key="org.eclipse.team.core/debug" value="false"/>
-<mapEntry key="org.eclipse.help.ui/debug/infopop" value="false"/>
-<mapEntry key="org.eclipse.osgi/trace/filename" value="runtime.traces"/>
-<mapEntry key="org.eclipse.equinox.preferences/get" value="false"/>
-<mapEntry key="org.eclipse.net4j.jvm/debug" value="true"/>
-<mapEntry key="org.eclipse.net4j.jms.server.jdbc/debug" value="true"/>
-<mapEntry key="org.eclipse.ui/trace/handlers.verbose" value="false"/>
-<mapEntry key="org.eclipse.equinox.registry/debug" value="false"/>
-<mapEntry key="org.eclipse.emf.cdo/debug.repository" value="true"/>
-<mapEntry key="org.eclipse.jdt.core.manipulation/debug" value="true"/>
-<mapEntry key="org.eclipse.net4j.debug/debug" value="true"/>
-<mapEntry key="org.eclipse.osgi/resolver/debug" value="false"/>
-<mapEntry key="org.eclipse.jface.text/debug/AnnotationPainter" value="false"/>
-<mapEntry key="org.eclipse.osgi/resolver/uses" value="false"/>
-<mapEntry key="org.eclipse.ui/trace/handlers.verbose.commandId" value=""/>
-<mapEntry key="org.eclipse.net4j.util/debug.om" value="true"/>
-<mapEntry key="org.eclipse.emf.cdo.ui/test.bulk_add" value="false"/>
-<mapEntry key="org.eclipse.emf.cdo.server/debug.session" value="true"/>
-<mapEntry key="org.eclipse.ui.intro/trace/printHTML" value="false"/>
-<mapEntry key="org.eclipse.ui/listeners/IWorkbenchPage.IPropertyChangeListener" value="false"/>
-<mapEntry key="org.eclipse.team.core/threading" value="false"/>
-<mapEntry key="org.eclipse.jdt.core/debug/javadelta" value="false"/>
-<mapEntry key="org.eclipse.ui/debug" value="false"/>
-<mapEntry key="org.eclipse.jdt.core/debug/zipaccess" value="false"/>
-<mapEntry key="org.eclipse.team.core/backgroundevents" value="false"/>
-<mapEntry key="org.eclipse.core.jobs/jobs/shutdown" value="false"/>
-<mapEntry key="org.eclipse.osgi/trace/filters" value="trace.properties"/>
-<mapEntry key="org.eclipse.jdt.core/debug/javadelta/verbose" value="false"/>
-<mapEntry key="org.eclipse.core.resources/debug" value="false"/>
-<mapEntry key="org.eclipse.ui.ide/debug/markers" value="false"/>
-<mapEntry key="org.eclipse.core.runtime/debug/context" value="false"/>
-<mapEntry key="org.eclipse.core.resources/build/stacktrace" value="false"/>
-<mapEntry key="org.eclipse.debug.ui/debug/viewers/contentProvider" value="false"/>
-<mapEntry key="org.eclipse.ui/listeners/IWorkbenchWindow.IPerspectiveListener" value="false"/>
-<mapEntry key="org.eclipse.emf.cdo/debug.transaction" value="true"/>
-<mapEntry key="org.eclipse.osgi/debug/bundleTime" value="false"/>
-<mapEntry key="org.eclipse.ui/listeners/IWorkbenchWindow.IPartListener" value="false"/>
-<mapEntry key="org.eclipse.core.resources/build/failure" value="false"/>
-<mapEntry key="org.eclipse.osgi/profile/impl" value="org.eclipse.osgi.internal.profile.DefaultProfileLogger"/>
-<mapEntry key="org.eclipse.ui/perf/workbench.restore" value="30000"/>
-<mapEntry key="org.eclipse.net4j.jms.server/debug.protocol" value="true"/>
-<mapEntry key="org.eclipse.net4j/debug.buffer.stream" value="true"/>
-<mapEntry key="org.eclipse.jdt.core/debug" value="true"/>
-<mapEntry key="org.eclipse.osgi/debug/filter" value="false"/>
-<mapEntry key="org.eclipse.update.configurator/debug" value="false"/>
-<mapEntry key="org.eclipse.team.cvs.core/metafiles" value="false"/>
-<mapEntry key="org.eclipse.core.resources/contenttype" value="false"/>
-<mapEntry key="org.eclipse.ui/trace/operations" value="false"/>
-<mapEntry key="org.eclipse.net4j.db.hsqldb/debug" value="true"/>
-<mapEntry key="org.eclipse.ui/listeners/IWorkbenchPage.IPartListener2" value="false"/>
-<mapEntry key="org.eclipse.jdt.core/debug/javamodel/cache" value="false"/>
-<mapEntry key="org.eclipse.emf.cdo.server.hibernate/debug" value="true"/>
-<mapEntry key="org.eclipse.osgi/debug/loader" value="false"/>
-<mapEntry key="org.eclipse.core.resources/preferences" value="false"/>
-<mapEntry key="org.eclipse.jdt.ui/debug/ASTProvider" value="false"/>
-<mapEntry key="org.eclipse.core.resources/perf/snapshot" value="1000"/>
-<mapEntry key="org.eclipse.ui/trace/handlers" value="false"/>
-<mapEntry key="org.eclipse.ui/perf/perspective.listeners" value="200"/>
-<mapEntry key="org.eclipse.osgi/debug/events" value="false"/>
-<mapEntry key="org.eclipse.osgi/trace/classLoading" value="false"/>
-<mapEntry key="org.eclipse.emf.cdo.server/debug.repository" value="true"/>
-<mapEntry key="org.eclipse.ui/trace/contexts.verbose" value="false"/>
-<mapEntry key="org.eclipse.osgi/profile/benchmark" value="false"/>
-<mapEntry key="org.eclipse.emf.cdo.server/debug.revision" value="true"/>
-<mapEntry key="org.eclipse.equinox.security.ui/debug" value="false"/>
-<mapEntry key="org.eclipse.ui/perf/perspective.create" value="800"/>
-<mapEntry key="org.eclipse.net4j/debug.connector" value="true"/>
-<mapEntry key="org.eclipse.ui/trace/contexts.performance" value="false"/>
-<mapEntry key="org.eclipse.net4j.jms.server/debug" value="true"/>
-<mapEntry key="org.eclipse.core.runtime/url/debug" value="false"/>
-<mapEntry key="org.eclipse.team.cvs.ssh/debug" value="false"/>
-<mapEntry key="org.eclipse.ui/perf/part.init" value="800"/>
-<mapEntry key="org.eclipse.core.runtime/perf/success" value="false"/>
-<mapEntry key="org.eclipse.ltk.core.refactoring/perf/participants/createChanges" value="300"/>
-<mapEntry key="org.eclipse.ui/listeners/IWorkbenchWindow.IPageListener" value="false"/>
-<mapEntry key="org.eclipse.osgi/eclipseadaptor/debug/platformadmin" value="false"/>
-<mapEntry key="org.eclipse.team.cvs.core/dirtycaching" value="false"/>
-<mapEntry key="org.eclipse.core.resources/natures" value="false"/>
-<mapEntry key="org.eclipse.net4j.tcp/debug" value="true"/>
-<mapEntry key="org.eclipse.team.core/refreshjob" value="false"/>
-<mapEntry key="org.eclipse.core.resources/perf/save.participants" value="500"/>
-<mapEntry key="org.eclipse.net4j.db/debug.sql" value="true"/>
-</mapAttribute>
-<booleanAttribute key="useDefaultConfigArea" value="true"/>
-<stringAttribute key="workspace_bundles" value="org.eclipse.net4j.http@default:default,org.eclipse.net4j.jvm@default:default,org.eclipse.net4j.tests@default:default,org.eclipse.net4j.tcp@default:default,org.eclipse.net4j@default:default,org.eclipse.net4j.util@default:default"/>
-</launchConfiguration>
diff --git a/plugins/org.eclipse.net4j.http/HTTPTest.launch b/plugins/org.eclipse.net4j.http/HTTPTest.launch
deleted file mode 100644
index dad840b..0000000
--- a/plugins/org.eclipse.net4j.http/HTTPTest.launch
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
-<listEntry value="/org.eclipse.net4j.http/src/org/eclipse/net4j/internal/http/tests/HTTPTest.java"/>
-</listAttribute>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
-<listEntry value="1"/>
-</listAttribute>
-<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
-<listEntry value="org.eclipse.debug.ui.launchGroup.debug"/>
-<listEntry value="org.eclipse.debug.ui.launchGroup.run"/>
-</listAttribute>
-<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
-<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
-<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
-<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit3"/>
-<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.net4j.internal.http.tests.HTTPTest"/>
-<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.net4j.http"/>
-</launchConfiguration>
diff --git a/plugins/org.eclipse.net4j.http/META-INF/MANIFEST.MF b/plugins/org.eclipse.net4j.http/META-INF/MANIFEST.MF
index d62e1e6..0ddec94 100644
--- a/plugins/org.eclipse.net4j.http/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.net4j.http/META-INF/MANIFEST.MF
@@ -10,15 +10,11 @@ Bundle-Activator: org.eclipse.net4j.internal.http.bundle.OM$Activator
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ClassPath: .
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.3.0,4.0.0)";resolution:=optional,
- org.eclipse.net4j;bundle-version="[0.8.0,0.9.0)";visibility:=reexport,
- org.eclipse.equinox.http.registry;bundle-version="[1.0.0,2.0.0)";resolution:=optional,
- org.eclipse.equinox.http.servlet;bundle-version="[1.0.0,2.0.0)";resolution:=optional,
- org.eclipse.net4j.tests;bundle-version="[0.8.0,0.9.0)";resolution:=optional,
- org.apache.commons.logging;bundle-version="[1.0.0,2.0.0)";resolution:=optional,
- org.apache.commons.codec;bundle-version="[1.0.0,2.0.0)";resolution:=optional
-Import-Package: javax.servlet;version="2.4.0";resolution:=optional,
- javax.servlet.http;version="2.4.0";resolution:=optional,
- org.apache.commons.httpclient;version="3.0.1";resolution:=optional,
- org.apache.commons.httpclient.methods;version="3.0.1";resolution:=optional
+ org.eclipse.net4j.http.common;bundle-version="[0.8.0,0.9.0)";visibility:=reexport,
+ org.apache.commons.logging;bundle-version="[1.0.0,2.0.0)",
+ org.apache.commons.codec;bundle-version="[1.0.0,2.0.0)"
+Import-Package: org.apache.commons.httpclient;version="3.0.1",
+ org.apache.commons.httpclient.methods;version="3.0.1"
Export-Package: org.eclipse.net4j.http;version="0.8.0",
- org.eclipse.net4j.internal.http;version="0.8.0"
+ org.eclipse.net4j.internal.http;version="0.8.0",
+ org.eclipse.net4j.internal.http.bundle;version="0.8.0";x-internal:=true
diff --git a/plugins/org.eclipse.net4j.http/plugin.xml b/plugins/org.eclipse.net4j.http/plugin.xml
index eb181fe..2520ca5 100644
--- a/plugins/org.eclipse.net4j.http/plugin.xml
+++ b/plugins/org.eclipse.net4j.http/plugin.xml
@@ -20,32 +20,9 @@
<extension
point="org.eclipse.net4j.util.factories">
<factory
- class="org.eclipse.net4j.internal.http.HTTPAcceptorFactory"
- productGroup="org.eclipse.net4j.acceptors"
- type="http"/>
- <factory
class="org.eclipse.net4j.internal.http.HTTPConnectorFactory"
productGroup="org.eclipse.net4j.connectors"
type="http"/>
</extension>
- <extension
- point="org.eclipse.net4j.util.elementProcessors">
- <elementProcessor
- class="org.eclipse.net4j.internal.http.RandomizerInjector">
- </elementProcessor>
- </extension>
-
- <extension
- point="org.eclipse.equinox.http.registry.servlets">
- <servlet
- alias="/net4j"
- class="org.eclipse.net4j.internal.http.Net4jTransportServlet$ContainerAware"/>
-<!--
- <servlet
- alias="/net4j/echotest"
- class="org.eclipse.net4j.internal.http.tests.Net4jEchoTestServlet"/>
--->
- </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 25a09f2..9943bb1 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
@@ -10,9 +10,7 @@
**************************************************************************/
package org.eclipse.net4j.http;
-import org.eclipse.net4j.internal.http.HTTPAcceptorFactory;
import org.eclipse.net4j.internal.http.HTTPConnectorFactory;
-import org.eclipse.net4j.internal.http.RandomizerInjector;
import org.eclipse.net4j.util.container.IManagedContainer;
/**
@@ -26,15 +24,7 @@ public final class HTTPUtil
public static void prepareContainer(IManagedContainer container)
{
- container.registerFactory(new HTTPAcceptorFactory());
container.registerFactory(new HTTPConnectorFactory());
- container.addPostProcessor(new RandomizerInjector());
- }
-
- public static IHTTPAcceptor getAcceptor(IManagedContainer container, String description)
- {
- return (IHTTPAcceptor)container
- .getElement(HTTPAcceptorFactory.PRODUCT_GROUP, HTTPAcceptorFactory.TYPE, description);
}
public static IHTTPConnector getConnector(IManagedContainer container, String description)
diff --git a/plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/http/IHTTPAcceptor.java b/plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/http/IHTTPAcceptor.java
deleted file mode 100644
index 9f761b2..0000000
--- a/plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/http/IHTTPAcceptor.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/***************************************************************************
- * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
- * 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.acceptor.IAcceptor;
-
-/**
- * @author Eike Stepper
- */
-public interface IHTTPAcceptor extends IAcceptor
-{
- public INet4jTransportServlet getServlet();
-
- public void setServlet(INet4jTransportServlet servlet);
-}
diff --git a/plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/http/INet4jTransportServlet.java b/plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/http/INet4jTransportServlet.java
deleted file mode 100644
index 25bf7ea..0000000
--- a/plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/http/INet4jTransportServlet.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/***************************************************************************
- * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
- * 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.util.io.ExtendedDataInputStream;
-import org.eclipse.net4j.util.io.ExtendedDataOutputStream;
-
-import javax.servlet.Servlet;
-
-import java.io.IOException;
-
-/**
- * @author Eike Stepper
- */
-public interface INet4jTransportServlet extends Servlet
-{
- public RequestHandler getRequestHandler();
-
- public void setRequestHandler(RequestHandler handler);
-
- /**
- * @author Eike Stepper
- */
- public interface RequestHandler
- {
- public IHTTPConnector[] handleList(String connectorID);
-
- public IHTTPConnector handleConnect(String userID);
-
- public void handleDisonnect(String connectorID);
-
- public void handleOperations(String connectorID, ExtendedDataInputStream in, ExtendedDataOutputStream out)
- throws IOException;
- }
-}
diff --git a/plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/internal/http/HTTPAcceptor.java b/plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/internal/http/HTTPAcceptor.java
deleted file mode 100644
index 5774952..0000000
--- a/plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/internal/http/HTTPAcceptor.java
+++ /dev/null
@@ -1,254 +0,0 @@
-/***************************************************************************
- * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
- * 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.connector.IConnector;
-import org.eclipse.net4j.http.IHTTPAcceptor;
-import org.eclipse.net4j.http.IHTTPConnector;
-import org.eclipse.net4j.http.INet4jTransportServlet;
-import org.eclipse.net4j.internal.http.bundle.OM;
-import org.eclipse.net4j.internal.util.lifecycle.Worker;
-import org.eclipse.net4j.internal.util.om.trace.ContextTracer;
-import org.eclipse.net4j.util.StringUtil;
-import org.eclipse.net4j.util.io.ExtendedDataInputStream;
-import org.eclipse.net4j.util.io.ExtendedDataOutputStream;
-import org.eclipse.net4j.util.security.IRandomizer;
-
-import org.eclipse.internal.net4j.acceptor.Acceptor;
-import org.eclipse.internal.net4j.connector.Connector;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author Eike Stepper
- */
-public class HTTPAcceptor extends Acceptor implements IHTTPAcceptor, INet4jTransportServlet.RequestHandler
-{
- public static final int DEFAULT_CONNECTOR_ID_LENGTH = 32;
-
- public static final int DEFAULT_MAX_IDLE_TIME = 60 * 1000; // 1 minute
-
- private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG, HTTPAcceptor.class);
-
- private IRandomizer randomizer;
-
- private INet4jTransportServlet servlet;
-
- private int connectorIDLength = DEFAULT_CONNECTOR_ID_LENGTH;
-
- private int maxIdleTime = DEFAULT_MAX_IDLE_TIME;
-
- private Map<String, HTTPServerConnector> httpConnectors = new HashMap<String, HTTPServerConnector>();
-
- private Worker cleaner = new Worker()
- {
- @Override
- protected void work(WorkContext context) throws Exception
- {
- int pause = cleanIdleConnectors();
- context.nextWork(pause);
- }
- };
-
- public HTTPAcceptor()
- {
- }
-
- public IRandomizer getRandomizer()
- {
- return randomizer;
- }
-
- public void setRandomizer(IRandomizer randomizer)
- {
- this.randomizer = randomizer;
- }
-
- public INet4jTransportServlet getServlet()
- {
- return servlet;
- }
-
- public void setServlet(INet4jTransportServlet servlet)
- {
- if (this.servlet != null)
- {
- this.servlet.setRequestHandler(null);
- }
-
- this.servlet = servlet;
- servlet.setRequestHandler(this);
- }
-
- public int getConnectorIDLength()
- {
- return connectorIDLength;
- }
-
- public void setConnectorIDLength(int connectorIDLength)
- {
- this.connectorIDLength = connectorIDLength;
- }
-
- public int getMaxIdleTime()
- {
- return maxIdleTime;
- }
-
- public void setMaxIdleTime(int maxIdleTime)
- {
- this.maxIdleTime = maxIdleTime;
- }
-
- public IHTTPConnector[] getHTTPConnectors()
- {
- List<IHTTPConnector> result = new ArrayList<IHTTPConnector>();
- for (IConnector acceptedConnector : getAcceptedConnectors())
- {
- IHTTPConnector connector = (IHTTPConnector)acceptedConnector;
- result.add(connector);
- }
-
- return result.toArray(new IHTTPConnector[result.size()]);
- }
-
- public IHTTPConnector[] handleList(String connectorID)
- {
- if (StringUtil.isEmpty(connectorID))
- {
- return getHTTPConnectors();
- }
-
- return new IHTTPConnector[] { httpConnectors.get(connectorID) };
- }
-
- public IHTTPConnector handleConnect(String userID)
- {
- String connectorID = createConnectorID(userID);
- HTTPServerConnector connector = createServerConnector();
- prepareConnector(connector);
- connector.setConnectorID(connectorID);
- connector.setUserID(userID);
- addConnector(connector);
- connector.activate();
-
- return connector;
- }
-
- public void handleDisonnect(String connectorID)
- {
- HTTPConnector connector = httpConnectors.get(connectorID);
- if (connector == null)
- {
- throw new IllegalArgumentException("Invalid connectorID: " + connectorID);
- }
-
- connector.deactivate();
- }
-
- public void handleOperations(String connectorID, ExtendedDataInputStream in, ExtendedDataOutputStream out)
- throws IOException
- {
- HTTPServerConnector connector = httpConnectors.get(connectorID);
- if (connector == null)
- {
- throw new IllegalArgumentException("Invalid connectorID: " + connectorID);
- }
-
- connector.readInputOperations(in);
- connector.writeOutputOperations(out);
- }
-
- @Override
- public String toString()
- {
- return "HTTPAcceptor";
- }
-
- @Override
- public void addConnector(Connector connector)
- {
- super.addConnector(connector);
- HTTPServerConnector httpConnector = (HTTPServerConnector)connector;
- httpConnectors.put(httpConnector.getConnectorID(), httpConnector);
- }
-
- @Override
- public void removeConnector(IConnector connector)
- {
- HTTPConnector httpConnector = (HTTPConnector)connector;
- httpConnectors.remove(httpConnector.getConnectorID());
- super.removeConnector(connector);
- }
-
- @Override
- protected void doBeforeActivate() throws Exception
- {
- super.doBeforeActivate();
- checkState(randomizer, "randomizer");
- checkState(connectorIDLength > 0, "Constraint violated: connectorIDLength > 0");
- checkState(maxIdleTime >= 100, "Constraint violated: maxIdleTime >= 100");
- }
-
- @Override
- protected void doActivate() throws Exception
- {
- super.doActivate();
- cleaner.setDaemon(true);
- cleaner.activate();
- }
-
- @Override
- protected void doDeactivate() throws Exception
- {
- cleaner.deactivate();
- super.doDeactivate();
- }
-
- protected String createConnectorID(String userID)
- {
- return randomizer.nextString(connectorIDLength, "0123456789ABCDEF");
- }
-
- protected HTTPServerConnector createServerConnector()
- {
- return new HTTPServerConnector(this);
- }
-
- protected int cleanIdleConnectors()
- {
- long now = System.currentTimeMillis();
- IConnector[] connectors = getAcceptedConnectors();
- if (TRACER.isEnabled())
- {
- TRACER.format("Checking {0} HTTP server connectors for idle time: {1,time}", connectors.length, new Date());
- }
-
- for (IConnector connector : connectors)
- {
- HTTPServerConnector serverConnector = (HTTPServerConnector)connector;
- long lastTraffic = serverConnector.getLastTraffic();
- long idleTime = now - lastTraffic;
- if (idleTime > maxIdleTime)
- {
- serverConnector.deactivate();
- OM.LOG.info("Deactivated idle HTTP server connector: " + serverConnector);
- }
- }
-
- return maxIdleTime;
- }
-}
diff --git a/plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/internal/http/HTTPAcceptorFactory.java b/plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/internal/http/HTTPAcceptorFactory.java
deleted file mode 100644
index 12a830f..0000000
--- a/plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/internal/http/HTTPAcceptorFactory.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/***************************************************************************
- * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
- * 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.internal.net4j.acceptor.AcceptorFactory;
-
-/**
- * @author Eike Stepper
- */
-public class HTTPAcceptorFactory extends AcceptorFactory
-{
- public static final String TYPE = "http";
-
- public HTTPAcceptorFactory()
- {
- super(TYPE);
- }
-
- public HTTPAcceptor create(String description)
- {
- HTTPAcceptor acceptor = new HTTPAcceptor();
- return acceptor;
- }
-
- @Override
- public String getDescriptionFor(Object object)
- {
- return null;
- }
-}
diff --git a/plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/internal/http/HTTPChannel.java b/plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/internal/http/HTTPChannel.java
deleted file mode 100644
index 804d642..0000000
--- a/plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/internal/http/HTTPChannel.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/***************************************************************************
- * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
- * 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.internal.http.HTTPConnector.ChannelOperation;
-
-import org.eclipse.internal.net4j.channel.Channel;
-
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.CountDownLatch;
-
-/**
- * @author Eike Stepper
- */
-public class HTTPChannel extends Channel
-{
- private long outputOperationCount = 1;// Open channel was 0 implicitely
-
- private long inputOperationCount;
-
- private Map<Long, ChannelOperation> inputOperationQuarantine = new ConcurrentHashMap<Long, ChannelOperation>();
-
- private CountDownLatch openAck = new CountDownLatch(1);
-
- private boolean inverseRemoved;
-
- public HTTPChannel()
- {
- }
-
- public long getOutputOperationCount()
- {
- return outputOperationCount;
- }
-
- public void increaseOutputOperationCount()
- {
- ++outputOperationCount;
- }
-
- public long getInputOperationCount()
- {
- return inputOperationCount;
- }
-
- public void increaseInputOperationCount()
- {
- ++inputOperationCount;
- }
-
- public void quarantineInputOperation(long count, ChannelOperation operation)
- {
- inputOperationQuarantine.put(count, operation);
- }
-
- public ChannelOperation getQuarantinedInputOperation(long count)
- {
- return inputOperationQuarantine.remove(count);
- }
-
- public void openAck()
- {
- openAck.countDown();
- }
-
- public void waitForOpenAck()
- {
- try
- {
- openAck.await();
- }
- catch (InterruptedException ignore)
- {
- }
- }
-
- public boolean isInverseRemoved()
- {
- return inverseRemoved;
- }
-
- public void setInverseRemoved()
- {
- inverseRemoved = true;
- }
-
- @Override
- protected void doDeactivate() throws Exception
- {
- for (ChannelOperation operation : inputOperationQuarantine.values())
- {
- operation.dispose();
- }
-
- inputOperationQuarantine.clear();
- super.doDeactivate();
- }
-}
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 9775e05..95784d4 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
@@ -12,6 +12,7 @@ package org.eclipse.net4j.internal.http;
import org.eclipse.net4j.channel.IChannel;
import org.eclipse.net4j.connector.ConnectorLocation;
+import org.eclipse.net4j.http.internal.common.HTTPConnector;
import org.eclipse.net4j.internal.util.lifecycle.Worker;
import org.eclipse.net4j.util.io.ExtendedDataInputStream;
import org.eclipse.net4j.util.io.ExtendedDataOutputStream;
@@ -150,7 +151,7 @@ public class HTTPClientConnector extends HTTPConnector
{
public void handleOut(ExtendedDataOutputStream out) throws IOException
{
- out.writeByte(Net4jTransportServlet.OPCODE_CONNECT);
+ out.writeByte(OPCODE_CONNECT);
out.writeString(getUserID());
}
@@ -172,7 +173,7 @@ public class HTTPClientConnector extends HTTPConnector
@Override
public void handleOut(ExtendedDataOutputStream out) throws IOException
{
- out.writeByte(Net4jTransportServlet.OPCODE_DISCONNECT);
+ out.writeByte(OPCODE_DISCONNECT);
out.writeString(getConnectorID());
}
});
@@ -219,7 +220,7 @@ public class HTTPClientConnector extends HTTPConnector
{
public void handleOut(ExtendedDataOutputStream out) throws IOException
{
- out.writeByte(Net4jTransportServlet.OPCODE_OPERATIONS);
+ out.writeByte(OPCODE_OPERATIONS);
out.writeString(getConnectorID());
moreOperations[0] = writeOutputOperations(out);
}
diff --git a/plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/internal/http/HTTPConnector.java b/plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/internal/http/HTTPConnector.java
deleted file mode 100644
index 71ed9bc..0000000
--- a/plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/internal/http/HTTPConnector.java
+++ /dev/null
@@ -1,551 +0,0 @@
-/***************************************************************************
- * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
- * 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.buffer.IBuffer;
-import org.eclipse.net4j.channel.IChannel;
-import org.eclipse.net4j.connector.ConnectorException;
-import org.eclipse.net4j.http.IHTTPConnector;
-import org.eclipse.net4j.internal.http.bundle.OM;
-import org.eclipse.net4j.internal.util.om.trace.ContextTracer;
-import org.eclipse.net4j.protocol.IProtocol;
-import org.eclipse.net4j.util.io.ExtendedDataInputStream;
-import org.eclipse.net4j.util.io.ExtendedDataOutputStream;
-import org.eclipse.net4j.util.security.INegotiationContext;
-
-import org.eclipse.internal.net4j.buffer.Buffer;
-import org.eclipse.internal.net4j.channel.Channel;
-import org.eclipse.internal.net4j.connector.Connector;
-
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.util.Queue;
-import java.util.concurrent.ConcurrentLinkedQueue;
-
-/**
- * @author Eike Stepper
- */
-public abstract class HTTPConnector extends Connector implements IHTTPConnector
-{
- private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG, HTTPConnector.class);
-
- private static final byte OPERATION_NONE = 0;
-
- private static final byte OPERATION_OPEN = 1;
-
- private static final byte OPERATION_OPEN_ACK = 2;
-
- private static final byte OPERATION_CLOSE = 3;
-
- private static final byte OPERATION_BUFFER = 4;
-
- private String connectorID;
-
- private transient Queue<ChannelOperation> outputOperations = new ConcurrentLinkedQueue<ChannelOperation>();
-
- private transient long lastTraffic;
-
- public HTTPConnector()
- {
- markLastTraffic();
- }
-
- public String getConnectorID()
- {
- return connectorID;
- }
-
- public void setConnectorID(String connectorID)
- {
- this.connectorID = connectorID;
- }
-
- public Queue<ChannelOperation> getOutputQueue()
- {
- return outputOperations;
- }
-
- public long getLastTraffic()
- {
- return lastTraffic;
- }
-
- private void markLastTraffic()
- {
- lastTraffic = System.currentTimeMillis();
- }
-
- public void multiplexChannel(IChannel channel)
- {
- IBuffer buffer;
- long outputOperationCount;
-
- HTTPChannel httpChannel = (HTTPChannel)channel;
- synchronized (httpChannel)
- {
- Queue<IBuffer> channelQueue = httpChannel.getSendQueue();
- buffer = channelQueue.poll();
- outputOperationCount = httpChannel.getOutputOperationCount();
- httpChannel.increaseOutputOperationCount();
- }
-
- if (TRACER.isEnabled())
- {
- TRACER.format("Multiplexing {0} (count={1})", ((Buffer)buffer).formatContent(true), outputOperationCount);
- }
-
- outputOperations.add(new BufferChannelOperation(httpChannel.getChannelIndex(), outputOperationCount, buffer));
- }
-
- /**
- * Writes operations from the {@link #outputOperations} to the passed stream. After each written operation
- * {@link #writeMoreOperations()} is asked whether to send more operations.
- *
- * @return <code>true</code> if more operations are in the {@link #outputOperations}, <code>false</code> otherwise.
- */
- public boolean writeOutputOperations(ExtendedDataOutputStream out) throws IOException
- {
- do
- {
- ChannelOperation operation = outputOperations.poll();
- if (operation == null && pollAgain())
- {
- operation = outputOperations.poll();
- }
-
- if (operation == null)
- {
- break;
- }
-
- operation.write(out);
- markLastTraffic();
- } while (writeMoreOperations());
-
- out.writeByte(OPERATION_NONE);
- return !outputOperations.isEmpty();
- }
-
- public void readInputOperations(ExtendedDataInputStream in) throws IOException
- {
- for (;;)
- {
- ChannelOperation operation;
- byte code = in.readByte();
- switch (code)
- {
- case OPERATION_OPEN:
- operation = new OpenChannelOperation(in);
- break;
-
- case OPERATION_OPEN_ACK:
- operation = new OpenAckChannelOperation(in);
- break;
-
- case OPERATION_CLOSE:
- operation = new CloseChannelOperation(in);
- break;
-
- case OPERATION_BUFFER:
- operation = new BufferChannelOperation(in);
- break;
-
- case OPERATION_NONE:
- return;
-
- default:
- throw new IOException("Invalid operation code: " + code);
- }
-
- markLastTraffic();
- operation.execute();
- }
- }
-
- @Override
- protected INegotiationContext createNegotiationContext()
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- protected Channel createChannelInstance()
- {
- return new HTTPChannel();
- }
-
- @Override
- protected void registerChannelWithPeer(final int channelID, final short channelIndex, final IProtocol protocol)
- throws ConnectorException
- {
- ChannelOperation operation = new OpenChannelOperation(channelIndex, channelID, protocol.getType());
- outputOperations.add(operation);
-
- HTTPChannel channel = (HTTPChannel)getChannel(channelIndex);
- channel.waitForOpenAck();
- }
-
- @Override
- public boolean removeChannel(IChannel channel)
- {
- if (super.removeChannel(channel))
- {
- HTTPChannel httpChannel = (HTTPChannel)channel;
- if (!httpChannel.isInverseRemoved())
- {
- ChannelOperation operation = new CloseChannelOperation(httpChannel);
- outputOperations.add(operation);
- }
-
- return true;
- }
-
- return false;
- }
-
- protected boolean pollAgain()
- {
- return false;
- }
-
- protected boolean writeMoreOperations()
- {
- return true;
- }
-
- /**
- * @author Eike Stepper
- */
- public abstract class ChannelOperation
- {
- private short channelIndex;
-
- private long operationCount;
-
- public ChannelOperation(short channelIndex, long operationCount)
- {
- this.channelIndex = channelIndex;
- this.operationCount = operationCount;
- }
-
- public ChannelOperation(ExtendedDataInputStream in) throws IOException
- {
- System.out.println("READING " + getClass().getName());
- channelIndex = in.readShort();
- operationCount = in.readLong();
- }
-
- public void write(ExtendedDataOutputStream out) throws IOException
- {
- System.out.println("WRITING " + getClass().getName());
- out.writeByte(getOperation());
- out.writeShort(channelIndex);
- out.writeLong(operationCount);
- }
-
- public abstract byte getOperation();
-
- public short getChannelIndex()
- {
- return channelIndex;
- }
-
- public long getOperationCount()
- {
- return operationCount;
- }
-
- public void execute()
- {
- HTTPChannel channel = (HTTPChannel)getChannel(getChannelIndex());
- long operationCount = getOperationCount();
- synchronized (channel)
- {
- // Execute preceding operations if necessary
- while (operationCount < channel.getInputOperationCount())
- {
- ChannelOperation operation = channel.getQuarantinedInputOperation(channel.getInputOperationCount());
- if (operation != null)
- {
- operation.doEexecute(channel);
- channel.increaseInputOperationCount();
- }
- else
- {
- break;
- }
- }
-
- if (operationCount == channel.getInputOperationCount())
- {
- // Execute operation if possible
- doEexecute(channel);
- channel.increaseInputOperationCount();
-
- // Execute following operations if possible
- for (;;)
- {
- ChannelOperation operation = channel.getQuarantinedInputOperation(++operationCount);
- if (operation != null)
- {
- operation.doEexecute(channel);
- channel.increaseInputOperationCount();
- }
- else
- {
- break;
- }
- }
- }
- else
- {
- channel.quarantineInputOperation(operationCount, this);
- }
- }
- }
-
- public abstract void doEexecute(HTTPChannel channel);
-
- public void dispose()
- {
- }
- }
-
- /**
- * @author Eike Stepper
- */
- private final class OpenChannelOperation extends ChannelOperation
- {
- private int channelID;
-
- private String protocolID;
-
- public OpenChannelOperation(short channelIndex, int channelID, String protocolID)
- {
- super(channelIndex, 0);
- this.channelID = channelID;
- this.protocolID = protocolID;
- }
-
- public OpenChannelOperation(ExtendedDataInputStream in) throws IOException
- {
- super(in);
- channelID = in.readInt();
- protocolID = in.readString();
- }
-
- @Override
- public void write(ExtendedDataOutputStream out) throws IOException
- {
- super.write(out);
- out.writeInt(channelID);
- out.writeString(protocolID);
- }
-
- @Override
- public byte getOperation()
- {
- return OPERATION_OPEN;
- }
-
- public int getChannelID()
- {
- return channelID;
- }
-
- public String getProtocolID()
- {
- return protocolID;
- }
-
- @Override
- public void execute()
- {
- HTTPChannel channel = (HTTPChannel)createChannel(channelID, getChannelIndex(), protocolID);
- if (channel == null)
- {
- throw new IllegalStateException("Could not open channel");
- }
-
- channel.increaseInputOperationCount();
- doEexecute(channel);
- }
-
- @Override
- public void doEexecute(HTTPChannel channel)
- {
- boolean success = false;
- try
- {
- channel.activate();
- success = true;
- }
- finally
- {
- ChannelOperation operation = new OpenAckChannelOperation(getChannelIndex(), success);
- outputOperations.add(operation);
- }
- }
- }
-
- /**
- * @author Eike Stepper
- */
- private final class OpenAckChannelOperation extends ChannelOperation
- {
- private boolean success;
-
- public OpenAckChannelOperation(short channelIndex, boolean success)
- {
- super(channelIndex, 0);
- this.success = success;
- }
-
- public OpenAckChannelOperation(ExtendedDataInputStream in) throws IOException
- {
- super(in);
- success = in.readBoolean();
- }
-
- @Override
- public void write(ExtendedDataOutputStream out) throws IOException
- {
- super.write(out);
- out.writeBoolean(success);
- }
-
- @Override
- public byte getOperation()
- {
- return OPERATION_OPEN_ACK;
- }
-
- @Override
- public void doEexecute(HTTPChannel channel)
- {
- channel.openAck();
- }
- }
-
- /**
- * @author Eike Stepper
- */
- private final class CloseChannelOperation extends ChannelOperation
- {
- public CloseChannelOperation(HTTPChannel channel)
- {
- super(channel.getChannelIndex(), channel.getOutputOperationCount());
- channel.increaseOutputOperationCount();
- }
-
- public CloseChannelOperation(ExtendedDataInputStream in) throws IOException
- {
- super(in);
- }
-
- @Override
- public byte getOperation()
- {
- return OPERATION_CLOSE;
- }
-
- @Override
- public void doEexecute(HTTPChannel channel)
- {
- // TODO Fix protocol between Channel.close and Connector.removeChannel/inverserRemoveChannel
- channel.setInverseRemoved();
- inverseRemoveChannel(channel.getChannelID(), channel.getChannelIndex());
- }
- }
-
- /**
- * @author Eike Stepper
- */
- private final class BufferChannelOperation extends ChannelOperation
- {
- private IBuffer buffer;
-
- public BufferChannelOperation(short channelIndex, long operationCount, IBuffer buffer)
- {
- super(channelIndex, operationCount);
- this.buffer = buffer;
- }
-
- public BufferChannelOperation(ExtendedDataInputStream in) throws IOException
- {
- super(in);
- int length = in.readShort();
-
- buffer = getBufferProvider().provideBuffer();
- ByteBuffer byteBuffer = buffer.startPutting(getChannelIndex());
- for (int i = 0; i < length; i++)
- {
- byte b = in.readByte();
- System.out.println("READ " + b);
- byteBuffer.put(b);
- }
-
- buffer.flip();
- }
-
- @Override
- public void write(ExtendedDataOutputStream out) throws IOException
- {
- super.write(out);
-
- buffer.flip();
- ByteBuffer byteBuffer = buffer.getByteBuffer();
- byteBuffer.position(IBuffer.HEADER_SIZE);
-
- int length = byteBuffer.limit() - byteBuffer.position();
- out.writeShort(length);
-
- for (int i = 0; i < length; i++)
- {
- byte b = byteBuffer.get();
- System.out.println("WRITE " + b);
- out.writeByte(b);
- }
-
- buffer.release();
- }
-
- @Override
- public byte getOperation()
- {
- return OPERATION_BUFFER;
- }
-
- public IBuffer getBuffer()
- {
- return buffer;
- }
-
- @Override
- public void doEexecute(HTTPChannel channel)
- {
- channel.handleBufferFromMultiplexer(buffer);
- buffer = null;
- }
-
- @Override
- public void dispose()
- {
- if (buffer != null)
- {
- buffer.release();
- buffer = null;
- }
-
- super.dispose();
- }
- }
-}
diff --git a/plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/internal/http/HTTPServerConnector.java b/plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/internal/http/HTTPServerConnector.java
deleted file mode 100644
index 2f11c3d..0000000
--- a/plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/internal/http/HTTPServerConnector.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/***************************************************************************
- * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
- * 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.connector.ConnectorException;
-import org.eclipse.net4j.connector.ConnectorLocation;
-import org.eclipse.net4j.protocol.IProtocol;
-
-import java.text.MessageFormat;
-
-/**
- * @author Eike Stepper
- */
-public class HTTPServerConnector extends HTTPConnector
-{
- private HTTPAcceptor acceptor;
-
- public HTTPServerConnector(HTTPAcceptor acceptor)
- {
- this.acceptor = acceptor;
- }
-
- public HTTPAcceptor getAcceptor()
- {
- return acceptor;
- }
-
- public ConnectorLocation getLocation()
- {
- return ConnectorLocation.SERVER;
- }
-
- public String getURL()
- {
- return "agent://connector:" + getConnectorID();
- }
-
- public int getMaxIdleTime()
- {
- return acceptor.getMaxIdleTime();
- }
-
- @Override
- public String toString()
- {
- if (getUserID() == null)
- {
- return MessageFormat.format("HTTPServerConnector[{0}]", getConnectorID()); //$NON-NLS-1$
- }
-
- return MessageFormat.format("HTTPServerConnector[{1}@{0}]", getConnectorID(), getUserID()); //$NON-NLS-1$
- }
-
- @Override
- protected void doActivate() throws Exception
- {
- super.doActivate();
- leaveConnecting();
- }
-
- @Override
- protected void registerChannelWithPeer(int channelID, short channelIndex, IProtocol protocol)
- throws ConnectorException
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- protected boolean pollAgain()
- {
- try
- {
- Thread.sleep(100);
- return true;
- }
- catch (InterruptedException ex)
- {
- return false;
- }
- }
-}
diff --git a/plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/internal/http/Net4jTransportServlet.java b/plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/internal/http/Net4jTransportServlet.java
deleted file mode 100644
index d503aea..0000000
--- a/plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/internal/http/Net4jTransportServlet.java
+++ /dev/null
@@ -1,249 +0,0 @@
-/***************************************************************************
- * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
- * 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.buffer.IBufferHandler;
-import org.eclipse.net4j.channel.IChannel;
-import org.eclipse.net4j.http.IHTTPConnector;
-import org.eclipse.net4j.http.INet4jTransportServlet;
-import org.eclipse.net4j.internal.http.bundle.OM;
-import org.eclipse.net4j.protocol.IProtocol;
-import org.eclipse.net4j.util.container.IPluginContainer;
-import org.eclipse.net4j.util.io.ExtendedDataInputStream;
-import org.eclipse.net4j.util.io.ExtendedDataOutputStream;
-
-import org.eclipse.internal.net4j.acceptor.AcceptorFactory;
-
-import javax.servlet.ServletException;
-import javax.servlet.ServletInputStream;
-import javax.servlet.ServletOutputStream;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import java.io.IOException;
-import java.io.PrintWriter;
-
-/**
- * @author Eike Stepper
- */
-public class Net4jTransportServlet extends HttpServlet implements INet4jTransportServlet
-{
- public static final int OPCODE_CONNECT = 1;
-
- public static final int OPCODE_DISCONNECT = 2;
-
- public static final int OPCODE_OPERATIONS = 3;
-
- private static final long serialVersionUID = 1L;
-
- private RequestHandler requestHandler;
-
- public Net4jTransportServlet()
- {
- }
-
- public RequestHandler getRequestHandler()
- {
- return requestHandler;
- }
-
- public void setRequestHandler(RequestHandler requestHandler)
- {
- this.requestHandler = requestHandler;
- }
-
- @Override
- protected final void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
- {
- doPost(req, resp);
- }
-
- @Override
- protected final void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
- {
- doRequest(req, resp);
- }
-
- protected void doRequest(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
- {
- if (requestHandler == null)
- {
- throw new ServletException("No request handler installed");
- }
-
- String connectorID = req.getParameter("list");
- if (connectorID != null)
- {
- doList(connectorID, resp);
- return;
- }
-
- ServletInputStream servletInputStream = req.getInputStream();
- ExtendedDataInputStream in = new ExtendedDataInputStream(servletInputStream);
-
- ServletOutputStream servletOutputStream = resp.getOutputStream();
- ExtendedDataOutputStream out = new ExtendedDataOutputStream(servletOutputStream);
-
- int opcode = servletInputStream.read();
- switch (opcode)
- {
- case Net4jTransportServlet.OPCODE_CONNECT:
- doConnect(in, out);
- break;
-
- case Net4jTransportServlet.OPCODE_DISCONNECT:
- doDisconnect(in, out);
- break;
-
- case Net4jTransportServlet.OPCODE_OPERATIONS:
- doOperations(in, out);
- break;
-
- default:
- throw new IOException("Invalid opcaode: " + opcode);
- }
-
- out.flush();
- }
-
- protected void doList(String connectorID, HttpServletResponse resp) throws IOException
- {
- IHTTPConnector[] connectors = requestHandler.handleList(connectorID);
- PrintWriter writer = resp.getWriter();
- for (IHTTPConnector connector : connectors)
- {
- // TODO Security: Hide connectorID!
- writer.write(connector.getConnectorID());
- writer.write(":");
-
- String userID = connector.getUserID();
- if (userID != null)
- {
- writer.write(" userID=" + userID);
- }
-
- if (connector instanceof HTTPServerConnector)
- {
- long idleTime = System.currentTimeMillis() - ((HTTPServerConnector)connector).getLastTraffic();
- writer.write(" idleTime=" + idleTime);
- }
-
- writer.write("\n");
-
- for (IChannel channel : connector.getChannels())
- {
- writer.write(" ");
- writer.write(String.valueOf(channel.getChannelIndex()));
- writer.write(": ");
- IBufferHandler receiveHandler = channel.getReceiveHandler();
- if (receiveHandler instanceof IProtocol)
- {
- writer.write(((IProtocol)receiveHandler).getType());
- }
- else
- {
- String string = receiveHandler.toString();
- if (string.length() > 256)
- {
- string = string.substring(0, 256);
- }
-
- writer.write(string);
- }
-
- writer.write(" (");
- writer.write(String.valueOf(channel.getChannelID()));
- writer.write(")\n");
- }
- }
- }
-
- protected void doConnect(ExtendedDataInputStream in, ExtendedDataOutputStream out) throws ServletException,
- IOException
- {
- try
- {
- String userID = in.readString();
- IHTTPConnector connector = requestHandler.handleConnect(userID);
- out.writeString(connector.getConnectorID());
- out.writeInt(connector.getMaxIdleTime());
- }
- catch (Exception ex)
- {
- OM.LOG.error(ex);
- out.writeString(null);
- }
- }
-
- protected void doDisconnect(ExtendedDataInputStream in, ExtendedDataOutputStream out) throws ServletException,
- IOException
- {
- try
- {
- String connectorID = in.readString();
- requestHandler.handleDisonnect(connectorID);
- }
- catch (Exception ex)
- {
- OM.LOG.error(ex);
- }
- }
-
- protected void doOperations(ExtendedDataInputStream in, ExtendedDataOutputStream out) throws ServletException,
- IOException
- {
- String connectorID = in.readString();
- requestHandler.handleOperations(connectorID, in, out);
- }
-
- /**
- * @author Eike Stepper
- */
- public static class ContainerAware extends Net4jTransportServlet
- {
- private static final String ACCEPTORS_GROUP = AcceptorFactory.PRODUCT_GROUP;
-
- private static final String HTTP_TYPE = HTTPAcceptorFactory.TYPE;
-
- private static final long serialVersionUID = 1L;
-
- private HTTPAcceptor acceptor;
-
- public ContainerAware()
- {
- }
-
- @Override
- public void init() throws ServletException
- {
- super.init();
-
- acceptor = (HTTPAcceptor)IPluginContainer.INSTANCE.getElement(ACCEPTORS_GROUP, HTTP_TYPE, null);
- if (acceptor == null)
- {
- throw new ServletException("Acceptor not found");
- }
-
- acceptor.setServlet(this);
- setRequestHandler(acceptor);
- }
-
- @Override
- public void destroy()
- {
- setRequestHandler(null);
- acceptor.setServlet(null);
- acceptor = null;
- super.destroy();
- }
- }
-}
diff --git a/plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/internal/http/RandomizerInjector.java b/plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/internal/http/RandomizerInjector.java
deleted file mode 100644
index ac89791..0000000
--- a/plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/internal/http/RandomizerInjector.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/***************************************************************************
- * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
- * 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.util.container.IElementProcessor;
-import org.eclipse.net4j.util.container.IManagedContainer;
-import org.eclipse.net4j.util.security.IRandomizer;
-
-/**
- * @author Eike Stepper
- */
-public class RandomizerInjector implements IElementProcessor
-{
- public static final String TYPE = null;
-
- public RandomizerInjector()
- {
- }
-
- public Object process(IManagedContainer container, String productGroup, String factoryType, String description,
- Object element)
- {
- if (element instanceof HTTPAcceptor)
- {
- HTTPAcceptor acceptor = (HTTPAcceptor)element;
- if (acceptor.getRandomizer() == null)
- {
- acceptor.setRandomizer(getRandomizer(container));
- }
- }
-
- return element;
- }
-
- protected IRandomizer getRandomizer(IManagedContainer container)
- {
- return (IRandomizer)container.getElement("org.eclipse.net4j.randomizers", "default", TYPE);
- }
-}
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 063ac90..e480d3d 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
@@ -29,9 +29,6 @@ public abstract class OM
public static final OMTracer DEBUG = BUNDLE.tracer("debug"); //$NON-NLS-1$
- public static final int PROTOCOL_REGISTRATION_TIMEOUT = BUNDLE.getDebugSupport().getDebugOption(
- "protocol.registration.timeout", 10000); //$NON-NLS-1$
-
public static final OMLogger LOG = BUNDLE.logger();
/**
diff --git a/plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/internal/http/tests/HTTPTest.java b/plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/internal/http/tests/HTTPTest.java
deleted file mode 100644
index 52e5079..0000000
--- a/plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/internal/http/tests/HTTPTest.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/***************************************************************************
- * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
- * 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.tests;
-
-import org.eclipse.net4j.channel.IChannel;
-import org.eclipse.net4j.http.HTTPUtil;
-import org.eclipse.net4j.internal.http.HTTPClientConnector;
-import org.eclipse.net4j.tests.AbstractTransportTest;
-import org.eclipse.net4j.tests.signal.IntRequest;
-import org.eclipse.net4j.tests.signal.TestSignalClientProtocolFactory;
-import org.eclipse.net4j.tests.signal.TestSignalProtocol;
-import org.eclipse.net4j.util.container.IManagedContainer;
-import org.eclipse.net4j.util.io.ExtendedDataInputStream;
-
-import org.apache.commons.httpclient.HttpClient;
-import org.apache.commons.httpclient.methods.PostMethod;
-import org.apache.commons.httpclient.methods.RequestEntity;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-/**
- * @author Eike Stepper
- */
-public class HTTPTest extends AbstractTransportTest
-{
- public HTTPTest()
- {
- }
-
- @Override
- protected IManagedContainer createContainer()
- {
- IManagedContainer container = super.createContainer();
- HTTPUtil.prepareContainer(container);
- container.registerFactory(new TestSignalClientProtocolFactory());
- return container;
- }
-
- /**
- * Result: With the current implementation (HttpClient / Jetty) it's not possible to transfer request data before
- */
- public void _testRequestFlush() throws Exception
- {
- HttpClient client = new HttpClient();
- PostMethod method = new PostMethod("http://eike@localhost:8080/net4j/echotest");
- method.setRequestEntity(new RequestEntity()
- {
- public long getContentLength()
- {
- return -1;
- }
-
- public String getContentType()
- {
- return "application/octet-stream";
- }
-
- public boolean isRepeatable()
- {
- return false;
- }
-
- public void writeRequest(OutputStream out) throws IOException
- {
- int count = 10;
- out.write(count);
- for (int i = 0; i < count; i++)
- {
- send(out, i);
- }
- }
-
- private void send(OutputStream out, int b) throws IOException
- {
- try
- {
- msg("Writing " + b);
- out.write(b);
- out.flush();
- Thread.sleep(1000);
- }
- catch (InterruptedException ex)
- {
- throw new RuntimeException(ex);
- }
- }
- });
-
- client.executeMethod(method);
- InputStream responseBody = method.getResponseBodyAsStream();
- ExtendedDataInputStream in = new ExtendedDataInputStream(responseBody);
- int count = in.readInt();
- for (int i = 0; i < count; i++)
- {
- int b = in.readByte();
- assertEquals(i, b);
-
- long gap = in.readLong();
- msg("Gap: " + gap);
- }
-
- method.releaseConnection();
- }
-
- public void test1() throws Exception
- {
- HTTPClientConnector connector = getHTTPConnector();
- IChannel channel = connector.openChannel(TestSignalProtocol.PROTOCOL_NAME, null);
-
- IntRequest request = new IntRequest(channel, 305419896);
- int result = request.send();
- assertEquals(305419896, result);
-
- sleep(500);
- channel.close();
- sleep(500);
- connector.deactivate();
- }
-
- private HTTPClientConnector getHTTPConnector()
- {
- return (HTTPClientConnector)container.getElement("org.eclipse.net4j.connectors", "http",
- "http://eike@localhost:8080/net4j");
- }
-}
diff --git a/plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/internal/http/tests/Net4jEchoTestServlet.java b/plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/internal/http/tests/Net4jEchoTestServlet.java
deleted file mode 100644
index ecd4106..0000000
--- a/plugins/org.eclipse.net4j.http/src/org/eclipse/net4j/internal/http/tests/Net4jEchoTestServlet.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/***************************************************************************
- * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
- * 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.tests;
-
-import org.eclipse.net4j.util.io.ExtendedDataInputStream;
-import org.eclipse.net4j.util.io.ExtendedDataOutputStream;
-import org.eclipse.net4j.util.io.IOUtil;
-
-import javax.servlet.ServletException;
-import javax.servlet.ServletInputStream;
-import javax.servlet.ServletOutputStream;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import java.io.IOException;
-
-/**
- * @author Eike Stepper
- */
-public class Net4jEchoTestServlet extends HttpServlet
-{
- private static final long serialVersionUID = 1L;
-
- public Net4jEchoTestServlet()
- {
- }
-
- @Override
- protected final void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
- {
- doPost(req, resp);
- }
-
- @Override
- protected final void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
- {
- doRequest(req, resp);
- }
-
- protected void doRequest(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
- {
- ServletInputStream servletInputStream = req.getInputStream();
- ExtendedDataInputStream in = new ExtendedDataInputStream(servletInputStream);
-
- ServletOutputStream servletOutputStream = resp.getOutputStream();
- ExtendedDataOutputStream out = new ExtendedDataOutputStream(servletOutputStream);
-
- long lastTime = System.currentTimeMillis();
- int count = in.readByte();
- out.writeInt(count);
- for (int i = 0; i < count; i++)
- {
- byte b = in.readByte();
- long now = System.currentTimeMillis();
- long gap = now - lastTime;
- lastTime = now;
- IOUtil.OUT().println("Gap: " + gap);
-
- out.writeByte(b);
- out.writeLong(gap);
- out.flush();
- }
- }
-}