Yes, Jan -

On Tue, Aug 10, 2021 at 4:20 AM Jan Bartel <j...@webtide.com> 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 <alexander.far...@gmail.com>
> 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":
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN"
>>     "http://www.eclipse.org/jetty/configure_9_0.dtd";>
>> <Configure class="org.eclipse.jetty.webapp.WebAppContext">
>>
>>     <Set name="contextPath">/ws</Set>
>>     <Set name="war">/var/www/myservlet-3.0.war</Set>
>>
>> </Configure>
>>
>>
>> And the two configs for 2 are (only the "resourceBase" differs):
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN"
>>     "http://www.eclipse.org/jetty/configure_9_0.dtd";>
>> <Configure class="org.eclipse.jetty.server.handler.ContextHandler">
>>     <Set name="contextPath">/images</Set>
>>     <Set name="handler">
>>         <New class="org.eclipse.jetty.server.handler.ResourceHandler">
>>              <Set name="resourceBase">/var/www/html/mydomain.com/images
>> </Set>
>>             <Set name="directoriesListed">true</Set>
>>         </New>
>>     </Set>
>> </Configure>
>>
>>
>> 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:
>>
>>     <Call name="addFilter">
>>         <Arg>org.eclipse.jetty.fcgi.server.proxy.TryFilesFilter</Arg>
>>         <Arg>/*</Arg>
>>         <Arg>
>>             <Call name="of" class="java.util.EnumSet">
>>                 <Arg><Get name="REQUEST"
>> class="javax.servlet.DispatcherType" /></Arg>
>>             </Call>
>>         </Arg>
>>         <Call name="setInitParameter">
>>             <Arg>files</Arg>
>>             <Arg>$path /index.php?p=$path</Arg>
>>         </Call>
>>     </Call>
>>
>> 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
jetty-users@eclipse.org
To unsubscribe from this list, visit 
https://www.eclipse.org/mailman/listinfo/jetty-users

Reply via email to