Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / August 2007

Tip: Looking for answers? Try searching our database.

filter

Thread view: 
odelya - 30 Aug 2007 08:39 GMT
Hello!
I wrote the ffollowing filter:
private FilterConfig    filterConfig    = null;

    /**
    * overwritten.
    */
    public void destroy() {
        filterConfig = null;

    }

    /**
    * filters parameters: ContentType and expires.
    */
    public void doFilter(ServletRequest arg0, ServletResponse arg1,
FilterChain arg2) throws IOException, ServletException {
        if (filterConfig == null)
            return;
        HttpServletRequest request = (HttpServletRequest) arg0;
        HttpServletResponse response = (HttpServletResponse) arg1;
        System.out.print(request.getContextPath());
        System.out.print(request.getContentLength());

        arg2.doFilter(request, response);
    }

    /* (non-Javadoc)
    * @see javax.servlet.Filter#init(javax.servlet.FilterConfig)
    */
    public void init(FilterConfig arg0) throws ServletException {
        this.filterConfig = arg0;

    }
and i get messege:
for ContextPath(): /servlet
for ContentLength(): -1.
How come I don't get any content?

Thank you
GArlington - 30 Aug 2007 12:13 GMT
> Hello!
> I wrote the ffollowing filter:
[quoted text clipped - 36 lines]
>
> Thank you

ContentLength() = -1 is not empty, it is unknown.
See http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/ServletRequest.html#
getContentLength
()


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.