Re: [jetty-users] Jetty Block IP based on visits

2011-12-05 Thread Thomas Becker

Hi Cheney,

jetty doesn't support this out of the box, no. But you can deal with it 
yourself by for example writing a custom handler 
(http://wiki.eclipse.org/Jetty/Howto/Write_Jetty_Handler) which counts 
the requests per IP per hour/day and respond with an error page if the 
configured limit has been reached. If you're expecting a huge amount of 
requests be careful on how you track requests as this might need a big 
amout of memory depending on how you count/store the requests from the 
last day for example.


Cheers,
Thomas

On 12/5/11 7:57 AM, Xin Chen wrote:

Hi,

Can you Jetty do this?

Specifying the maximum request e.g. 1000 per day or per hour, for certain IP. 
If that IP reaches the limit, Jetty will show them error message etc.

Thanks,
cheney
___
jetty-users mailing list
jetty-users@eclipse.org
https://dev.eclipse.org/mailman/listinfo/jetty-users


--
thomas becker
tbec...@intalio.com

http://webtide.com / http://intalio.com
(the folks behind jetty and cometd)

___
jetty-users mailing list
jetty-users@eclipse.org
https://dev.eclipse.org/mailman/listinfo/jetty-users


[jetty-users] Default error handling in jetty

2011-12-05 Thread Stefan Magnus Landrø
Hi there,

Whenever webapps deployed to jetty fail, one gets the message from the
exception set in the status line:

stefan landro@mac-stefanl:~/tmp $ wget -S http://localhost:8080/test
--2011-12-05 09:02:05--  http://localhost:8080/test
Resolving localhost... 127.0.0.1, ::1, fe80::1
Connecting to localhost|127.0.0.1|:8080... connected.
HTTP request sent, awaiting response...
  HTTP/1.1 500 My detailed exception Message

This is quite unfortunate, since such an exception message might leak lots
of information about the application to a bad guy.

In addition, if for some reason the custom error handling in your web app
(error-page etc in web.xml) fails, jetty returns a default error page
(see code below), leaking even more details about the exception (the entire
stack) in addition to the Powered by Jetty line, providing the bad guy
with even more details.

Wouldn't it make sense to remove this functionality from jetty?

Cheers,

Stefan


org.eclipse.jetty.server.Response.java (line 310):

writer.write(html\nhead\nmeta http-equiv=\Content-Type\
content=\text/html;charset=ISO-8859-1\/\n);
writer.write(titleError );
writer.write(Integer.toString(code));
writer.write(' ');
if (message==null)
message=HttpStatus.getMessage(code);
writer.write(message);
writer.write(/title\n/head\nbody\nh2HTTP ERROR: );
writer.write(Integer.toString(code));
writer.write(/h2\npProblem accessing );
writer.write(uri);
writer.write(. Reason:\npre);
writer.write(message);
writer.write(/pre);
writer.write(/p\nhr /ismallPowered by Jetty:///small/i);

for (int i= 0; i  20; i++)
writer.write(\n);
writer.write(\n/body\n/html\n);


-- 
BEKK Open
http://open.bekk.no
___
jetty-users mailing list
jetty-users@eclipse.org
https://dev.eclipse.org/mailman/listinfo/jetty-users


Re: [jetty-users] Jetty Block IP based on visits

2011-12-05 Thread Stefan Magnus Landrø
If you prefer servlet filters to jetty handlers, you could of course use
that instead.

Btw, users coming from behind an http proxy often use the same ip address.
In addition, these same proxies often use several ip addresses.

Cheers,

Stefan

On 5 December 2011 09:33, Thomas Becker tbec...@intalio.com wrote:

 Hi Cheney,

 jetty doesn't support this out of the box, no. But you can deal with it
 yourself by for example writing a custom handler (http://wiki.eclipse.org/
 **Jetty/Howto/Write_Jetty_**Handlerhttp://wiki.eclipse.org/Jetty/Howto/Write_Jetty_Handler)
 which counts the requests per IP per hour/day and respond with an error
 page if the configured limit has been reached. If you're expecting a huge
 amount of requests be careful on how you track requests as this might need
 a big amout of memory depending on how you count/store the requests from
 the last day for example.

 Cheers,
 Thomas

 On 12/5/11 7:57 AM, Xin Chen wrote:

 Hi,

 Can you Jetty do this?

 Specifying the maximum request e.g. 1000 per day or per hour, for certain
 IP. If that IP reaches the limit, Jetty will show them error message etc.

 Thanks,
 cheney
 __**_
 jetty-users mailing list
 jetty-users@eclipse.org
 https://dev.eclipse.org/**mailman/listinfo/jetty-usershttps://dev.eclipse.org/mailman/listinfo/jetty-users


 --
 thomas becker
 tbec...@intalio.com

 http://webtide.com / http://intalio.com
 (the folks behind jetty and cometd)

 __**_
 jetty-users mailing list
 jetty-users@eclipse.org
 https://dev.eclipse.org/**mailman/listinfo/jetty-usershttps://dev.eclipse.org/mailman/listinfo/jetty-users




-- 
BEKK Open
http://open.bekk.no
___
jetty-users mailing list
jetty-users@eclipse.org
https://dev.eclipse.org/mailman/listinfo/jetty-users


Re: [jetty-users] Jetty Block IP based on visits

2011-12-05 Thread Jan Bartel
Xin,

You should start with Jetty's QosFilter (Quality of Service filter):

http://wiki.eclipse.org/Jetty/Reference/QoSFilter

regards
Jan

On 5 December 2011 17:57, Xin Chen xche...@allette.com.au wrote:
 Hi,

 Can you Jetty do this?

 Specifying the maximum request e.g. 1000 per day or per hour, for certain IP. 
 If that IP reaches the limit, Jetty will show them error message etc.

 Thanks,
 cheney
 ___
 jetty-users mailing list
 jetty-users@eclipse.org
 https://dev.eclipse.org/mailman/listinfo/jetty-users
___
jetty-users mailing list
jetty-users@eclipse.org
https://dev.eclipse.org/mailman/listinfo/jetty-users


Re: [jetty-users] Jetty Block IP based on visits

2011-12-05 Thread Xin Chen
Hi Jan,

Thanks for sharing this - didn't know Jetty can do so many things. 

I have a bit read and this is more suitable when servers can't handle big 
amount of requests and want to pick some for priority processing. 

In our case, is some IP consumed huge bandwidth from our server/datacenter, 5G 
per day from one IP, and everyday. We want to keep it down to lower our data 
centre costs.

Cheers,
cheney

On 06/12/2011, at 11:21 AM, Jan Bartel wrote:

 Xin,
 
 You should start with Jetty's QosFilter (Quality of Service filter):
 
 http://wiki.eclipse.org/Jetty/Reference/QoSFilter
 
 regards
 Jan
 
 On 5 December 2011 17:57, Xin Chen xche...@allette.com.au wrote:
 Hi,
 
 Can you Jetty do this?
 
 Specifying the maximum request e.g. 1000 per day or per hour, for certain 
 IP. If that IP reaches the limit, Jetty will show them error message etc.
 
 Thanks,
 cheney
 ___
 jetty-users mailing list
 jetty-users@eclipse.org
 https://dev.eclipse.org/mailman/listinfo/jetty-users
 ___
 jetty-users mailing list
 jetty-users@eclipse.org
 https://dev.eclipse.org/mailman/listinfo/jetty-users

___
jetty-users mailing list
jetty-users@eclipse.org
https://dev.eclipse.org/mailman/listinfo/jetty-users


[jetty-users] Using OpenJPA in embedded Jetty, cannot find persistence.xml

2011-12-05 Thread Amaltas
Hi,
I am using embedded jetty and the directory structure of the executable jar
file is:

/com/myproject/frontend/FrontendMain.java
/com/myproject/frontend/servlets/HelloServlet.java
/WEB-INF/classes/META-INF/persistence.xml
/libs/*.jar

The Main-Class is com.myproject.frontend.FrontendMain. I set appropriate
class-paths in manifest files, but the openjpa cannot find persistence.xml
file.

I have tried everything like copying persistence.xml in the following
folders:
/WEB-INF/persistence.xml
/META-INF/persistence.xml
/persistence.xml
/lib/persistence.xml

Please note that its pure embedding, everything is set programmatically, so
no war architecture is involved.

I have been trying all weekend but with no success. I really want to use
embedded jetty in my project, but if JPA doesn't work, I will have to try
tomcat unfortunately.

Thanks
___
jetty-users mailing list
jetty-users@eclipse.org
https://dev.eclipse.org/mailman/listinfo/jetty-users


Re: [jetty-users] Logging Custom Handlers JUL

2011-12-05 Thread Alan Williamson (aw2.0 cloud experts)

Joakim,

i am trying to integrate the custom logger into jetty, but for some 
reason i can't get it to work.   Let me give you where i am thus far.


I have followed your instructions here.  My custom handler does indeed 
get all the logging that Jetty itself kicks out.  I am able to confirm 
that my custom handler is running.


However, what i cannot get, is for any class deployed in my webapp to 
reach to the custom logging handler.  It just refuses to get there.


So my questions are:

1/ Where should one place my custom handler jar file?  You noted before 
that /lib/etc/ is too late, so if that is the case, then where?


2/ Should i run with --exec ?

3/ The classloader that handles the webapp, will that use the custom 
handler that the core jetty has created?




I feel so close to getting this working, yet i am no further forward 
from the moment i started.



 I created an example project showing how to set this up, see 

https://github.com/jetty-project/jetty-and-jul-example.

___
jetty-users mailing list
jetty-users@eclipse.org
https://dev.eclipse.org/mailman/listinfo/jetty-users


Re: [jetty-users] Using OpenJPA in embedded Jetty, cannot find persistence.xml

2011-12-05 Thread Jan Bartel
Amaltas,

Jetty itself doesn't find or read the persistence.xml file, that's
something that is done by the jpa.

I think maybe the jpa is expecting to find the persistence file inside
a jar file, so have you tried putting it inside a jar file in
WEB-INF/lib? If that doesn't work, then you might need to track down
the doco on the jpa impl and check where it is prepared to look for
its initialization file.

cheers
Jan

On 6 December 2011 12:19, Amaltas amal...@amaltas.org wrote:
 Hi,
 I am using embedded jetty and the directory structure of the executable jar
 file is:

 /com/myproject/frontend/FrontendMain.java
 /com/myproject/frontend/servlets/HelloServlet.java
 /WEB-INF/classes/META-INF/persistence.xml
 /libs/*.jar

 The Main-Class is com.myproject.frontend.FrontendMain. I set appropriate
 class-paths in manifest files, but the openjpa cannot find persistence.xml
 file.

 I have tried everything like copying persistence.xml in the following
 folders:
 /WEB-INF/persistence.xml
 /META-INF/persistence.xml
 /persistence.xml
 /lib/persistence.xml

 Please note that its pure embedding, everything is set programmatically, so
 no war architecture is involved.

 I have been trying all weekend but with no success. I really want to use
 embedded jetty in my project, but if JPA doesn't work, I will have to try
 tomcat unfortunately.

 Thanks

 ___
 jetty-users mailing list
 jetty-users@eclipse.org
 https://dev.eclipse.org/mailman/listinfo/jetty-users

___
jetty-users mailing list
jetty-users@eclipse.org
https://dev.eclipse.org/mailman/listinfo/jetty-users