File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes How I can cut the communication between client and server using a filter? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "How I can cut the communication between client and server using a filter?" Watch "How I can cut the communication between client and server using a filter?" New topic
Author

How I can cut the communication between client and server using a filter?

raminaa niilian
Ranch Hand

Joined: Jul 14, 2005
Posts: 551
Hi
Thank you for reading my post
How I can cut the communication between client and server using a filter?
for example if user request header has no coockie, i do not allow the request to go to its endpoint and instead i generate some html and send it as response to the client without allowing the request to go in.

Thank you very much.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Write a filter that checks for the cookie and forwards to an error or login page if the cookie is not present.
If the cookie is present, call chain.doFilter.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
raminaa niilian
Ranch Hand

Joined: Jul 14, 2005
Posts: 551
Hi
Thank you for your reply.
I want the filter to write something in the output instead of redirecting to some other pages.
Is it possible?

Thanks
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How I can cut the communication between client and server using a filter?