You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Renzo <re...@tecnotp.it> on 2014/06/27 10:06:29 UTC

how to retrieve the jetty server

Hi all,
I'm designing a Webdav application, using Felix and the HTTP service.
It's engineered as a servlet, where the Webdav part is done by Jakarta 
Slide.
So far, so good, it works fine by accepting HTTP requests.

Now, I would configure the embedded Jetty server to enable 
authentication. Basically, I want to configure the server through a 
custom web.xml containing security-constraint and alike.

The point here is that I cannot find any way to retrieve the Jetty 
server. I need it to apply a WebAppContext (setHandler), created at 
runtime according to web.xml contents.
Thanks for any suggestion,

Renzo


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: how to retrieve the jetty server

Posted by Renzo <re...@tecnotp.it>.
Thanks Bruce and Jan Willem, I already use an HTTPContext (with the 
whiteboard) for mime handling.
I will investigate further about handleSecurity.
The security stuff in web.xml involves several elements 
(security-constraint, login-config, security-role), so I just wonder 
whether I can replace all by playing with HTTPContext.

Btw, any suggestion to enforce basic authentication through a client 
popup - asking user/pwd ?
Thanks,

Renzo

On 27/06/2014 11:52, Bruce Jackson wrote:
> If you¹re using the http bundle inside Felix, you need to get a handle to
> the HttpService interface.
> This allows you to programatically bind servlets to the http server.
>
> Alternatively if you¹re using OSGi DS, you need to register and export
> components that implement javax.servlet.Servlet. These will be picked up
> by the Jetty and bound as servlets using the DS property ³alias² to point
> to your servlet path.
>
> If you wish to create a custom security context, the base way to do this
> is to create a components that implements
> org.osgi.service.http.HttpContext and register this with DS specifying the
> component property ³contextId². If you then add this same property (and
> value) to the servlet you wish to secure, the handleSecurity method of
> HttpContext will be called before when a request is made to your servlet,
> and you can implement whatever security/auth method you like.
>
> On 27/06/2014 09:06, "Renzo" <re...@tecnotp.it> wrote:
>
>> Hi all,
>> I'm designing a Webdav application, using Felix and the HTTP service.
>> It's engineered as a servlet, where the Webdav part is done by Jakarta
>> Slide.
>> So far, so good, it works fine by accepting HTTP requests.
>>
>> Now, I would configure the embedded Jetty server to enable
>> authentication. Basically, I want to configure the server through a
>> custom web.xml containing security-constraint and alike.
>>
>> The point here is that I cannot find any way to retrieve the Jetty
>> server. I need it to apply a WebAppContext (setHandler), created at
>> runtime according to web.xml contents.
>> Thanks for any suggestion,
>>
>> Renzo
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>>
> *** DISCLAIMER ***
>
> This message, including attachments, is intended solely for the addressee indicated in this message and is strictly confidential or otherwise privileged. If you are not the intended recipient (or responsible for delivery of the message to such person) : - (1) please immediately (i) notify the sender by reply email and (ii) delete this message and attachments, - (2) any use, copy or dissemination of this transmission is strictly prohibited. If you or your employer does not consent to Internet email messages of this kind, please advise Myriad Group AG by reply e-mail immediately. Opinions, conclusions and other information expressed in this message are not given or endorsed by Myriad Group AG unless otherwise indicated by an authorized representative independent of this message.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: how to retrieve the jetty server

Posted by Bruce Jackson <Br...@myriadgroup.com>.
If you¹re using the http bundle inside Felix, you need to get a handle to
the HttpService interface.
This allows you to programatically bind servlets to the http server.

Alternatively if you¹re using OSGi DS, you need to register and export
components that implement javax.servlet.Servlet. These will be picked up
by the Jetty and bound as servlets using the DS property ³alias² to point
to your servlet path.

If you wish to create a custom security context, the base way to do this
is to create a components that implements
org.osgi.service.http.HttpContext and register this with DS specifying the
component property ³contextId². If you then add this same property (and
value) to the servlet you wish to secure, the handleSecurity method of
HttpContext will be called before when a request is made to your servlet,
and you can implement whatever security/auth method you like.

On 27/06/2014 09:06, "Renzo" <re...@tecnotp.it> wrote:

>Hi all,
>I'm designing a Webdav application, using Felix and the HTTP service.
>It's engineered as a servlet, where the Webdav part is done by Jakarta
>Slide.
>So far, so good, it works fine by accepting HTTP requests.
>
>Now, I would configure the embedded Jetty server to enable
>authentication. Basically, I want to configure the server through a
>custom web.xml containing security-constraint and alike.
>
>The point here is that I cannot find any way to retrieve the Jetty
>server. I need it to apply a WebAppContext (setHandler), created at
>runtime according to web.xml contents.
>Thanks for any suggestion,
>
>Renzo
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>For additional commands, e-mail: users-help@felix.apache.org
>

*** DISCLAIMER ***

This message, including attachments, is intended solely for the addressee indicated in this message and is strictly confidential or otherwise privileged. If you are not the intended recipient (or responsible for delivery of the message to such person) : - (1) please immediately (i) notify the sender by reply email and (ii) delete this message and attachments, - (2) any use, copy or dissemination of this transmission is strictly prohibited. If you or your employer does not consent to Internet email messages of this kind, please advise Myriad Group AG by reply e-mail immediately. Opinions, conclusions and other information expressed in this message are not given or endorsed by Myriad Group AG unless otherwise indicated by an authorized representative independent of this message.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: how to retrieve the jetty server

Posted by Jan Willem Janssen <ja...@luminis.eu>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Renzo,

On 27/06/14 10:06, Renzo wrote:
> I'm designing a Webdav application, using Felix and the HTTP
> service. It's engineered as a servlet, where the Webdav part is
> done by Jakarta Slide. So far, so good, it works fine by accepting
> HTTP requests.
> 
> Now, I would configure the embedded Jetty server to enable 
> authentication. Basically, I want to configure the server through
> a custom web.xml containing security-constraint and alike.
> 
> The point here is that I cannot find any way to retrieve the Jetty 
> server. I need it to apply a WebAppContext (setHandler), created
> at runtime according to web.xml contents.

If you want to "just handle" security, then you wouldn't need to have
access to the Jetty server, you can simple register a custom
HttpContext implementation and associate those with your servlets. The
#handleSecurity method in your HttpContext implementation could do all
the authentication stuff.

Alternatively, you could look into the Web Application specification,
allowing you to provide a WAR (with some additional metadata) that can
be deployed into Felix HTTP.

HtH,

- -- 
Met vriendelijke groeten | Kind regards

Jan Willem Janssen | Software Architect
+31 631 765 814

/My world is revolving around PulseOn and Amdatu/

Luminis Technologies B.V.
J.C. Wilslaan 29
7313 HK   Apeldoorn
+31 88 586 46 30

http://www.luminis-technologies.com
http://www.luminis.eu

KvK (CoC) 09 16 28 93
BTW (VAT) NL8169.78.566.B.01
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBAgAGBQJTrTV5AAoJEKF/mP2eHDc4NLgP/3uAJ4vFl2reiI1lj60nFjNs
Wh4ISR5N++JkfSQUt+blVdv42WZPPyc/ZaOQdSdzwzJLViIYy6lru6l7WY+UB5W+
bzH9wM/HKpFlNk8BULYaZ5y1Wt98jjW67dMe4JejFWxWvB02kKduej+jW6TuujFF
m9mgGCt0R9Lc/EnBEvWKJf2biyONEDAyYRKL0CgMtrepHjJC03CTk5/++j6d8hk7
vIamopQ6r/vevR6P5SEdraOc5TJXehAVNNe7abnqLSsI/h/jsJlGCrzXCu4q4bHm
qcWp503hVjQqHswgO/HmJWfSOExSucmOw+TZn2wypk6HKQSe852eQB4mLLt40ZU5
0v6Up17ui5tHFWcLlgAw0FXNk4zjxPJKNS6eU05xhQpXuuaVQJx3F5tmZB3di/DO
M+KIbVnx3FehSpflBR808IrAYm5Nr/Ga/PZEW0k6lCzDVoMWnKkGe3TR82PC7ndz
Nc0N/VBOirrfJ98rRKADNN4Yv+6GIHxGdQbPvB7y6dcAlzatsA5OpJfEGxe/ZLf/
2DsR1CSUuqtWaUan4oimb8LhYzdQ5pCfY31HxQyo4/DgmtKJ0n90boa+Zn9Ju2Df
u9qONky0LY8oh8lhWG0aIeeoPJ/HoKm4vRnh5IP3aX4Bfp3P3irTuI8omuFT8Hhb
O7gwFy0suXT9WChZxWlJ
=Sqdc
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org