Re: [jetty-users] Using WebAppContext at contextPath / but also serving images, sounds folders

2021-08-10 Thread Jan Bartel
Just change the context path in the context XML files for your webapp from
'/ws' to '/'.



On Tue, 10 Aug 2021, 23:02 Alexander Farber, 
wrote:

> The answer at Stackoverflow by Joakim is as always very informative, thank
> you for pointing to it.
>
> I just have one open question left: if I would like to serve 3 different
> things by Jetty - the 2 static subfolders (/images and /sounds) and one
> servlet (at /, serving Websockets, GET, POST) - then should I put them all
> in one XML config files (and what it the name, is it
> org.eclipse.jetty.server.handler.ContextHandler ?) or should I use 3
> different XML files?
>
> Best regards
> Alex
>
>
> On Tue, Aug 10, 2021 at 2:50 PM Alexander Farber <
> alexander.far...@gmail.com> wrote:
>
>>
>> On Tue, Aug 10, 2021 at 12:42 PM  wrote:
>>
>>> https://stackoverflow.com/a/68682598/458157
>>>
>> Ah the longest match is used? I was assuming the folder order in the
>> config files and maybe thus I was having problems
>>
>> ___
> jetty-users mailing list
> jetty-users@eclipse.org
> To unsubscribe from this list, visit
> https://www.eclipse.org/mailman/listinfo/jetty-users
>
___
jetty-users mailing list
jetty-users@eclipse.org
To unsubscribe from this list, visit 
https://www.eclipse.org/mailman/listinfo/jetty-users


[jetty-users] How can I accurately count visits?

2021-08-10 Thread gouessej
Hello

I would like to count visits. I use Jetty 11, my logs are in combined log 
format (I guess from a line produced by a silly script kiddy):
209.141.54.8 - - [10/Aug/2021:05:40:17 +] "POST /boaform/admin/formLogin 
HTTP/1.1" 404 451 "http://80.13.94.99:80/admin/login.asp; "Mozilla/5.0 (X11; 
Ubuntu; Linux x86_64; rv:71.0) Gecko/20100101 Firefox/71.0"

I can't use GoAccess because it counts hits but it doesn't count visits. I 
can't use AWStats because it seems to count only the visits on the pages, not 
the direct visits of image files for example. I can't use Matomo because it 
requires PHP (I don't want to install PHP only to use a single program).

I would like to know whether a request has been caused by a previous request. 
For example, imagine that index.html refers to img.png. When I go to 
index.html, it will cause at least 2 hits. I would like to be able to count as 
a single visit for those two hits and I would like to count as another visit a 
hit on this image when this hit is caused by another page (coming from a search 
engine). Is it doable without having to parse the HTML file to determine 
whether it refers to an image? Maybe I can override RequestLog to do that:
https://www.eclipse.org/jetty/javadoc/jetty-11/org/eclipse/jetty/server/RequestLog.html

Best regards.
___
jetty-users mailing list
jetty-users@eclipse.org
To unsubscribe from this list, visit 
https://www.eclipse.org/mailman/listinfo/jetty-users


Re: [jetty-users] Using WebAppContext at contextPath / but also serving images, sounds folders

2021-08-10 Thread Alexander Farber
On Tue, Aug 10, 2021 at 12:42 PM  wrote:

> https://stackoverflow.com/a/68682598/458157
>
>
>
Ah the longest match is used? I was assuming the folder order in the config
files and maybe thus I was having problems
___
jetty-users mailing list
jetty-users@eclipse.org
To unsubscribe from this list, visit 
https://www.eclipse.org/mailman/listinfo/jetty-users


Re: [jetty-users] Using WebAppContext at contextPath / but also serving images, sounds folders

2021-08-10 Thread Alexander Farber
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
>> /*
>> 
>> 
>> > class="javax.servlet.DispatcherType" />
>> 
>> 
>> 
>> 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
jetty-users@eclipse.org
To unsubscribe from this list, visit 
https://www.eclipse.org/mailman/listinfo/jetty-users