Passing binary output in servlets

Hi all,
I am new to struts.In Jsp i need to give three text field values
1.category
2.two date fields.
On click of submit button,it should export the csv file from db into excel sheets.
If i didnt give the input values properly and clicking the submit button will display the error msg.
But next time if i give the proper input values,then it should disappear.
but my problem is the err msg is not removing from jsp but export is working and in my console :
SEVERE: Servlet.service() for servlet action threw exception+
java.lang.IllegalStateException: Cannot forward after response has been committed*
**and in my action class:**
The following condition is to check existence of err:
if (category.length() == 0 || startdate.length() == 0
                    || enddate.length() == 0) {
               ActionMessages errors = this.getErrors(request);
               errors.add("fatal", new ActionMessage(DATE_FIELD_MISSING, ""));
               saveErrors(request, errors);
               return mapping.findForward("failure");
The following code is for export  the data:+
if (category.equals("book")) {
               String fileName = "part.csv";
               response.setContentType("application/octet-stream");
               response.setHeader("Content-Disposition", "attachment; filename=\""
                         + fileName + "\"");
               try {
                    OutputStream oStream = response.getOutputStream();
                    oStream
                              .write(" Number, Description, Revision, Dummy, Manual, Classification, Owner, Global Effective Date, Global Expiration Date, New Part\n"
                                        .getBytes());
                    for (int i = 0; i < result.size(); i++) {
                         PartDTO part = (PartDTO) result.get(i);
                         StringBuffer sbpart = new StringBuffer(part.getPartNumber());
                         sbpart.append(',');
                         sbpart.append(part.getPartDescription());
                         sbpart.append(',');
                         sbpart.append(part.getRevision());
                         sbpart.append(',');
                         sbpart.append(part.getIsDummy());
                         sbpart.append(',');
                         sbpart.append(part.getIsManual());
                         sbpart.append(',');
                         sbpart.append(part.getClassification());
                         sbpart.append(',');
                         sbpart.append(part.getOwner());
                         sbpart.append(',');
                         sbpart.append(part.getEffectiveDate());
                         sbpart.append(',');
                         sbpart.append(part.getExpirationDate());
                         sbpart.append(',');
                         sbpart.append(part.getIsNewPart());
                         sbpart.append("\n");
                         oStream.write(sbpart.toString().getBytes());
                    oStream.close();               } catch (IOException ioe) {
return mapping.findForward("success");
I think oStream.close() will return to jsp .. so the last return statement is not working..
I dont know how to do it in someother way......Plz help me.its urgent yaar......Thanks in advance....

It's been awhile since I've used Struts, so don't put too much stock in this answer. That said...
Generally, you should not close the response output stream, ever. The application server takes care of this, when and if the time is right.
Also, it appears that you're writing output within an action, and then forwarding to a JSP. If you want to write binary output or some other type of output for which a text-template based JSP is not appropriate, forward to a plain old servlet, and write your output there. Define the servlet as you would any other in web.xml, and dispatch to it from Struts instead of going to a JSP.
Good luck!
- Jerry Oberle

Similar Messages

  • How to send a binary output from ni daq 6009

    I am trying to get a binary output from ni daq 6009 to make the selections of a multiplexer.
    I am trying to make the selection directly from the labview program.
    Please help me in getting this binary output from ni daq 6009 to do the selection

    Try something like this. 
    I'm not a fan of daq-assistant express vi's... use the primitives.  Create the task outside the main structure, pass that task inside the loop and do a write where needed.  Close the task after the main loop.  This improves speed and labview performance.
    Attachments:
    ocelot.png ‏43 KB
    ocelot.vi ‏21 KB

  • Passing the output to another program

    Passing the output to another program
    The problem I have that I don�t know how to pass the results of my java Program ( as parameter) to another application!
    I have a class �A.class� should send result �VAR_result� to application �B.application�
    Now I am using it like this: System.out (VAR_result) >> B.application
    But it could not be the right way at least because I cant make any other System.out as debug now.
    My Question please: to pass a parameter to a java is clear: A.class ( var ..)
    But how to take a parameter from a class, to use it in another Applicatin ( script )?
    Thanks a lot

    slackware2007 wrote:
    Passing the output to another program
    The problem I have that I don&#146;t know how to pass the results of my java Program ( as parameter) to another application!
    I have a class &#147;A.class&#148; should send result &#147;VAR_result&#148; to application &#147;B.application&#148;
    Now I am using it like this: System.out (VAR_result) >> B.application
    But it could not be the right way at least because I cant make any other System.out as debug now.Then move your debug to System.err and use System.out as it should be used and pipe stdout to the stdin of the other application..

  • How to display binary output in numeric indicator

    Hai
        How to display binary output in a Numeric display.
    in my program i use numeric display for displaying numeric values in one case
    in the other case i want to display binary output in the same numeric display window as binary,
     i don't want to make seperate o/p display for binary o/p i want change the property of the Numeric display to binary display .
    is it possible to display Binary data in numeric indicator, please give me an idea to do this.
    thanks
    sk
    Attachments:
    DBL2BIN.vi ‏39 KB

    Alternatively, you can use the FormatString property node, and use %08b as format string : 08 means : pad the output with 0 to get a 8 digits wide result.
    See attachment.
    Chilly Charly    (aka CC)
             E-List Master - Kudos glutton - Press the yellow button on the left...        
    Attachments:
    DBL2BIN[1].vi ‏21 KB

  • Servlet to pass parameter to another servlet

    Hi, I have a question. I have two servlets, servler A and servlet B. I wanna do this:
    1)servlet A to pass a parameter to servlet B. No redirect is required.
    2)servlet B to accept the parameter.
    How do I do that?
    Thanks

    1)servlet A to pass a parameter to servlet B. No redirect is required.
    2)servlet B to accept the parameter.I completely agree with what capitao suggested.
    As U said tht u need not require a redirect functionality
    U actually need to implement a proxy kind of mechanism in this case
    You may also go by using HttpURLConnection Object to retrive the info by passing few parameters.
    checkout an eq code down below
    HttpURLConnection server = (HttpURLConnection)(new URL("http://<hostname>:<port>/servletC")).openConnection();
    server.setRequestProperty("testParam","testParam");
    InputStreamReader isr = new InputStreamReader( server.getInputStream() );
    BufferedReader in = new BufferedReader( isr );
    response.setContentType( "text/html" );
    PrintWriter outStr = response.getWriter();
    String line = "";
    while((line = in.readLine()) != null) {
    outStr.println( line );
    }

  • Formatting Binary Output

    I want to format binary output in text fields to confrom to the following scheme:
    head data1 data2 return offSet id
    6 bits 5 bits 5 bits 5 bits 5 bits 6 bits
    where the first row are field names and the second is the filed width.
    What that means is that, using the value 1 (base 10) as an example, a 6 bit filed will read 000001 and so a 5 bit field will read 00001.
    My program converts to binary no worries, but how do I enforce the width requirements? I am using Integer.toBinaryString(int) to convert, if that helps.
    Thanks

    public String intToJustifiedBinaryString(int number, int length)
      StringBuffer buffer = new StringBuffer(Integer.toBinaryString(number));
      while (buffer.length() < length)
          buffer.insert(0, "0");
      return buffer.toString();It works great! Now for the learning. I looked up StringBuffer and found this explanation:
    StringBuffer(String str)
    Constructs a string buffer so that it represents the same sequence of characters as the string argument; in other words, the initial contents of the string buffer is a copy of the argument string.
    What I am trying to figure out is how it is not overwriting what already exists in the buffer. Lets pretend with int = 7 and a 6 bit field.
    So initially, buffer.length() = 3 and my buffer looks like 1 1 1.
    From the API: The principal operations on a StringBuffer are the append and insert methods, which are overloaded so as to accept data of any type. Each effectively converts a given datum to a string and then appends or inserts the characters of that string to the string buffer. The append method always adds these characters at the end of the buffer; the insert method adds the characters at a specified point.
    If I am specifying my insert point as 0 (insert(int offset, char c) Inserts the string representation of the char argument into this string buffer.) How am I not overwriting one of my bits comprising my binary 7? My only guess is that insert operation first shifts what is already there over the necessary amount, based on the length of what is being inserted, before inserting at the specified point. I have read nothing to support this theory. Please let me know if it is correct.
    Thanks for the help!

  • Passing Session info between servlets

    We are running WebLogic 5.1, sp 4 and Apache 1.3 on Solaris 2.6 and we are
              successfully proxying requests to the server. But we are unable to pass
              session information between servlets. We are NOT using URL encoding. We are
              instead using cookies. We believe our configuration is correct because the
              BEA example session servlet works. Does anyone have any recommendations or
              suggestions?
              Thank you,
              Jorge
              Jorge A. Martin
              Systems Analyst
              The Kinetic Group
              1950 Stemmons Freeway, Suite 3040
              Dallas, Texas 75207
              

    This is a basic misunderstanding of how Java Works:
    String name +r = request.getParameter(name +r);1) You can't use a + on the left part of an assignment operation - it must be a plain variable reference. This isn't like JavaScript where you have an eval(...) capability.
    2) Your Strings are being defined inside the For Loop, which means they will leave scope once the loop ends and you won't be able to refer to them anymore.
    3) Is there already a String value named 'name' which you are using in getParameters(name+r)? You should probably use getParameter("name"+r) instead.
    What you want to do is either put the values in an array so they are easy to access:
    String name[] = new String[value1];Then loop through the parameters to assign values:
    for(int r = 0; r< value1; r++) { //Start at 0 to value1-1 because arrays are 0 based.
      String nameParam = "name"+ (r+1);
      name[r] = request.getParameter(nameParam);Now I can access the names in order:
    name1 via name[0]
    name2 via name[1]
    name3 via name[2]
    etc...Before going any further I would stop working on Servlets and go back to some good Basic Java Tutorials and books until you get a better grasp of how the language works.

  • Is it possible to Pass Binary Image Data to Logical DSP via ALDSP Control?

    I have run into an issue trying to pass binary image data (hexBinary in the WSDL) from WLI's ALDSP Control to a logical service in ALDSP 3.0. I was wondering if anyone has done this successfully, and if so, can you offer any advice?
    The following error is generated:
    Caused by: com.bea.dsp.das.exception.DASException: weblogic.xml.query.exceptions.XQueryTypeException: {err}XP0006: "element {commonj.sdo}datagraph { {commonj.sdo}DataGraphType }": bad value for type element {http://idexx.com/lims/domain/image}Image { {http://idexx.com/lims/domain/image}Image }*
    at com.bea.dsp.das.ejb.EJBClient.invokeOperation(EJBClient.java:160)
    The snippet of code that I am using in the WLI to communicate with the ALDSP control is:
    try {
    byte[] bytes2;
    bytes2 = reportText.getBytes("UTF-8");
    Image image =createNewImage();
    image.setImage(bytes2);
    image.setImageFormat("XML");
    image.setImageType("RESULTS REPORT");
    image.setOwningLabId( owningLabId);
    image.setExpirationType("EXPA");
    image.setAddedBy (BigInteger.ONE);
    image.setScanDate(XMLHelper.toXSDDateTimeFormat(new Date()));
    Image[] sdos = new Image[1];
    sdos[0]= image;
    logDebug(sdoHelper. dataObjectToXml(image));
    System.out.println(sdoHelper. dataObjectToXml(image));
    imageDSPControlFile.createImage(sdos);
    sdoHelper. dataObjectToXml(image);
    } catch (UnsupportedEncodingException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    throw new RuntimeException(e.getCause());
    Lastly, the WSDL schema is as follows:
    <?xml version="1.0" encoding="UTF-8"?>
    <schema xmlns="http://www.w3.org/2001/XMLSchema"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://idexx.com/lims/domain/image"
    xmlns:tns="http://idexx.com/lims/domain/image"
    elementFormDefault="qualified">
    <xs:element name="Image" type="tns:Image" />
    <xs:complexType name="Image">
    <xs:sequence>
    <xs:element name="imageId" type="xs:integer" minOccurs="0"/>
    <xs:element name="image" type="xs:hexBinary"/>
    <xs:element name="scanDate" type="xs:dateTime"/>
    <xs:element name="imageFormat" type="xs:string"/>
    <xs:element name="imageType" type="xs:string"/>
    <xs:element name="expirationType" type="xs:string"/>
    <xs:element name="owningLabId" type="xs:integer"/>
    <xs:element name="addedDate" type="xs:dateTime" minOccurs="0"/>
    <xs:element name="addedBy" type="xs:integer" minOccurs="0"/>
    </xs:sequence>
    </xs:complexType>
    </schema>

    WLI's ALDSP Control This is actually ALDSP's ALDSP Control - but you can call it from WLI. Check the Advanced Samples announcement in this forum for examples of using the ALDSP Control
    - mike

  • Console grab binary output

    I'm playing around with a small app that will save mysqldump output to file.
    I managed to get it working, except when there's binary data on blob fields.
    So, if I run from a console:
    mysqldump -h server -u uni testdb > /tmp/test.1sql
    and then the program listed below, I get excessive garbage in the binary fields and file sizes grow up:
    -rw-r--r-- 1 nobody nobody 4535097 Aug 20 14:36 /tmp/test1.sql
    -rw-r--r-- 1 nobody nobody 6493448 Aug 20 14:51 /tmp/test.sql
    So, I tried executing with the --hex-blob flag in the mysqldump command, but in this case I've to pay the extra size cost:
    -rw-r--r-- 1 nobody nobody 7131966 Aug 20 14:47 /tmp/test1.sql
    As you will see, I'm grabbing the contents through an InputStreamReader
    and then I write they with OutputStreamWriter. I didn't choose execute the command and save the file by the console 'cause I would prefer know what's going on, count bytes, showing a progress or whatever...
    I would like to know how could I grab the binary output of the command ?...
    It seems like the sh command is not binary...
    Thank you!
    This is the code:
    class StreamGobbler extends Thread
    InputStream is;
    String type;
    String Filename;
    StreamGobbler(InputStream is, String type,String Filename)
    this.is = is;
    this.type = type;
    this.Filename=Filename;
    public void run()
    try
    PrintWriter out;
    InputStreamReader isr = new InputStreamReader(is);
    BufferedReader br = new BufferedReader(isr);
    if (type=="ERROR") {
    FileWriter outFile = new FileWriter("/tmp/error.log");
    out = new PrintWriter(outFile);
    String line=null;
    while ( (line = br.readLine()) != null)
    if (type=="ERROR") {
    System.out.println(type + ">" + line);
    out.println(line);
    } else {
    out.println(line);
    out.close();
    } else {
    // FileWriter outFile = new FileWriter(Filename);
    // out = new PrintWriter(outFile);
    FileOutputStream fos = new FileOutputStream(new File(Filename));
    OutputStreamWriter outs = new OutputStreamWriter(fos,"UTF8");
    int len = 512;
    char buf[] = new char[len];
    int numRead;
    while ((numRead = isr.read(buf, 0, len)) != -1)
    outs.write(buf, 0, numRead);
    outs.close();
    } catch (IOException ioe)
    ioe.printStackTrace();
    public class mxdump {
    public mxdump(String Cmd) {
    try {
    Cmd="/bin/bash /usr/bin/mysqldump -h server -u uni testdb";
    /* String cmd[]={"sh", "-c",Cmd,""} ; //"mysqldump";
    ProcessBuilder pb=new ProcessBuilder(cmd);
    System.out.println("Start");
    pb.start();
    System.out.println("Termino"); */
    String cmd[]={"sh", "-c",Cmd,""} ;
    Runtime rt = Runtime.getRuntime();
    System.out.println("Execing " + cmd[0] + " " + cmd[1]
    + " " + cmd[2]);
    Process proc = rt.exec(cmd);
    // any error message?
    StreamGobbler errorGobbler = new
    StreamGobbler(proc.getErrorStream(), "ERROR","");
    StreamGobbler outputGobbler = new
    StreamGobbler(proc.getInputStream(), "OUTPUT","/tmp/test.sql" );
    // kick them off
    errorGobbler.start();
    outputGobbler.start();
    // any error???
    int exitVal = proc.waitFor();
    System.out.println("ExitValue: " + exitVal);
    catch(Throwable t)
    //System.out.println(e);
    t.printStackTrace();
    }

    Don't use Readers and Writers on binary data. Use Streams.

  • Display PDF from BAPI's binary output

    Dear All,
    I am struck badly with this scenerio here.
    we have a Bapi which is generating an adobe form in the backend and providing that as an attribute of type binary.
    i used the following code to display that binary output, to be opened in Acrobet reader.
    byte[] pdfContent= wdContext.nodeZhra_Get_Lettertype_Desc_Input().nodeOutput().currentOutputElement().getE_Bin_File();
         IWDCachedWebResource pdfResource = WDWebResource.getWebResource(pdfContent,WDWebResourceType.PDF);
         IWDWindow win = wdComponentAPI.getWindowManager().createExternalWindow(pdfResource.getURL(),"PDF in Arabic",true);
         win.setTitle("PDF in Arabic");
         win.removeWindowFeature(WDWindowFeature.ADDRESS_BAR);
         win.removeWindowFeature(WDWindowFeature.TOOL_BAR);
         win.removeWindowFeature(WDWindowFeature.MENU_BAR);
         win.removeWindowFeature(WDWindowFeature.STATUS_BAR);
         win.show();
    the problem is that the acrobet reader opens and says it could not display the file and it may be not supported or might be damaged.BUT
    1. the file is being generated and correctly displayed on another system
    2. both systems have the same version and updates of acrober reader 9.
    Kindly let me know the solution or some work-around to solve this problem. Is there a way,where i should use interactive form to do this...
    thanks in advance

    Hello!
    If it works on one client but not on the other i think it is not a Server problem.
    Check th following:
    Open the document in the Browser where it is displayed and save it on a thumbdrive and open it on the other client.
    -> If it works: it must be Browser settings
    -> If not: the generated PDF is not valid for the Adobe Reader of the other client.
    If it works on the Server but not on the client, try to dump it to a file on the Webserver to see if the BAPI call (RFC/WS) is the problem. When you use XString for exampe I think there is a problem with the data beeing split into several lines. If you have the file you should be able to open it. Compare the size of the File on the WebAS and the backend.
    Kind regards
    Matthias
    Edited by: Matthias Schneider on Nov 4, 2008 6:19 PM

  • Binary output from two tags

    Hi
    I'm having problems outputting a binary image from a tag handler more than once. This is apparently a known problem with JSP but I was wondering if anyone had found a workaround (other that writing a servlet).
    The basic problem is that if you call ServletResponse.getOutputStream() more than once in a page or if you call it after ServletResponse.getWriter() has been called then you get:
    java.lang.IllegalStateException: getOutputStream() has already been called for this response
    The result is that Tag Libraries are a technology that doesn't allow you to output two binary things directly onto a page or to output any binary data if you've also output text or vice versa. That sounds extraordinarily bad to me.
    I know there must be good reasons for the difficulty but surely there's a fix or a well known workaround.
    Has anyone out there got over this problem or know whether any fixes are planned? Thanks.
    Murray

    You can call either getOutputStream or getWriter, and you can it only once (it assumes you'll assign that to a variable and use the variable from then on). It's not a bug or problem, it's a reasonable restriction to prevent you from doing what I think you are trying to do....
    So you can use the writer to write text-based output, or the output stream to write binary data.
    But this is somewhat irrelevent. You can't output HTML and include binary data, like an image, in the HTML.
    <div>here is some text, followed by an image</div>
    <div>0a68df9834ce7932d....</div> <-- binary data...
    The browser has no idea what to do with that. That's why you have image tags and object/embed tags in HTML. And the browser has to make a separate request to get the content for the image tag. So the servlet can output image data or other stuff, if the image tag is used to call a servlet to serve an image. But they are not doing with the same call the a servlet (and usually you have separate servlets for that stuff).
    Ultimately, this is not a JSP/servlet issue. This is strictly and HTML, HTTP, browser issue: That's how it works and has worked since long before JSP and servlets came about. JSP/servlets do not change how HTML and browsers work in any way/shape/form. They only allow for dynamically generating content the browser gets.

  • How to pass parameters/atrributes to Servlet from ALBPM

    HI Friends,
    I am invoking servlet from bpm using server configuration, i am able to invoke servlet, but not able to pass parameters dynamically,
    Also I like to receive response parameters/attributes from servlets?
    Can any body help me on this?
    Look forward for response.
    Cheers

    Some helpful Docs on the WebServer component for you:
    The WebServer component is used to send HTTP requests to an HTTP server and capture the responses. It supports HTTP methods GET and POST.
    The body of the HTTP response is available in the WebServer.response attribute (String).
    Note: This component is superseded by the Fuego.NetX.AdvancedWebServer component, which provides better performance and more functionality like support for proxies and for more HTTP methods (like PUT and DELETE).
    Example: Get Oracle's website home page and save it to a file.
    getFrom(WebServer, url : "http://oracle.com", args : null)
    binaryResponse = Binary(text: WebServer.response,
    encoding: "UTF8")
    BinaryFile.writeFromBinaryTo(data : binaryResponse,
    name : "/tmp/oracle_index.html",
    append : false)

  • Problem writing to output using servlet

    Hi All,
    I created a servlet which reads file and writes to output . This works fine
    when request protocol is http . But if protocol is changed to https servlet doesnt write to output. This servlet is deployed in secure environment as EAR project .But pops up error in popup
    Internet explorer cannot download /ImageServlet/.... from the server....
    requested site is unavailable.
    Here is my servlet code
                        String key = request.getParameter("key");
                        if( key != null){
                             String[] keys = key.split(":");
                             System.out.println("request.getAuthType() :"+ request.getAuthType());
                             if(request.getAuthType() != null){
                             if(keys != null && keys.length >1){
                                  ImageUtil imageUtil = new ImageUtil();
                                  byte[] bytes = imageUtil.getDocumentContent(keys[0]);
                                  ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
                                  BufferedInputStream bis = new BufferedInputStream(bais);
                                  ServletOutputStream out = response.getOutputStream();
                                  BufferedOutputStream bos = new BufferedOutputStream(out);
                                  response.reset();
                                  if(keys[1].equalsIgnoreCase("doc") ) {
                                       response.setContentType("application/msword;charset=utf-8");
                                       response.setHeader("Content-Disposition","inline;filename=\"file.doc\";");
                                  }else if(keys[1].equalsIgnoreCase("xls") ) {
                                       response.setContentType("application/vnd.ms-excel");
                                       response.setHeader("Content-Disposition","inline;filename=\"file.xls\";");
                                  }else if(keys[1].equalsIgnoreCase("rtf") ){
                                       response.setContentType("application/msword");
                                       response.setHeader("Content-Disposition","inline;filename=\"file.rtf\";");                         
                                  }else if(keys[1].equalsIgnoreCase("html") || keys[1].equalsIgnoreCase("htm")){
                                       response.setContentType("text/html");
                                       response.setHeader("Content-Disposition","inline;filename=\"file.html\";");                         
                                  }else if(keys[1].equalsIgnoreCase("txt")){
                                       response.setContentType("text/plain");
                                       response.setHeader("Content-Disposition","inline;filename=\"file.txt\";");                         
                                  //setting some response headers
                                  response.setHeader("Cache-Control","no-store, no-cache, must-revalidate,post-check=0, pre-check=0"); //HTTP 1.1
                                  response.setHeader("Pragma","no-cache"); //HTTP 1.0
                                  response.setDateHeader ("Expires", 0);
                             int i;
                             while ( (i = bis.read(bytes)) > 0)
                                  bos.write(bytes,0,i);
                             bos.flush();               
                             bos.close();
                             bis.close();
                             bais.close();
                             System.out.println("Has written");
                             }else{
                                  log.error("Key is not good.");
                   }else{
                        log.error("Please enter key for streaming.");
              }catch(Exception e)     {
    log.error(e.toString());
    e.printStackTrace();
    In web.xml
         <servlet>
              <servlet-name>ImageServlet</servlet-name>
              <servlet-class>
                   com.pfpc.opdesktop.image.servlet.ImageServlet
              </servlet-class>
         </servlet>     
         <servlet-mapping>
         <servlet-name>ImageServlet</servlet-name>
         <url-pattern>/ImageServlet/*</url-pattern>
         </servlet-mapping>
         <security-constraint>
              <display-name>ImageServlet</display-name>
              <web-resource-collection>
                   <web-resource-name>ImageServlet</web-resource-name>
                   <description>ImageServlet</description>
                   <url-pattern>/ImageServlet/*</url-pattern>
                   <http-method>GET</http-method>
                   <http-method>POST</http-method>
                   <http-method>OPTIONS</http-method>
              </web-resource-collection>
              <auth-constraint>
                   <description>ImageServlet</description>
                   <role-name>ImageServlet</role-name>
              </auth-constraint>
              <user-data-constraint>
                   <transport-guarantee>NONE</transport-guarantee>
              </user-data-constraint>
         </security-constraint>
              <security-role>
              <description>ImageServlet - OpDesktopWAR</description>
              <role-name>ImageServlet</role-name>
         </security-role>
    In application.xml
         <security-role id="SecurityRole_1164052833984">
              <description>ImageServlet - OpDesktopWAR</description>
              <role-name>ImageServlet</role-name>
         </security-role>
    Can anyone please tell me what is problem.very urgent.
    Thankyou

    Hi,
    Found the solution for the problem. For some reason
    response.setHeader("Cache-Control","no-store, no-cache, must-revalidate,post-check=0, pre-check=0"); //HTTP 1.1
                                  response.setHeader("Pragma","no-cache"); //HTTP 1.0
                                  response.setDateHeader ("Expires", 0);
    These header settings were causing this issue. If I take out these settings then it works
    FYI
    Thankyou very much for all help

  • How to pass a JavaBean from servlet to JSP?

    Hi there,
    I am working on a project that needs to handle quite a few client requests and I want to use the Front Controller pattern that is described in the J2EE pattern page.
    The steps described in the front controller pattern is that:
    1. A servlet (controller) process the client request.
    2. It calls the appropriate cammand object and the cammand object gets the data from the data source and returns a JavaBean that contains the required data.
    3. The servlet dispatch to the appropriate View (jsp page)
    4. The JSP page displays the data in the JavaBean to the user.
    However, I don't know how to pass the JavaBean from the servlet to the JSP page when the servlet forwards the control to the JSP page. Should I make the JavaBean with a request scope or higher? If so, how to uses it in the JSP page? Just refer by the ID of the JavaBean.
    If any one knows there is an example or tutorial on how to use this pattern, please let me know.
    Thank you !
    Regards
    Edmund

    Could you please give more info? i tried to do this, but always get a "Class not found exception":
    response$jsp.java:65: Class org.apache.jsp.TestBean not found. TestBean bean = null;
    although the class TestBean (no package name => defalt package) is in the WAR file and the Servlet seems to instantiate it (otherwise an exception would occur sooner in the TestServlet code).
    my JSP code is:
    <%@ page language="java" info="Response page" %>
    <jsp:useBean id="bean" class="TestBean" />
    <%
    TestBean bean2 = (TestBean) request.getAttribute("TheBean");
    %>
    <html>
    <body>
    Your value: <%= bean2.getValue() %><BR>
    My val: <%= bean2.getNewValue() %><BR>
    <P>
    Date: <%= new Date() %>
    <P>
    Neuen Wert eingeben
    </body>
    </html>
    --------------

  • Passing binary information in a synchronous scenario

    Hi All,
    I am working on a synchronous scenario where I am sending an HTTP request to third party and I am getting back the response. My requirement is that I need to pass through this response as it is from XI, no transformation is required.
    This happens twice:
    1) In first case, I receive the html data which is ok
    2) in second case, I receive PDF data which is getting corrupted and I cant view that pdf data after my message mapping.
    I am  using below code in response mapping (java mapping)....
    public void transform(TransformationInput in, TransformationOutput out) throws StreamTransformationException {
        try {
        String sourceString = "";String line ="";
        String append ="";
        InputStream ins = in.getInputPayload().getInputStream();
        BufferedReader br = new BufferedReader(new InputStreamReader(ins, "UTF-8"));
    while ((line = br.readLine()) != null){
         sourceString = sourceString + line;
        br.close();
        out.getOutputPayload().getOutputStream().write(sourceString.getBytes("UTF-8"));
        catch (Exception e) {
               throw new StreamTransformationException(e.getMessage());
    Problem is that this code is working for case 1) when I receive HTML data but in case 2) the data gets corrupted.I think I would need to pass the response as binary data (as it is) for both the cases.
    Do not forget that it is a synchronous interface so I do not have the option to bypass the IR development since I am making some transformation in the request mapping.
    Can anyone suggest.
    Thanks,
    Ravi.

    Hello Ravi,
    You are reading inputstream in character mode. i.e., BufferedReader
    You should read the content in byte mode
    Try with this code:
    byte[] buffer = new byte[1024]; 
    public void transform(TransformationInput in, TransformationOutput out) throws StreamTransformationException {
        try {
      InputStream is = (InputStream) in.getInputPayload().getInputStream(); 
      OutputStream os = (OutputStream) out.getOutputPayload().getOutputStream();
      while ((int len = is.read(buffer)) > 0) 
      os..write(buffer, 0, len);                                                    
      } catch (Exception e) {
               throw new StreamTransformationException(e.getMessage());
    Regards,
    Praveen Gujjeti
    Message was edited by: PRAVEEN GUJJETI

Maybe you are looking for

  • Can't find printer in air print

    Cannot find my Samsung printer on my iPhone 5.  On same wifi network; prints wirelessly from PC; printer model is air print enabled; only way to print from iPhone is using clunky Samsung print app.  Am I missing something here?

  • ABAP Dictionary Activation Ended with errors - View missing

    [http://www.flickr.com/photos/38387539@N02/4393402777/] [http://www.flickr.com/photos/38387539@N02/4393402771/] Hi All, I transported a table with additional new fields to production system but the transport log shows that the table could not be acti

  • Collection of Items

    Hi virtual colleagues! Could anyone please ans. my comments in the code. Thanks for any help! : ) //This is TEST DRIVER for VendingMachine Class. public class VmTrial public static void main(String []args)   VendingMachine vm = new VendingMachine();

  • LabVIEW 8.6.1 Installation Builder Crashes Windows 7

    Hello, my very helpful friends.  I have what I think to be a rather complicated issue and for which I've run out of ideas.  Recently, I had to go through the dreaded enterprise wide Windows 7 upgrade.  Upon completing that slog, I reinstalled LabVIEW

  • Utility method

    I know PreparedStatements help prevent SQL injection and ticks. The only thing I notice is it doesnt handle greater than and less than such as < with a > entry in a form. When they are entered into a form that populates oracle it seems to disappear w