Simple disable jsps keep serving static resources...clarification.

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

Simple disable jsps keep serving static resources...clarification.

sent2null@netzero.net
I want to clarify what I was asking for in the letter below:

I know how to create static resource generating contexts, the issue is that I can't get one server to serve both dynamic contexts AND static contexts on different ports AT THE SAME time. Is this possible? Everytime I place multiple contexts in my class, the very first type of context encountered is the type that is used for all other contexts loaded even if those contexts specify another type (static only)..this is the problem I am having. I read in the tutorial that it is possible to create multiple servers but I am hoping I don't have to do that. I want to just create different loaded contexts (a mix of dynamic and static ones) under the SAME server.

Hope that clarifies what I was asking for before.

Regards,

David

***************
Previous letter
*********************************************************************

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.




______________________________________________________________________
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...clarification.

Greg Wilkins-5
[hidden email] wrote:
> I want to clarify what I was asking for in the letter below:
>
> I know how to create static resource generating contexts, the issue is that I can't get one server to serve both dynamic contexts AND static contexts on different ports AT THE SAME time. Is this possible? Everytime I place multiple contexts in my class, the very first type of context encountered is the type that is used for all other contexts loaded even if those contexts specify another type (static only)..this is the problem I am having. I read in the tutorial that it is possible to create multiple servers but I am hoping I don't have to do that. I want to just create different loaded contexts (a mix of dynamic and static ones) under the SAME server.
>
> Hope that clarifies what I was asking for before.
>


Oh that is easy!

if you want different ports to server totally different content, then simply have
two intances of Jetty.   The server itself is very very lightweight and is just
a binding from the listeners to the contexts.  If there is no overlap in the
resources server, then just have different instances of the server.

cheers


-------------------------------------------------------
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