Filter reading problem

Hi
I'am sending xml data to servlet. I have created a filter where I check if the xml data is valid. I read filter request to a String and I send it to validation class (=valid variable in a code).
If everything is ok I call chain.doFilter(req, res), but servlet request has null content.
Program goes about like this
...public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException,ServletException{
   HttpServletRequest  request  = (HttpServletRequest)req;
   HttpServletResponse response = (HttpServletResponse)res;
   String contentText = readContent(request);
   if (valid.isValid(content))
             chain.doFilter(req, res);  
  public String readContent(HttpServletRequest req){
      String line=null;
      String content=null;
      try{
         BufferedReader in = new BufferedReader(new InputStreamReader (req.getInputStream()));
         while((line = in.readLine()) != null) {
              if (content == null)
                  content = line;
          else     
                  content = content + line;
          in.close();               
    catch (IOException ex){
        System.out.println("ERROR ....." + ex);
}So I don't change request (req) anyway. Can somebody tell me what is the problem ?.
Thanks ktu

You are reading all the bytes off the request input stream, so they are no longer there when you try to do the same in the servlet.

Similar Messages

  • Image reading problem in servlet

    Image reading problem in servlet
    I am reading an image in servlet and writing it to ServletOutputStream
    The following code works fine unless I change the size of the byte array (for increasing download speed) from 8 to something like 128 or any other higher value
    If I change the value of byte array size the image does not get downloaded properly, I mean the quality of the image changes, it does not looks like the original imageURL url = new URL("http://www.mysite.com/images/img1.jpg");
    URLConnection con = url.openConnection();
    con.setUseCaches(false);
    BufferedInputStream in = new BufferedInputStream(con.getInputStream());
    BufferedOutputStream out = new BufferedOutputStream(response.getOutputStream());
    byte b[] = new byte[8];
    while(in.read(b) != -1)
         out.write(b);
         out.flush();               
    out.close();
    in.close();what do I change
    byte array size
    or use the constructor of BufferedInputStream with 2 parameter
    or use the constructor of BufferedOutputStream with 2 parameter
    or use flush outside while loop or what else

    Change your while loop to:
    int count;
    while((count = in.read(b)) != -1)
         out.write(b, 0, count);
         out.flush();               
    }The penultimate time read is called, it may not fill the entire byte array. You only want to write out however much was read into the array.
    For better performance, you should move the flush() outside of the loop too. BufferedOutputStream will flush automatically when its internal buffer is full.

  • Telnet read problem -- Telnet read back

    I am trying to use telnet to send TL1 command to my UUT and expect to read back measurement data.  I was able to read proper data once in a while but most of the time I read back the TL1 command that I sent.  I tried different read mode and timeout period but nothing seem to matter.  My vi was written in Labview 8.2.1 with Internet toolkit.  I read in the forum about some limitation of the telnet read problem of the vi from the internet toolkit,  Is there any better read driver around?
    Thanks,
    Patrick 

    Hey!  I have a few questions for you that should help us solve this problem.  First, have you tried out the telnet shipping example "Telnet Line Client.vi".  This will help us minimize programming errors, etc.  Also, what type of device are you trying to communicate with?  Are there other forms of communication available?  For example, does the device also have a serial port, GPIB Port, etc.?  Also, is it possible to write to the device using TCP/IP (This is what telnet is based on)?  Let me know the answers to these questions and I will be better equipped to help you out!!
    Thanks!
    Dan
    Daniel Eaton
    National Instruments
    Systems Engineering
    Embedded and Industrial Control

  • T 420s cooling air coming out is very hot, finger print reader problem

    I am living in ruwais, abudhabi.i bought T 420s in last June from LENOVO  authorized distributor. Model number is 4174-KK4 and the sr no ***.
    Sometime the cooling air coming out is very hot, unable to keep the laptop on the lap.
    The cooling fan also replaced still the temperature is high.
    After replacing the fan I noticed that I noticed one of the screws was not fixed, I asked them to fix it, then they fixed it.
    I traveled back to my home 240 KM from the  authorized distributor service  center. when I started the laptop, the fingerprint reader was not working . Then I traveled back 240 KM to the  authorized distributor service  center to fix the issue. They fixed the fingerprint reader problem.
    Then now the SD card reader is not working. I was asked to bring the laptop to the  authorized distributor service centre.
    Can any one experience the same type of problems  with T 420s the cooling air coming out is very hot, finger print reader problem, card reader not working?
    The authorized distributor says for the service they can only cover 50 KM form the  authorized distributor service  center to the customer point, what is the conditions for the On site warranty ?. I am living 240 KM away from the authorized distributor service center from whom I bought the laptop.
    Moderator comment: Serial number(s) removed to protect member from mischief.

    Well clearly after the first incident. You need to check and us it verifying everything is working before leaving the service center or town its in. Go to a coffee shop and spend time using it and test each option is working.
    When the notebook its opened the finger print reader, card reader etc may not be connect properly or connectors not snap fully and disconnect. Mouse ultranav I have heard may also. But clearly you assume too much and you need to spend the time testing its working before leaving.
    These service center are only paid a fixed amount so they won't spend anymore time then they have to and address one problem you brought it in for.
    As for heat out put and over heating. There are many threads on these systems you can find and read about.
    Advice:
    - install Core Temp, this will monitor and display on the task bar you CPU core temp and you can see CPU load & Temperature at a glance if it approaching or staying near the max levels which will kill the CPU and/or motherboard due to cooking it. Its free just be sure to deselect any additional software from installing during the process. I use it on my notebooks. If the system is running high core Temp all the time you need to have it resolved or it will die and most likely out of warranty and/or your data will be lost if you don't have a backup as well. http://www.alcpu.com/CoreTemp/
    - use a laptop cooler. Its a flat pad you sit the laptop on you lap or table with usually two cooling fans that plug into the USB port for power. It will help cool the base of the laptop and other components inside will not be as hot. This will do nothing for the CPU temperature though.
    T520 Model 4239 Intel(R) Core(TM) i7-2860QM CPU @ 2.50GHz
    Intel Sandy Bridge & Nvidia NVS 4200M graphics Intel N 6300 Wi-Fi adapter
    Windows 7 Home Prem - 64bit w/8GB DDR3

  • I am unable to print documents.  States Adobe reader problem

    I cannot print documents as it says Adobe reader problem or error

    Windows 7; HP 2009m; printer is Lexmark S415;
    Message says
    Acro RD32.exe
    Adobe PDF document
    (There is a problem with Adobe Adrobat/Reader.  If it is running, please
    exit and try again. (15:3)

  • DataSocket Read problem

    Hi all,
    When I use the new condensed "DataSocket Read" vi in Labview 6i (which is
    unfortunately not editable and is supposed to replace old vi's like "open
    connection", "update", "close" and so on) a single time to read automat
    words through an OPC server, the vi returns "zeros" all the way. The only
    solution I found to read the right datas is to place the "DataSocket Read"
    in a "While Loop" which loops until datas are different from zeros, which
    is very inconvenient and time consuming. I tried diffferent settings with
    "DataSocket Read" (wait for update, timeout) but the problem remains.
    Have you also faced the same problem ? Is there a solution ? Thanks for your
    assistance.
    Gaël RENEVIER
    Responsable Maintenance & Développement
    Tél : 04 74 82 20 08
    Fax : 04 74 82 24 92
    e-mail : [email protected]

    This is a problem with the 6i data socket routines ... use the old routines
    from the data socket examples (with the open,update, close drivers), and it
    works fine.
    Dave Gianetto
    http://www.gianetto.org
    > From: [email protected]
    > Organization: UUNET
    > Newsgroups: comp.lang.labview
    > Date: Tue, 21 Nov 2000 16:05:38 +0100
    > Subject: DataSocket Read problem
    >
    > Hi all,
    >
    > When I use the new condensed "DataSocket Read" vi in Labview 6i (which is
    > unfortunately not editable and is supposed to replace old vi's like "open
    > connection", "update", "close" and so on) a single time to read automat
    > words through an OPC server, the vi returns "zeros" all the way. The only
    > solution I found to read the right datas is to place the "DataSocket Read"
    > in a "W
    hile Loop" which loops until datas are different from zeros, which
    > is very inconvenient and time consuming. I tried diffferent settings with
    > "DataSocket Read" (wait for update, timeout) but the problem remains.
    >
    > Have you also faced the same problem ? Is there a solution ? Thanks for your
    > assistance.
    >
    >
    > Gaël RENEVIER
    > Responsable Maintenance & Développement
    > Tél : 04 74 82 20 08
    > Fax : 04 74 82 24 92
    > e-mail : [email protected]
    >
    >

  • Card Reader problem with MSI K8T Neo

    Hi,
    I have the K8T Neo motherboard, and every once and a while my Atech Flash 9 in 1 card reader  (http://www.newegg.com/app/ViewProductDesc.asp?description=20-176-003&depa=0) doesn't power up, thus I can't use it.
    What's odd is that all my other USB devices work flawlessly.
    The only way I'm able to use the card reader again is to power down my computer and then flip the power switch on the psu, then turn it back on, or unplug the reader from the usb header on the motherboard and plug it back in.
    I've noticed other people have had similar issues...
    Any ideas what causes this, or any ideas on how to fix this?
    Bio Haz

    Yes, I had the same hanging problems as well with older BIOS versions then 1.7.
    But that isn't the problem I'm talking about, the computer always starts up, it's just a matter if the usb reader will work or not.
    Maybe MSI has yet to make a BIOS that is compatible with all card readers.
    BioHaz
    Quote
    Originally posted by me_AMD
    ...yes, I had USB card reader problems but it caused the computer to hang during POST, and that was fixed with BIOS v1.7...
    ...I've had what you describe happen on another machine with a Mitsumi card reader/floppy drive combo...not sure what caused it...had to disconnect it and then plug it back in...???...

  • Filter refreshing problem

    Hello, we are trying to refresh filter on a master table as you change pages. Both the pages use the same data control and if i search for the country Finland the results follow me as I move to the other page. Is there any way to avoid this problem.

    If your using BEx Web for executing this query, try deleting the cache on your browser before re-executing the query with the new Sales Rep. The other thing you may want to consider is adding the following code prior to the READ TABLE statement:
    CLEAR: ls_var.
    This will ensure that the variable being read into won't have any values in it before it's being populated.

  • AC3 Filter & Spidif Problems with Audigy 4 p

    I have an Audigy 4 Pro. I'm having a problem getting the spidif settings right on it so that it will produce 5. on my cambridge audio amplifier. I understand that spidif passthrough is required and have read the article about coax output producing audio over two speakers, however, in the AC3 filter interface the status of passthrough is set to "disabled".
    Is it possible to get this to work with this sound card? Or should I use another method to get the AC3 files to output in 5.
    It does work using power DVD but only with DVD files on discs. This problem only occurs when I play divx files with ac3 audio.

    Lex,
    The information I gave Felix2 is not "horrible" or wrong, they are the truth. There is no need to start attacking again, if you are not clear on the information I gave in his thread, ask for more clarification, but do not attack.
    If you are having problems getting it set up, it's best to provide some detail on what settings you have changed, how everything is configured, and someone will probably be able to help you.
    The start of your post isn't very clear, do you have a standard Audigy 4 or an Audigy 4 Pro? The Audigy 4 Pro does have an optical output on the external dri'vebay, the standard Audigy 4 (just a card) does not have an optical output. You would need to connect through a coaxial input (minijack to RCA, then RCA-RCA).
    Cat

  • 2d3 filter render problem

    I have a problem with 2d3 stabilizing filter:
    When applied to certain clip it begins to blink rapidly applying effect and not applying effect which give the impression of zooming in/out very rapidly.
    This occurs when render out via adobe media encoder; I a a preview bug in PP3 with AspectHD that doesn't allow me to see preview on timeline of rendered clip, so I can't say if it does that in project as well before exporting it...
    At first I thought it could be because I used 100% smoothing correction, so lowered it progressively to 25 but it's not that; particularly since I can apply it well enough on another take of that shot that is a clip of same tape, captured during same session. Both clip aren't corrupted and play perfectly without 2d3 applied to them.
    Maybe I could use another stabilizer filter on them, any recommendations; heard that AEF got a good one?
    Thank you.
    My spec:
    ADM Athlon64 x2 4600+
    MATROX APVe
    Sound Blaster X-FI
    4 GB ram 733 mghz
    ASUS M2N SLI-DELUXE
    separate HD raid 0 configuration for video
    dual monitor with Ultramon
    AspectHD 5.2 last built

    2d3 SteadyMove is not compatible with Premiere Pro CS3. It is however compatible with After Effects CS3. Adobe has modified the Premiere Pro CS3 engine but not the After Effects engine when going to CS3. 2d3 has not made any announcement as to if and when they will update SM. If you wish to buy you may be better off with Mercalli.

  • JRun4 Filter Chain problem

    Hi,
    I try to use servlet.Filter in my web app. the Filter works
    fine in Tomcat. but when i deployed it to JRun4(update6), JRun gave
    me this error message as below.
    I tried to google it in the internet, but couldn't find
    anything related to this problem. Please can someone help me?
    Thanks in advance.
    oneduan
    500
    jrun.servlet.JRunInvokerChain
    java.lang.ClassCastException: jrun.servlet.JRunInvokerChain
    at jrun.servlet.FilterChain.doFilter(FilterChain.java:85)
    at myTest.SessionFilter.doFilter(SessionFilter.java:140)
    at jrun.servlet.FilterChain.doFilter(FilterChain.java:94)
    at jrun.servlet.FilterChain.service(FilterChain.java:101)
    at
    jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:91)
    at
    jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
    at
    jrun.servlet.JRunRequestDispatcher.invokeNext(JRunRequestDispatcher.java:534)
    at
    jrun.servlet.JRunRequestDispatcher.forwardInvoke(JRunRequestDispatcher.java:503)
    at
    jrun.servlet.JRunRequestDispatcher.forward(JRunRequestDispatcher.java:177)
    at
    jrun.servlet.file.FileServlet.service(FileServlet.java:316)
    at jrun.servlet.FilterChain.doFilter(FilterChain.java:86)
    at myTest.SessionFilter.doFilter(SessionFilter.java:62)
    at jrun.servlet.FilterChain.doFilter(FilterChain.java:94)
    at jrun.servlet.FilterChain.service(FilterChain.java:101)
    at
    jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:91)
    at
    jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
    at
    jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:259)
    at
    jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:541)
    at
    jrun.servlet.http.WebService.invokeRunnable(WebService.java:172)
    at
    jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(ThreadPool.java:320)
    at
    jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:428)
    at
    jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(ThreadPool.java:266)
    at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)
    ------------------------------------------------------------------------------------------ -------------------------------------

    I find another error message from JRun launcher console.
    ERROR: Translator.CompilationFailedExceptionCompiler
    errors:Note: C:\JRun4\serve
    rs\default\SERVER-INF\temp\dwadj.war-1227002279\07/04
    13:34:39 error jrun.servle
    t.JRunInvokerChain
    java.lang.ClassCastException: jrun.servlet.JRunInvokerChain
    at jrun.servleWEB-INF\jsp\jrun__jsp__index2ejspe.java uses or
    overrides
    a deprecated API.
    Note: Recompile with -Xlint
    eprecation for details.t.FilterChain.doFilter(Filte
    rChain.java:85)
    at myTest.SessionFilter.doFilter(
    SessionFil
    ter.java:140)
    at jrun.servlet.FilterChain.doFilter(FilterChain.java:94)
    at jrun.servlet.FilterChain.service(FilterChain.java:101)
    at
    jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:91)
    at
    jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
    at
    jrun.servlet.JRunRequestDispatcher.invokeNext(JRunRequestDispatcher.j
    ava:534)
    at
    jrun.servlet.JRunRequestDispatcher.forwardInvoke(JRunRequestDispatche
    r.java:503)
    at
    jrun.servlet.JRunRequestDispatcher.forward(JRunRequestDispatcher.java
    :177)
    at
    jrun.servlet.file.FileServlet.service(FileServlet.java:316)
    at jrun.servlet.FilterChain.doFilter(FilterChain.java:86)
    at myTest.SessionFilter.doFilter(
    SessionFilter.java:62)
    at jrun.servlet.FilterChain.doFilter(FilterChain.java:94)
    at jrun.servlet.FilterChain.service(FilterChain.java:101)
    at
    jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:91)
    at
    jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
    at
    jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:
    259)
    at
    jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:
    541)
    at
    jrun.servlet.http.WebService.invokeRunnable(WebService.java:172)
    at
    jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(ThreadPoo
    l.java:320)
    at
    jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.j
    ava:428)
    at
    jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(ThreadPool.
    java:266)
    at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)

  • IR filter encoding problems

    Hi guys,
    I am using IR for my appliation.
    Text coluumns are in cyrilic. When I wan to filter some value(uing IR tools) it dosent work(display ugly text).
    The encoding in dads conf file is "Cyrilic ISO-8859-5 ". I think that this is the problem.
    Can I fix this problem without changing the encoding?
    Regards,
    Slavi

    Hi DarthSlider!
    Welcome to The Canon Forums, and thank you for your inquiry!
    We appreciate your participation, however we need to let you know that the Canon Forum is hosted and moderated within the United States by Canon USA. We are only able to provide support for Canon products manufactured for and used within the US market.
    If you live outside the United States, please click here and select your country or region for your support needs.
    Feel free to discuss Canon products sold outside of the United States, but please be aware that you will not receive support directly from Canon USA.

  • Filter Failed problem wit ML

    Hi,
    I have an iMac with Mountain Lion (recently installed).
    Today i tried to print to my Epson R1900 and i got the "Filter Failed" error and nothing printed.
    I can find that this is a problem which occurs a lot with ML & Epson printers, is there a solution ?
    When trying to delete the printer and reinstall many times the printer cannot be seen by iMac & ML.
    When successfull (reinstalling Epson driver) this does not solve the issue (Filter Failed message keeps occurring).
    br.
    Peter

    I had the same issue, tried everything except using gutttenprint drivers as they don't support scan.
    Finally, I re-installed OSX completely from OSX utilies on the recovery disk using cmd R when booting the mac.
    OSX took over 6 hours to download and install itself back.  THe following morning the Mac was on and ready.
    I can print now.

  • B1i Scenario Filter Definitions problem

    Hello gurus,
    we copied the IC.Purchasing scenario in order to create a new one but using the setup wizard the filter definitions do not seem to appear anywhere.
    Is there some different way i could set them up?
    Thanks in advance!

    In case anyone has the same problem;
    it would appear, in the Scenarios -> Package Design -> Definitions -> Criteria Fields menu, i had entered a wrong name in the Default Steps column.
    After that, in the wizard setup the filter definitions appear correctly.

  • K9A ATI Filter Driver Problem

    Looking for some ideas about this problem....
    Crossfire system, x1950's in Vista 32bit.
     This system was rock solid for months, until cataylst 7.7, but problem may not be related two catalst. System started having memory errors, PFN and memory manager errors, removing a stick of memory cleared up the errors, and catalst stopped showing an option for crossfiring so i removed the second video card.
    I now have one stick of memory and one video card installed and the systen is stable. I have completely removed catayst and reinstalled and it's stable.
    When i put the second stick of memory in, I blue screen. (already tried different memory)
    The southbridge filter driver shows resource problems  "Input/Output Range 0000 - 0CF7 used by and ACPI x86-based PC Memory Range 40000000 - FFFFFFFF not available."
    ATI's not much help, any ideas?
    Thanks, Bretware

    Just to make things clear:
    Do all the memory sticks you try work if they are alone?
    With only one stick of memory "even" Catalyst 7.7 works?
    But Crossfire wont work in any situation?
    There is some kind of crossfire bridge or bracket between the two graphics cards, isn't there, that has caused all kind of problems.
    Other than that, one thinks of Vista having a problem getting things in the right order - may have trouble with anything. What is the system temperature?

Maybe you are looking for