Servlet filter that can differentiate between Filter and Servlet Writers

Hey,
I'm trying to build a Filter and HttpServletResponseWrapper that, when applied to a generic servlet, can differentiate between the output stream from the Servlet and the one from the Filters.
So, say I have a servlet:
PrintWriter pw = response.Writer();
pw.write( "Output from servlet" );
pw.close();And a filter that is applied to the servlet:
PrintWriter pw = response.Writer();
pw.write( "Output from filter" );
pw.close();I want to be able to do this in my filter that is able to differentiate between the servlet and filter response:
System.out.println( "Response from servlet: " + responseWrapper.servlet.toString() );
System.out.println( "Response from filter: " + responseWrapper.filter.toString() );The responseWrapper.servlet and responseWrapper.filter can contain all filter responses from all the servlet(s) and filter(s), respectively.
Can anyone give me guidance as to how to start with this - really I just need to know if I can differentiate between servlet and filter responses in a generic way (without having to modify the response specially in the filter or servlet files that write output)
Thanks for your time.

first thing's first..if the OutputStream if not closed Either a Filter or a ServletChain can write on to the stream.
There could be cases where the servletoutputstream would be closed at servlet end itself.Therefore,its a valiant effort by acomplishing a responseheader in the response to indicate that.
Now once the response/outputstream is not closed or flushed out there is not direct way by which you do this unless we indicate using response Headers as flags when we are implementing FilterChaning.
Hope that might help :)
REGARDS,
RaHuL

Similar Messages

  • How do I create a filter that bypasses the in page and goes directly to spam rather to delete?

    How do I create a filter that bypasses the in page and goes directly to spam rather than to delete?

    From your question I'm going to guess you are talking about Mac Mail.
    If you are talking about a RULE then the "Perform the following actions:" would be to select "Move Message" to mailbox "Junk" instead of "Delete Message."
    If you are talking about something else then please give more information.

  • Can someone please tell me a simple but effective method for burning a slideshow to DVD? Now that the connection between iPhoto and iDVD no longer exists, I can't figure out a way to get there with an acceptable quality result.

    Can someone please tell me a simple but effective method for burning a slideshow to DVD? Now that the connection between iPhoto and iDVD no longer exists, I can't figure out a way to get there with an acceptable quality result.

    Export the slideshow out of iPhoto as a QT movie file via the Export button in the lower toolbar.  Select Size = Medium or Large.
    Open iDVD, select a theme and drag the exported QT movie file into the open iDVD window being careful to avoid any drop zones.
    Follow this workflow to help assure the best qualty video DVD:
    Once you have the project as you want it save it as a disk image via the File ➙ Save as Disk Image  menu option. This will separate the encoding process from the burn process. 
    To check the encoding mount the disk image, launch DVD Player and play it.  If it plays OK with DVD Player the encoding is good.
    Then burn to disk with Disk Utility or Toast at the slowest speed available (2x-4x) to assure the best burn quality.  Always use top quality media:  Verbatim, Maxell or Taiyo Yuden DVD-R are the most recommended in these forums.
    If iDVD was not preinstalled on your Mac you'll have to obtain it by purchasing a copy of the iLife 09 disk from a 3rd party retailier like Amazon.com: ilife 09: Software or eBay.com.  Why, because iDVD (and iWeb) was discontinued by Apple over a year ago. 
    Why iLife 09 instead of 11?
    If you have to purchase an iLife disc in order to obtain the iDVD application remember that the iLife 11 disc only provides  themes from iDVD 5-7.  The Software Update no longer installs the earlier themes when starting from the iLIfe 11 disk nor do any of the iDVD 7 updaters available from the Apple Downloads website contain them. 
    Currently the only sure fire way to get all themes is to start with the iLife 09 disc:
    This shows the iDVD contents in the iLife 09 disc via Pacifist:
    You then can upgrade from iDVD 7.0.3 to iDVD 7.1.2 via the updaters at the Apple Downloads webpage.
    OT

  • I have the kindle app on my I pad.   How do I eliminate books I've already read?  On a regular kindle, you can switch between cloud and device but I am not getting that option.  Thanks

    I have the Kindle app on my I pad
    I want to eliminate the books I've already read (I have a LOT).
    On the regular kindle you can switch between cloud and device but that is not working on my I pad.
    HELP.
    Thanks

    The Kindle app has a menu on the very bottom center of the screen that allows you to switch from a device and cloud view. To remove a title from the device, tap and hold on it. a pop menu will apear that allows to add the title to a collection, remove it from the device, or download it from the cloud (depending on its current status).

  • Htmlb:tree differentiate between nodeclick and tree node expander click

    Hi,
    how can i differentiate between nodeclick and tree node expander (to get to its children) click in my event processing in htmlb:tree element.
    <u><b>What i am trying to achieve?</b></u>
    Onload just load root node and its immediate children.
    On node expand get the children of the current node and modify htmlb:tree table2 with additional node inofs.
    on node click  call some client function.
    But my issue is that i am not able to differentiate between node expander click and node click in my event handling. Any help on this is appreciated.
    (I am not using MVC)
    Thanks in advance.
    Regards
    Raja
    Message was edited by: Durairaj Athavan Raja

    After reading your weblog I think I understand better. I did some testing with my example.  I am using the toggle = "true", so that the page returns to the server each time an expander is selected.
    <htmlb:tree id          = "myTree1"
                  height      = "75%"
                  toggle      = "true"
                  title       = "<b><otr>EQI Reporting Tree</otr></b>"
                  width       = "90%"
                  onTreeClick = "myTreeClick"
                  table       = "<%= application->selection_model->itview                             %>" >
      </htmlb:tree>
    However I have not added any coding in my event handler to respond to the expander event.  I only respond to myTreeClick (which loads some data for the given selection).  The BSP tree element itself must be doing the hard work for me. 
      if event_id cs 'tr_myTree1'.
        data: tree_event type ref to cl_htmlb_event_tree.
        tree_event ?= htmlb_event.
        if tree_event->server_event = 'myTreeClick'.
          clear appl->message1.
          appl->selection_model->get_chart_data( appl = appl
                                                 node = tree_event->node ).
        endif.
      endif.
    I pass my entire tree defintion to the element.  It appears that it only sends visible nodes to be rendered. When the expander is selected, I don't have to do anything, the tree re-renders with only the newly visible rows. 
    I tested and turned off the toggle (toggle = "false") and my page took forever to load because it was sending all the nodes to the frontend on the first load.

  • Failed to communicate between MIDlet and Servlet

    hi all
    i got a trouble here hope someone can get me out of this.... i've run example from a website even from Sun itself which demo the communication between MIDlet and Servlet.... but below is what i got:
    "*Application not authorized to access the restricted API*"
    the source code from: http://didiksoft.wordpress.com/
    im using tomcat webserver 4.1.3.... jsdk 5.0.... Sun JWT 2.5..... is there something that i missed to configure..??? thanks in advance....

    I have the same problem in XP. I installed the whole Oracle9i product on my desktop and after a day or two the message began appearing on my machine. I couldnt use any of the tools. I tried uninstallinmg according to Oracles instruction and after installing again had the same problem.
    I logged a TAR and they advised me to reinstall but according to Oracles instructions for removing the software first.
    Will keep you posted

  • Differentiate between Items and Customer Items

    Differentiate between Items and Customer Items
    pls try to give information about this
    thanx

    Hi Joel,
    Funny you mentioned it, because just today I was thinking about that, and I thought that if it will happen, I will rant you on your forum dereliction of duties. So it seems you’re off the hook now :)
    Anyway, judging from the last 3.0/3.0.1 versions it seems like you are doing your other duties very well so I really don’t mind you keeping the lead.
    Best regards,
    Arie.

  • I have a Domain name with email forwarding to my Service Provider which worked very well when I had a PC. Now I have iMac and have changed to IMAP from POP3 so I can sync. between iMac and iPad but how?

    I have a Domain name with email forwarding to my Service Provider which worked very well when I had a PC. Now that I have iMac I have changed the account type to IMAP from POP3 so I can sync. between iMac and iPad but how?
    I do receive emails into my iMac for which I have 3 email accounts but am struggling on how synchronise between iMac and iPad so that both are up to date at all times.  I have also set up a iCloud email account thinking this was the way to go but have drawn a blank.
    Any help would be very much appreciated.

    Linc Davis,
    I have set up my email address both within my iMac and my ISP as IMAP accounts and I receive all emails without problem on my iMac. I have also set up an iCloud email address using my iMac.
    I have enabled the email within "setting" on my iPad and have used the iCloud account.  I have sent emails from the iMac to iPad using the iCloud account address and vice versa.  I have also sent emails from the iPad to the iMac using my non-iCloud email address and they have gotten through.
    The one thing I would like to have is for the iPad "mail" mailboxes to mimic the iMac "mail" mailboxes and both to be "in sync".  I am not really interested in using the iCloud email address for my email but would really like to use my "normal" addresses as these are what most people know me by.
    Do I need to set additional accounts within the iPad which are the same as the email accounts I have within the iMac and my ISP?  I have reached the end of my knowledge as regards email synchronsing.
    Thanks

  • Does anyone knows that the difference between 0VENDOR and 0GN_VENDOR?

    Dear all,
    Does anyone knows that the difference between 0VENDOR and 0GN_VENDOR? why we have to use 0GN_VENDOR?
    Is it compulsory to use  0GN_VENDOR even if i have only R/3 source system?
    can any one tell me with one example.
    I have searched the forum but not cleared the confusion......
    Regards
    venu

    Hi Venu,
    Check the below link
    http://help.sap.com/saphelp_nw2004s/helpdata/en/60/9590135841c54b814391fcee482fbf/content.htm
    Hope it helps You
    Mann

  • I don't have a wireless keyboard or mouse for my 2007 iMac, is there any way that can use remote desktop and access it from my 2010mbp.

    i don't have a wireless keyboard or mouse for my 2007 iMac, is there any way that can use remote desktop and access it from my 2010mbp

    Hi champrider,
    You can use an application such as Apple Remote Desktop to control your iMac remotely. See this article -
    OS X Mavericks: Allow access using Apple Remote Desktop
    This help page will provide you with some other useful resources for Apple Remote Desktop -
    Remote Desktop Help
    Thanks for using Apple Support Communities.
    Best,
    Brett L 

  • Hello, I have a 5min. part of a piece of meditation music (I think its from the 1970-80s) is there a website that can upload my sample and tell me who it is ? I want to get a new version....Thanks

    Hello, I have a 5min. part of a piece of meditation music (I think its from the 1970-80s) is there a website that can upload my sample and tell me who it is ? I want to get a new version....Thanks............Its in Mp3 format

    Well... it's not actually an iTunes or even an Apple question is it? But you can use either Shazam or Soundhound.
    If you do a search for both of them, you will find the various options available to you, which include apps for portable devices and in the case of Shazam, a work-round that allows you to use an online option using your computer's microphone on either a PC or Mac.
    There may be other services as well, but I know these two.
    I do not receive any reward (financial or otherwise) as a result of mentioning either Shazam or Soundhound.

  • Differentiate between mapping and optimization.

    Hi
    tell me some thing about this.
    Differentiate between mapping and optimization.
    please
    urgent. imran

    user571615 wrote:
    Hi
    tell me some thing about this.
    Differentiate between mapping and optimization.
    please
    urgent. imranThis is a forum of volunteers. There is no urgent here. For urgent, buy yourself a support contract and open an SR on MetaLink.

  • How do I make PDF with layers that can be turned on and off?

    I am creating a map in Indesign CS4 and I want to have different layers that can be turned on and off.  Layers like different places and names that can be controled in Acrobat (and Reader).  Im not sure how to go about this and if this is something created through Acrobat or through InDesign.  I didnt see anything in ID when converting to a PDF that would save layers in that way so I assume its done in Acrobat Pro?  Just need and idea of where to start

    InDesign CS5 to Acrobat 9 Multimedia and Interactive Workflows by Dona Baker
    Creating and Using Layers (OCGs) with Acrobat JavaScript by Thom Parker

  • Tool like PathPing that can pinpoint packet loss and can be configured to run for 24 hours

    Does anybody know if there is a simple tool like PathPing that can pinpoint packet loss and can be configured to run for eg. 24 hours. I need it for windows XP preferable a cmd line tool like PathPing. Thanks Simon.

    Thanks for your answer. I already downloaded winmtr.
    Regards
    Simon
    From:
    namohamm
    To:
    Simon Vyrdal/Sweden/Contr/IBM@IBMSE
    Date:
    2010-12-30 08:29
    Subject:
    New message: "Tool like PathPing that can pinpoint
    packet loss and can be configured to run for 24 hours"
    simonvyrdal,
    A new message was posted in the Discussion thread "Tool like PathPing that
    can pinpoint packet loss and can be configured to run for 24 hours":
    https://supportforums.cisco.com/message/3258861#3258861
    Author : Nael Mohammad
    Profile : https://supportforums.cisco.com/people/namohamm
    Message:

  • Transactions that reconcile sales between FI and CO

    Hi,
    Is there any transaction that reconcile sales between FI and CO?
    Thanks,
    Stanislas

    try...
    FAGLCOFIFLUP - Post CO Documents to FI
    KEAT
    KEAW

Maybe you are looking for