Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » Running Jetty as a Workbench service
Running Jetty as a Workbench service [message #105591] Thu, 28 February 2008 21:20 Go to next message
Eclipse User
Originally posted by: csmith.adcaustin.com

I would like to use the embedded Jetty server to provide a http interface to
a running eclipse workbench. I created two action sets using the plug-in
wizards that start and stop Jetty using the JettyConfigurator.startServer()
and JettyConfigurator.stopServer() methods. Jetty starts up and a browser
pointed to them seems to confirm that Jetty is running. This is where I run
out of steam.

I created a servlet and context extension points and classes but I do not
know how I make this Jetty instance use them.

As you can see I'm pretty green so advise is welcome.

My goal is to have a program outside of a running eclipse workbench be able
to ask the the eclipse workbench to perform some actions and return a
response.

Thanks in advance.
Re: Running Jetty as a Workbench service [message #105618 is a reply to message #105591] Fri, 29 February 2008 07:21 Go to previous messageGo to next message
Dennis O'Flynn is currently offline Dennis O'Flynn
Messages: 73
Registered: July 2009
Member
Assumptions:
* Your plugin has a dependency upon the "org.eclipse.equinox.http.registry"
* Your plugin proves an extensions to the
"org.eclipse.equinox.http.registry.servlets" extension point.
The default startup configuration for the IDE does not launch the equinox
http service by default. This needs to be added to the startup
configuration in "configuration/config.ini".

* Open "configuration/config.ini" in an editor
* Modify the property "osgi.bundles"
** Append ", org.eclipse.equinox.http@3:start,
org.eclipse.equinox.http.registry@start"

Optionally, you can change the port number (e.g. 3080) used by the http
service by define setting "org.osgi.service.http.port=3080".

You may have to restart your IDE w/ the "clean" option (eclipse -clean), for
your changes to the "osgi.bundles" property to take affect.


"Christopher Smith" <csmith@adcaustin.com> wrote in message
news:fq7q68$37h$1@build.eclipse.org...
>I would like to use the embedded Jetty server to provide a http interface
>to a running eclipse workbench. I created two action sets using the
>plug-in wizards that start and stop Jetty using the
>JettyConfigurator.startServer() and JettyConfigurator.stopServer() methods.
>Jetty starts up and a browser pointed to them seems to confirm that Jetty
>is running. This is where I run out of steam.
>
> I created a servlet and context extension points and classes but I do not
> know how I make this Jetty instance use them.
>
> As you can see I'm pretty green so advise is welcome.
>
> My goal is to have a program outside of a running eclipse workbench be
> able to ask the the eclipse workbench to perform some actions and return a
> response.
>
> Thanks in advance.
Re: Running Jetty as a Workbench service [message #105777 is a reply to message #105618] Sun, 02 March 2008 12:53 Go to previous messageGo to next message
Eclipse User
Originally posted by: csmith.adcaustin.com

Thanks

How would my plugin check to see if it is running, and if not get and start
the "service" instead of it being auto-started?



"Dennis O'Flynn" <dennis.oflynn@compuware.com> wrote in message
news:fq8tci$o47$1@build.eclipse.org...
> Assumptions:
> * Your plugin has a dependency upon the
> "org.eclipse.equinox.http.registry"
> * Your plugin proves an extensions to the
> "org.eclipse.equinox.http.registry.servlets" extension point.
> The default startup configuration for the IDE does not launch the equinox
> http service by default. This needs to be added to the startup
> configuration in "configuration/config.ini".
>
> * Open "configuration/config.ini" in an editor
> * Modify the property "osgi.bundles"
> ** Append ", org.eclipse.equinox.http@3:start,
> org.eclipse.equinox.http.registry@start"
>
> Optionally, you can change the port number (e.g. 3080) used by the http
> service by define setting "org.osgi.service.http.port=3080".
>
> You may have to restart your IDE w/ the "clean" option (eclipse -clean),
> for your changes to the "osgi.bundles" property to take affect.
>
>
Re: Running Jetty as a Workbench service [message #107474 is a reply to message #105618] Wed, 02 April 2008 17:39 Go to previous messageGo to next message
Eclipse User
Originally posted by: csmith.adcaustin.com

Just to followup, I reviewed how Eclipse help uses the embeded Jetty. I
mimiced it and it worked. My plugin explicitly starts and stops jetty from
a singleton.

The servlet then runs inside of my workbench and can interact with the
workbench as it receives requests.

Works great... and less filling too

"Dennis O'Flynn" <dennis.oflynn@compuware.com> wrote in message
news:fq8tci$o47$1@build.eclipse.org...
> Assumptions:
> * Your plugin has a dependency upon the
> "org.eclipse.equinox.http.registry"
> * Your plugin proves an extensions to the
> "org.eclipse.equinox.http.registry.servlets" extension point.
> The default startup configuration for the IDE does not launch the equinox
> http service by default. This needs to be added to the startup
> configuration in "configuration/config.ini".
>
> * Open "configuration/config.ini" in an editor
> * Modify the property "osgi.bundles"
> ** Append ", org.eclipse.equinox.http@3:start,
> org.eclipse.equinox.http.registry@start"
>
> Optionally, you can change the port number (e.g. 3080) used by the http
> service by define setting "org.osgi.service.http.port=3080".
>
> You may have to restart your IDE w/ the "clean" option (eclipse -clean),
> for your changes to the "osgi.bundles" property to take affect.
>
>
> "Christopher Smith" <csmith@adcaustin.com> wrote in message
> news:fq7q68$37h$1@build.eclipse.org...
>>I would like to use the embedded Jetty server to provide a http interface
>>to a running eclipse workbench. I created two action sets using the
>>plug-in wizards that start and stop Jetty using the
>>JettyConfigurator.startServer() and JettyConfigurator.stopServer()
>>methods. Jetty starts up and a browser pointed to them seems to confirm
>>that Jetty is running. This is where I run out of steam.
>>
>> I created a servlet and context extension points and classes but I do not
>> know how I make this Jetty instance use them.
>>
>> As you can see I'm pretty green so advise is welcome.
>>
>> My goal is to have a program outside of a running eclipse workbench be
>> able to ask the the eclipse workbench to perform some actions and return
>> a response.
>>
>> Thanks in advance.
>
>
Re: Running Jetty as a Workbench service [message #111789 is a reply to message #107474] Thu, 12 June 2008 04:57 Go to previous messageGo to next message
LoÃ?¯c QuÃ?©ran is currently offline LoÃ?¯c QuÃ?©ran
Messages: 45
Registered: July 2009
Member
I have written an Activator which starts Jetty and I want to register a
servlet which acts on the workspace.

Although I have registered my servlet throught the extension point,

<extension
point="org.eclipse.equinox.http.registry.servlets">
<servlet
alias="/MyServlet"
class="com.example.MyServlet">
</servlet>
</extension>

the servlet is not available.

Here is how I start Jetty:

Dictionary<String, Object> settings = new Hashtable<String, Object>();
settings.put("http.enabled", Boolean.TRUE);
settings.put("http.port", 8079);
settings.put("http.host", "0.0.0.0");
settings.put("https.enabled", Boolean.FALSE);
settings.put("context.path", "/");
settings.put("context.sessioninactiveinterval", 1800);
try
{
JettyConfigurator.startServer(PLUGIN_ID + ".server",
settings);
serverId = PLUGIN_ID + ".server";
}
catch (Exception e)
{
e.printStackTrace();
}

Any idea would be appreciated.

Loïc



Christopher Smith a écrit :
> Just to followup, I reviewed how Eclipse help uses the embeded Jetty. I
> mimiced it and it worked. My plugin explicitly starts and stops jetty
> from a singleton.
>
> The servlet then runs inside of my workbench and can interact with the
> workbench as it receives requests.
>
> Works great... and less filling too
>
> "Dennis O'Flynn" <dennis.oflynn@compuware.com> wrote in message
> news:fq8tci$o47$1@build.eclipse.org...
>> Assumptions:
>> * Your plugin has a dependency upon the
>> "org.eclipse.equinox.http.registry"
>> * Your plugin proves an extensions to the
>> "org.eclipse.equinox.http.registry.servlets" extension point.
>> The default startup configuration for the IDE does not launch the
>> equinox http service by default. This needs to be added to the
>> startup configuration in "configuration/config.ini".
>>
>> * Open "configuration/config.ini" in an editor
>> * Modify the property "osgi.bundles"
>> ** Append ", org.eclipse.equinox.http@3:start,
>> org.eclipse.equinox.http.registry@start"
>>
>> Optionally, you can change the port number (e.g. 3080) used by the
>> http service by define setting "org.osgi.service.http.port=3080".
>>
>> You may have to restart your IDE w/ the "clean" option (eclipse
>> -clean), for your changes to the "osgi.bundles" property to take affect.
>>
>>
>> "Christopher Smith" <csmith@adcaustin.com> wrote in message
>> news:fq7q68$37h$1@build.eclipse.org...
>>> I would like to use the embedded Jetty server to provide a http
>>> interface to a running eclipse workbench. I created two action sets
>>> using the plug-in wizards that start and stop Jetty using the
>>> JettyConfigurator.startServer() and JettyConfigurator.stopServer()
>>> methods. Jetty starts up and a browser pointed to them seems to
>>> confirm that Jetty is running. This is where I run out of steam.
>>>
>>> I created a servlet and context extension points and classes but I do
>>> not know how I make this Jetty instance use them.
>>>
>>> As you can see I'm pretty green so advise is welcome.
>>>
>>> My goal is to have a program outside of a running eclipse workbench
>>> be able to ask the the eclipse workbench to perform some actions and
>>> return a response.
>>>
>>> Thanks in advance.
>>
>>
>
Re: Running Jetty as a Workbench service [message #111810 is a reply to message #111789] Thu, 12 June 2008 10:08 Go to previous message
Simon Kaegi is currently offline Simon Kaegi
Messages: 381
Registered: July 2009
Senior Member
Hi Loic,

The org.eclipse.equinox.http.registry bundle has to be started. Can you
confirm that it is.

If not Help/UA uses the following code that you might embelish:
---
Bundle bundle = Platform.getBundle("org.eclipse.equinox.http.registry");

if (bundle.getState() == Bundle.RESOLVED) {

bundle.start(Bundle.START_TRANSIENT);

}

---

This will work but a better practice here would be to use PackageAdmin
instead of Platform to get the bundle.
-Simon

"Lo
Previous Topic:Class loading issues under Tomcat (Servlet Bridge)
Next Topic:[p2] headless update
Goto Forum:
  


Current Time: Sat Aug 30 16:38:15 EDT 2014

Powered by FUDForum. Page generated in 0.05825 seconds