users@jersey.java.net

[Jersey] Re: docroot when using Grizzly2 server and ServletHandler

From: Farrukh Najmi <farrukh_at_wellfleetsoftware.com>
Date: Mon, 09 Jan 2012 12:09:09 -0500

Hi Alexey,

Thank you for offering to help. Before I do the fair amount of work to
create a standalone test case I thought to share observations below in
case it helps identify my problem:

    * If I do not call "serverConfiguration.addHttpHandler" on my
      HttpServer's configuration then I can get dynamic resources served
      by my jersey rest endpoint. This is the base line that has worked
      for a long time before I had need for static resources to be
      served by same servlet as jersey endpoint
    * If I call "serverConfiguration.addHttpHandler" on my HttpServer then:
          o If I specify a context path for the StaticHttpHandler that
            is different from the context path for the ServletHandler
            for the SpringServlet for my jersey rest endpoint then I am
            able to get static resources served by the
            StaticHttpHandler. However, then I am no longer able to get
            dynamic resources served by my jersey rest endpoint.
          o If I specify a context path for the StaticHttpHandler that
            is same as the context path for the ServletHandler for the
            SpringServlet for my jersey rest endpoint then I am not able
            to get static resources served by the StaticHttpHandler nor
            am I able to get dynamic resources served by my jersey rest
            endpoint.

See code fragment in my previous email for reference. It seems that if I
include it my email gets tagged as spam.

Can you give me a rough sketch of how I create my HttpServer such that:

    * The Grizzly2 server serves static resources (in my case javascript
      files) from some context path from my servlet
    * The Grizzly2 server serves dynamic HTML resources from my jersey
      rest endpoint that references the static javascript resources
      within <script> tags
    * The reference to static resources is relative to the dynamic
      resources rather than absolute

Thanks for your help.

-- 
Regards,
Farrukh Najmi
Web:http://www.wellfleetsoftware.com