Simple disable jsps keep serving static resources.

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Simple disable jsps keep serving static resources.

sent2null@netzero.net
I am using the following code in a custom Threaded class that I wrote that uses a Jetty HttpServer object.

*********************code below

// Create a servlet container to handle jsp's    
               ServletHandler shandler = new ServletHandler();              
            // Map a servlet onto the container
            shandler.addServlet ("Dump","/Dump", "org.mortbay.servlet.Dump");
            //context.addServlet("Default","/","org.mortbay.jetty.servlet.Default");
           
            shandler.addServlet ("JSP", "*.jsp", "org.apache.jasper.servlet.JspServlet");
            shandler.addServlet ("JSP", "*.jSp", "org.apache.jasper.servlet.JspServlet");
            shandler.addServlet ("JSP", "*.jSP", "org.apache.jasper.servlet.JspServlet");
            shandler.addServlet ("JSP", "*.JSP", "org.apache.jasper.servlet.JspServlet");
            shandler.addServlet ("JSP", "*.Jsp", "org.apache.jasper.servlet.JspServlet");
            shandler.addServlet ("JSP", "*.JsP", "org.apache.jasper.servlet.JspServlet");
            shandler.addServlet ("JSP", "*.JSp", "org.apache.jasper.servlet.JspServlet");
            shandler.addServlet ("JSP", "*.jsP", "org.apache.jasper.servlet.JspServlet");
             
            context.addHandler(shandler);
 //doesn't work in 4.2.8           context.addHttpHandler (shandler);  
            //Set the resource base.
            context.setResourceBase(resourcepath);

**********************code above

This works perfectly for the contexts that I define afterward allowing them all to serve static and dynamic resources. However, I'd like to only serve dynamic resources for specific contexts, I wanted to add a conditional attribute to the code above that would toggle in or out the code needed to do this per context.

What is the line or lines that are needed to allow static only(no execute on jsp) serving of resources? I tried commenting out the jsp referencing lines above but for some reason the context is still execute a test jsp file placed in the directory.

Thanks in advance for any assistance anyone can provide.

Regards,

David


______________________________________________________________________
NetZero Is Giving Away $3,000 A Day!
Sign up for NetZero HiSpeed 3G with Instant On!
Visit http://www.netzero.com/3Gsweeps TODAY for your chance to win!



-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
jetty-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Simple disable jsps keep serving static resources.

Greg Wilkins-5

What type of context is it?

If it is a webapplicationContext, then it is probably running the defaultweb.xml
configuration and is thus adding the JSP servlet anyway.

make sure it is just a plain ServletContext that you are using.

cheers


[hidden email] wrote:

> I am using the following code in a custom Threaded class that I wrote that uses a Jetty HttpServer object.
>
> *********************code below
>
> // Create a servlet container to handle jsp's    
>                ServletHandler shandler = new ServletHandler();              
>             // Map a servlet onto the container
>             shandler.addServlet ("Dump","/Dump", "org.mortbay.servlet.Dump");
>             //context.addServlet("Default","/","org.mortbay.jetty.servlet.Default");
>            
>             shandler.addServlet ("JSP", "*.jsp", "org.apache.jasper.servlet.JspServlet");
>             shandler.addServlet ("JSP", "*.jSp", "org.apache.jasper.servlet.JspServlet");
>             shandler.addServlet ("JSP", "*.jSP", "org.apache.jasper.servlet.JspServlet");
>             shandler.addServlet ("JSP", "*.JSP", "org.apache.jasper.servlet.JspServlet");
>             shandler.addServlet ("JSP", "*.Jsp", "org.apache.jasper.servlet.JspServlet");
>             shandler.addServlet ("JSP", "*.JsP", "org.apache.jasper.servlet.JspServlet");
>             shandler.addServlet ("JSP", "*.JSp", "org.apache.jasper.servlet.JspServlet");
>             shandler.addServlet ("JSP", "*.jsP", "org.apache.jasper.servlet.JspServlet");
>              
>             context.addHandler(shandler);
>  //doesn't work in 4.2.8           context.addHttpHandler (shandler);  
>             //Set the resource base.
>             context.setResourceBase(resourcepath);
>
> **********************code above
>
> This works perfectly for the contexts that I define afterward allowing them all to serve static and dynamic resources. However, I'd like to only serve dynamic resources for specific contexts, I wanted to add a conditional attribute to the code above that would toggle in or out the code needed to do this per context.
>
> What is the line or lines that are needed to allow static only(no execute on jsp) serving of resources? I tried commenting out the jsp referencing lines above but for some reason the context is still execute a test jsp file placed in the directory.
>
> Thanks in advance for any assistance anyone can provide.
>
> Regards,
>
> David
>
>
> ______________________________________________________________________
> NetZero Is Giving Away $3,000 A Day!
> Sign up for NetZero HiSpeed 3G with Instant On!
> Visit http://www.netzero.com/3Gsweeps TODAY for your chance to win!
>
>
>
> -------------------------------------------------------
> SF.Net email is sponsored by:
> Tame your development challenges with Apache's Geronimo App Server. Download
> it for free - -and be entered to win a 42" plasma tv or your very own
> Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php



-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
jetty-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-discuss