Maybe this answer can help:

https://stackoverflow.com/a/68682598/458157

 

> Message du 10/08/21 09:32
> De : "Alexander Farber" 
> A : "JETTY user mailing list" 
> Copie à : 
> Objet : Re: [jetty-users] Using WebAppContext at contextPath / but also 
> serving images, sounds folders
> 
>

Yes, Jan -

>

On Tue, Aug 10, 2021 at 4:20 AM Jan Bartel  wrote:
>

I'm not sure what you are wanting to do?  Do you want to keep your 2 static 
content ContextHandlers (at context paths "/images" and "/sounds") and your 
var/www/myservlet-3.0.war but move it to context path "/"?  Or are you asking 
can you combine all 3 into a single webapp?


>
the first option, how to do it please?

>
Sorry if I am asking something basic, I am not experienced with using servlets

>
Best regards
Alex

>

>



>


On Mon, 9 Aug 2021 at 21:21, Alexander Farber  wrote:
>











>
I am using 9.4.43.v20210629 for two things:

>
1) serve Websockets and GET, POST requests
2) serve files located in "images" and "sounds" folders

>
My config for 1 is currently using contextPath "/ws":

>



 

 



    "http://www.eclipse.org/jetty/configure_9_0.dtd";>



 




>






    /ws






    /var/www/myservlet-3.0.war







>



 





>
And the two configs for 2 are (only the "resourceBase" differs):

>






 

 






    "http://www.eclipse.org/jetty/configure_9_0.dtd";>






 






    /images












   












       












             /var/www/html/mydomain.com/images












            true












       












   






 








>
It works well for several years already (and behind HAProxy 1.8.27), but I am 
not happy with having  contextPath "/ws" as a prefix to my servlet.

>
I would like to change it to "/" aka root, but wonder how to keep "/images" and 
"/sounds" also servable by Jetty.

>
Would org.eclipse.jetty.fcgi.server.proxy.TryFilesFilter help me in this 
situation?

>
If a file (a sound or image file) is found, it should be served. Otherwise the 
Websockets, GET or POST request should be forwarded to my servlet.

>
In the Jetty doc for FastCGI there is an example:

>

   
        org.eclipse.jetty.fcgi.server.proxy.TryFilesFilter
        /*
       
           
               
           
       
       
            files
            $path /index.php?p=$path
       
   


>
but I am not sure how to apply it to my situation, how to replace the 
"index.php" by my servlet there?

>

















_______________________________________________
jetty-users mailing list
[email protected]
To unsubscribe from this list, visit 
https://www.eclipse.org/mailman/listinfo/jetty-users

_______________________________________________
jetty-users mailing list
[email protected]
To unsubscribe from this list, visit 
https://www.eclipse.org/mailman/listinfo/jetty-users

Reply via email to