Re: [jetty-user] Static content with authentication?

Arjun Panday <[email protected]> Thu, 23 Jun 2011 16:44:31 +0200
Newsgroups gmane.comp.java.jetty.support
Organization Alcatel-Lucent
Message-ID <[email protected]>
Ok, I got it.

I use a webapp context instead of the servlet context, and override the 
webdefault.xml to specify my security constraints.

<Configure class="org.mortbay.jetty.webapp.*WebAppContext*">
<Set name="contextPath">/doc</Set>
<Set name="war"><SystemProperty name="JETTY_HOME" default="."/>/doc</Set>
<Set name="extractWAR">false</Set>
<Set name="copyWebDir">false</Set>
<Set name="*overrideDescriptor*">webdefault.xml</Set>
</Configure>

/Arjun


On 06/22/2011 10:25 AM, Arjun Panday wrote:
> Hi all,
>
> I'm looking for way to configure the DefaultServlet used to serve static
> content on disk, so that it uses a form based authentication.
>
> Here's what I have:
> - an (embedded) jetty server, with 2 connectors: 1 private IP using
> regular HTTP, 1 public IP using HTTPS
> - some webapps are served on the public IP and require authentication
> - some webapps are served on the private IP and require no authentication
>
> So far so good, but my server is also used to serve static disk content
> (not packaged in webapps) and i need the same :
> - some static content is needed on the private IP without authent'
> - some static content is needed on the public IP with authent'
>
> I am able to serve the static content on the private IP by specifying
> the connector name as explained here
> http://docs.codehaus.org/display/JETTY/Static+Content and here
> http://wiki.eclipse.org/Jetty/Howto/WebappPerConnector
>
> But I can't find a way to specify the security-constraint and
> login-config for the public static content.
>
> Alternatively I could map the DefaultServlet from a webapp (so as to
> have a web.xml) but then how can I serve static content? Setting the
> resourceBase init-param to an absolute path doesn't seem to work (not to
> mention the use of an environment variable for the root path).
>
> I hope my question is clear and someone can help,
> Thanks,
> Arjun
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>      http://xircles.codehaus.org/manage_email
>
>
>