Re: Static files with Wicket and OSGi

2010-03-24 Thread Ernesto Reinaldo Barreiro
I see two options:

1-Use Wicket default machinery for serving resources (see
IResourceSettings).
2-Mount a dedicated servlet: the same way you register wicket servlet.

Ernesto

On Wed, Mar 24, 2010 at 12:19 PM, Jaime Soriano Pastor 
jsorianopas...@gmail.com wrote:

 Hi,

 I register a wicket application in an OSGi http service using for that
 a WicketServlet with applicationClassName set to the name of my main
 application class. My problem now is that I don't know how to serve
 static files as CSS and so.
 Is there any place used by default to contain the static files?
 Could I mount a directory as a resource? How?
 Or should I configure the resource locator in some way?

 Many thanks in advance.


 Jaime.

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




Re: Static files with Wicket and OSGi

2010-03-24 Thread Pedro Santos
Put then in the top-level directory of a web module.

http://java.sun.com/javaee/5/docs/tutorial/doc/bnadx.html#bnadz

A web module has a specific structure. The top-level directory of a web
module is the *document root* of the application. The document root is where
JSP pages, *client-side* classes and archives, and static web resources,
such as images, are stored.

On Wed, Mar 24, 2010 at 8:34 AM, Ernesto Reinaldo Barreiro 
reier...@gmail.com wrote:

 I see two options:

 1-Use Wicket default machinery for serving resources (see
 IResourceSettings).
 2-Mount a dedicated servlet: the same way you register wicket servlet.

 Ernesto

 On Wed, Mar 24, 2010 at 12:19 PM, Jaime Soriano Pastor 
 jsorianopas...@gmail.com wrote:

  Hi,
 
  I register a wicket application in an OSGi http service using for that
  a WicketServlet with applicationClassName set to the name of my main
  application class. My problem now is that I don't know how to serve
  static files as CSS and so.
  Is there any place used by default to contain the static files?
  Could I mount a directory as a resource? How?
  Or should I configure the resource locator in some way?
 
  Many thanks in advance.
 
 
  Jaime.
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 




-- 
Pedro Henrique Oliveira dos Santos


Re: Static files with Wicket and OSGi

2010-03-24 Thread Ernesto Reinaldo Barreiro
*document root* on an OSGI environment?

Ernesto

On Wed, Mar 24, 2010 at 12:46 PM, Pedro Santos pedros...@gmail.com wrote:

 Put then in the top-level directory of a web module.

 http://java.sun.com/javaee/5/docs/tutorial/doc/bnadx.html#bnadz

 A web module has a specific structure. The top-level directory of a web
 module is the *document root* of the application. The document root is
 where
 JSP pages, *client-side* classes and archives, and static web resources,
 such as images, are stored.

 On Wed, Mar 24, 2010 at 8:34 AM, Ernesto Reinaldo Barreiro 
 reier...@gmail.com wrote:

  I see two options:
 
  1-Use Wicket default machinery for serving resources (see
  IResourceSettings).
  2-Mount a dedicated servlet: the same way you register wicket servlet.
 
  Ernesto
 
  On Wed, Mar 24, 2010 at 12:19 PM, Jaime Soriano Pastor 
  jsorianopas...@gmail.com wrote:
 
   Hi,
  
   I register a wicket application in an OSGi http service using for that
   a WicketServlet with applicationClassName set to the name of my main
   application class. My problem now is that I don't know how to serve
   static files as CSS and so.
   Is there any place used by default to contain the static files?
   Could I mount a directory as a resource? How?
   Or should I configure the resource locator in some way?
  
   Many thanks in advance.
  
  
   Jaime.
  
   -
   To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
   For additional commands, e-mail: users-h...@wicket.apache.org
  
  
 



 --
 Pedro Henrique Oliveira dos Santos



Re: Static files with Wicket and OSGi

2010-03-24 Thread Jaime Soriano Pastor
On Wed, Mar 24, 2010 at 12:57 PM, Ernesto Reinaldo Barreiro
reier...@gmail.com wrote:
 *document root* on an OSGI environment?

Yes, it's what I was just trying and it worked :)

Many thanks!

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Static files with Wicket and OSGi

2010-03-24 Thread Ernesto Reinaldo Barreiro
Are you using bridge servlet approach?

On Wed, Mar 24, 2010 at 12:59 PM, Jaime Soriano Pastor 
jsorianopas...@gmail.com wrote:

 On Wed, Mar 24, 2010 at 12:57 PM, Ernesto Reinaldo Barreiro
 reier...@gmail.com wrote:
  *document root* on an OSGI environment?
 
 Yes, it's what I was just trying and it worked :)

 Many thanks!

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




Re: Static files with Wicket and OSGi

2010-03-24 Thread Jaime Soriano Pastor
On Wed, Mar 24, 2010 at 1:05 PM, Ernesto Reinaldo Barreiro
reier...@gmail.com wrote:
 Are you using bridge servlet approach?

I don't think so... Is it needed to have several Servlets? I have only one.
What I do is to launch Apache Felix Http Jetty as implementation of
the OSGi HTTP service and register the wicket servlet from the
Activator on / using Apache Felix Http Whiteboard.

 On Wed, Mar 24, 2010 at 12:57 PM, Ernesto Reinaldo Barreiro
 reier...@gmail.com wrote:
  *document root* on an OSGI environment?
 
 Yes, it's what I was just trying and it worked :)

And.. I have just discovered that I can download any file in the
bundle (including .htmls, .classes...) as well as I can download the
CSSs...

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Static files with Wicket and OSGi

2010-03-24 Thread Ernesto Reinaldo Barreiro
Interesting but that is not the same as a document root as in mentioned
link. Isn't it? So, your document root is the root of the class-path?

Best,

Ernesto


On Wed, Mar 24, 2010 at 1:18 PM, Jaime Soriano Pastor 
jsorianopas...@gmail.com wrote:

 On Wed, Mar 24, 2010 at 1:05 PM, Ernesto Reinaldo Barreiro
 reier...@gmail.com wrote:
  Are you using bridge servlet approach?
 
 I don't think so... Is it needed to have several Servlets? I have only one.
 What I do is to launch Apache Felix Http Jetty as implementation of
 the OSGi HTTP service and register the wicket servlet from the
 Activator on / using Apache Felix Http Whiteboard.

  On Wed, Mar 24, 2010 at 12:57 PM, Ernesto Reinaldo Barreiro
  reier...@gmail.com wrote:
   *document root* on an OSGI environment?
  
  Yes, it's what I was just trying and it worked :)
 
 And.. I have just discovered that I can download any file in the
 bundle (including .htmls, .classes...) as well as I can download the
 CSSs...

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




Re: Static files with Wicket and OSGi

2010-03-24 Thread Ernesto Reinaldo Barreiro
Hi,

I have tried this with equinox and it works too. For instance I'm able to
read file

http://localhost:8080/hibernate.cfg.xml

which is on root of the class path. They are just served by
WicketServlet.fallback method.

Ernesto

On Wed, Mar 24, 2010 at 1:24 PM, Ernesto Reinaldo Barreiro 
reier...@gmail.com wrote:

 Interesting but that is not the same as a document root as in mentioned
 link. Isn't it? So, your document root is the root of the class-path?

 Best,

 Ernesto



 On Wed, Mar 24, 2010 at 1:18 PM, Jaime Soriano Pastor 
 jsorianopas...@gmail.com wrote:

 On Wed, Mar 24, 2010 at 1:05 PM, Ernesto Reinaldo Barreiro
 reier...@gmail.com wrote:
  Are you using bridge servlet approach?
 
 I don't think so... Is it needed to have several Servlets? I have only
 one.
 What I do is to launch Apache Felix Http Jetty as implementation of
 the OSGi HTTP service and register the wicket servlet from the
 Activator on / using Apache Felix Http Whiteboard.

  On Wed, Mar 24, 2010 at 12:57 PM, Ernesto Reinaldo Barreiro
  reier...@gmail.com wrote:
   *document root* on an OSGI environment?
  
  Yes, it's what I was just trying and it worked :)
 
 And.. I have just discovered that I can download any file in the
 bundle (including .htmls, .classes...) as well as I can download the
 CSSs...

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org





Re: Static files with Wicket and OSGi

2010-03-24 Thread Ernesto Reinaldo Barreiro
But it won't work if you mount the Servlet to something different than /.
E.g. mounting on /manager then

http://localhost:8080/manager/hibernate.cfg.xml

will not work. Just curious about what are the implications of mounting on
/ and what the OSGi specification says about this?

Ernesto

On Wed, Mar 24, 2010 at 1:33 PM, Ernesto Reinaldo Barreiro 
reier...@gmail.com wrote:

 Hi,

 I have tried this with equinox and it works too. For instance I'm able to
 read file

 http://localhost:8080/hibernate.cfg.xml

 which is on root of the class path. They are just served by
 WicketServlet.fallback method.

 Ernesto


 On Wed, Mar 24, 2010 at 1:24 PM, Ernesto Reinaldo Barreiro 
 reier...@gmail.com wrote:

 Interesting but that is not the same as a document root as in mentioned
 link. Isn't it? So, your document root is the root of the class-path?

 Best,

 Ernesto



 On Wed, Mar 24, 2010 at 1:18 PM, Jaime Soriano Pastor 
 jsorianopas...@gmail.com wrote:

 On Wed, Mar 24, 2010 at 1:05 PM, Ernesto Reinaldo Barreiro
 reier...@gmail.com wrote:
  Are you using bridge servlet approach?
 
 I don't think so... Is it needed to have several Servlets? I have only
 one.
 What I do is to launch Apache Felix Http Jetty as implementation of
 the OSGi HTTP service and register the wicket servlet from the
 Activator on / using Apache Felix Http Whiteboard.

  On Wed, Mar 24, 2010 at 12:57 PM, Ernesto Reinaldo Barreiro
  reier...@gmail.com wrote:
   *document root* on an OSGI environment?
  
  Yes, it's what I was just trying and it worked :)
 
 And.. I have just discovered that I can download any file in the
 bundle (including .htmls, .classes...) as well as I can download the
 CSSs...

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org






Re: Static files with Wicket and OSGi

2010-03-24 Thread Jaime Soriano Pastor
Weird, I have also tried to register the application on /foo instead
of on / and, as you said, I cannot access to static files.
I haven't seen anything special about root alias on OSGi specification
(only that is the only alias allowed to end with /)

Jaime.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Static files with Wicket and OSGi

2010-03-24 Thread Ernesto Reinaldo Barreiro
Haven't had time to check the specification but this behavior (mounting on
/) might pose a security risk as you can fetch invisible things form the
class path (e.g. configuration files containing sensitive information like
passwords). On the other hand I see HttpService class has a
registerResources method you could use to register static resources. Maybe
that is the one you need?

Ernesto



On Wed, Mar 24, 2010 at 2:59 PM, Jaime Soriano Pastor 
jsorianopas...@gmail.com wrote:

 Weird, I have also tried to register the application on /foo instead
 of on / and, as you said, I cannot access to static files.
 I haven't seen anything special about root alias on OSGi specification
 (only that is the only alias allowed to end with /)

 Jaime.

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




Re: Static files with Wicket and OSGi

2010-03-24 Thread Jaime Soriano Pastor
On Wed, Mar 24, 2010 at 3:08 PM, Ernesto Reinaldo Barreiro
reier...@gmail.com wrote:
 Haven't had time to check the specification but this behavior (mounting on
 /) might pose a security risk as you can fetch invisible things form the
 class path (e.g. configuration files containing sensitive information like
 passwords). On the other hand I see HttpService class has a
 registerResources method you could use to register static resources. Maybe
 that is the one you need?

I'm using Whiteboard to register the application, so I don't have
access to the HttpService, I have discovered that Pax implementation
of whiteboard [0] can also publish resources, so I can use that to
control where I publish the static content. Anyway I'd still have the
security risk if I register the application in /.

[0] - Pax Whiteboard Extender -
http://wiki.ops4j.org/display/paxweb/Whiteboard+Extender

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org