URL Rewriting in JSP/Servlets

Enabling URL rewriting for session support where cookies are switched off, results in the URL being rewritten as myURL/$SessionID$a_very_long_string.
I believe that the /$SessionID$ is configurable on the server, does anyone know how ?
OAS version 4.0.8.1. patched with JSP support.

Why is it placing a ';' before jsessionid ? Shouldn't
it be a '&'? The current result is a page not found.Your url looks ok to me. '&' seperates parameters. I'm using the Struts framework to handle those ugly details and it generates urls like this one for me:
http://localhost:8080/JspMini/main.jsp;jsessionid=C2C1C2D9C6106758047127038554C813
Looks like you have another problem...
HTH, Markus

Similar Messages

  • URLs with a JSP-servlet architecture

    I on of my webapp, there is a servlet that forward the request to a JSP. Please tell me why
    <form name="theForm" method="GET" action="thPackage.TheClass">works while:
    <form name="theForm" method="POST" action="thPackage.TheClass">dont. ???

    Could it be because of the you have specified only <http-method>GET</http-method>
    but not <http-method>POST</http-method> in the web deployment descriptor web.xml ?

  • Automatic URL rewriting in jsp

    Hi,
              IBM has this cool thing called session tracking which automatically
              causes all JSPs being compiled to be parsed, and HREFs are
              encoded automatically via encodeURL() function.
              Is there a weblogic property for this?
              Thanks,
              Andy
              

    It would need to handle not only href's, but meta refresh tags,
              and post actions, and probably several other possibilities...
              I'd rather be safer and make sure its right to begin with in the
              source code, than relying on a compiler to do the work for you.
              Jason
              "Andrew Nuss" <[email protected]> wrote in message news:[email protected]..
              > Hi,
              >
              > IBM has this cool thing called session tracking which automatically
              > causes all JSPs being compiled to be parsed, and HREFs are
              > encoded automatically via encodeURL() function.
              >
              > Is there a weblogic property for this?
              >
              > Thanks,
              > Andy
              >
              >
              >
              

  • Clean URLs with JSP/Servlet

    Hello. I've found some information on how to setup clean URLs for php, but none for JSP/servlet. Hopefully some one can help. Here's what I mean by 'clean URL':
    http://mydomain/employee.jsp?employeeID=1232
    becomes
    http://mydomain/employee/1232
    And, in that second example, the container would dispatch all requests for /employee* to some JSP/servlet. I don't care if the 'clean URL' has to have an extension or not (e.g. mydomain/employee.jsp/1232) although I would prefer to also remove the JSP extension.
    Additionally (if some one has experience with this need): how do I then access the final part of the URL supplied by the client? In other words, how would 1232 be available to the destination JSP/servlet? Does the container convert it into a parameter, i.e.:
    1) client sends request for "mydomain/employee/1232"
    2) container delegates request to "mydomain/employee.jsp?1232"
    Finally (sorry about the length), I don't have access to top-level config files for this site (it's personal use, although I'm pretty familiar with java APIs from my job), so, ideally, I'd like a .htaccess level solution, where the container can just re-route to a JSP.
    If any one has some suggestions, I'd GREATLY appreciate it. Thanks for your time. Take care.

    ...Just occurred to me- this hosting company is NOT using Tomcat. They use resin.
    Thanks.

  • How do I get the URL of a jsp page which calls a servlet?

    I have a jsp page which will lead to a servlet, I can get the URL of the servlet, but how do I get the URL of the jsp page which lead to the Servlet in the servlet?

    You could try doing:
    request.getHeader("Referer");

  • Difference between GET and URL Rewriting in Servlets

    What is the difference between GET and URL Rewriting in Servlets?.Please illustrate with an example.

    Thanks for your reply gimbal.
    GET appends query string at the end of the URL. URL rewriting also does the same thing. It also appends query string right?. Then what is the difference between two. I have this question in my mind for long time.To my surprise an interviewer asked this question in an interview also.

  • URL mapping  between jsp and servlet

    recently, I try glassfish, and I get surprised, for example My application name is HelloWorld if I have jsp action to servlet I can't use action ="servlet/myservlet1" I have to use
    action="HelloWorld/myservlet " if I put my servlet2 under test folder I can't call this servlet by servlet/test.servlet2, I have to use HelloWorld/servlet2,. I realize that is not glassfish problem , I just wonder is any one could give more expiration on servlet mapping ??
    Thank you !

    Depends on several factors. In which context and how exactly are you specifying the URL? In client context, the leading "/" brings you to domain root. In servlet context, the leading "/" brings you to context root. The HTML <a> element is relative to client context and JSTL <c:url> is relative to servlet context. That kind of things.

  • Determine an URL from an identifier (servlet name, jsp name or something)

    I would like to write URLs in my JSP files, but I don't want to hardcode them. Is any way to use the datas from the web.xml?
    So I would write the name of the Servlet / name of the JSP file and it would resolve to an URL.
    Is any method for this?
    Very thanks your help!

    The server will load the properties file into memory so there will be some memory overhead. The actual amount of memory used will be server dependent. If you want to make sure the file is loaded just once and the data cached for the entire application set the scope in the fmt:setBundle tag to application. This means the file will be loaded once and stored in memory. The cache will be maintained for the life of the application.
    If you want to free memory when the the properties aren't needed, then you can set the scope in the fmt:setBundle tag to page (the default), which will allow (but not force) the memory used by the cache to be released when memory is low.
    Note that there are 2 scopes at play here, the properties file is loaded and cached in the resource-loading process so the file would only need to be re-loaded when the data changed. The second is the scope the bundle is stored in for the web application. As long as the web application holds the bundle, the resource cache will not be freed. When the reference is released by the web application the cache may be released if memory requires it, or may be kept so the next time the resource is needed there isn't an overhead related to loading the bundle again.
    Setting the scope in the fmt:setBundle to page is the most flexible use, because it allows the Resource cache to hold the properties file in memory then just provide references as needed (much like if you had the scope set to application), but also allows the cache to be free its memory if required.
    In the particular example provided above, you don't have control of the Resource Caching. You could implement your own implementation of a ResourceBundle and use ResourceBundle.Control to configure the Cache. This could be done invisibly behind the scenes if you find the memory used by the default implementation too much.

  • URL rewriting in Weblogic JSP

    [att1.html]
              

    Hi,
              I believe that you will have to use encodeURL for any URL in your HTML
              output. Actually, I believe that this is something that you should
              always do regardless of whether or not you are using URL rewriting
              (i.e., it is good programming style)...
              Robert
              Daniel Wabyick wrote:
              >
              > Hello,
              >
              > I have been experimenting with session-tracking via URL rewriting with
              > Weblogic.
              >
              >
              > I set the following property to true in my weblogic.properties file
              >
              > # Enables URL rewriting
              > weblogic.httpd.session.URLRewriting.enable=true
              >
              > ---------
              >
              > Then, I created a JSP page with a form that submits back to itself.
              > Originally, I had specified the form tag as :
              > <form action=<%= request.getRequestURI() %> method="post">
              > I turned cookies off, but the URL did not get rewritten and the
              > session resets every time. Thats bad in my situation.
              >
              > ---------
              >
              > So finally I changed the tag to the following :
              > <form action=<%= response.encodeURL(request.getRequestURI()) %>
              > method="post">
              >
              > I would think this should happen automatically. Is there any way to
              > make this happen as a default so that I don't have to rewrite every
              > form action?
              >
              > Thanks,
              >
              > Daniel Wabyick
              >
              > -----------------------
              > Server Engineer, Fluid
              >
              

  • Always use URL Rewriting for session tracking?

    All you JSP guru:
    I am working on a JSP project that requires session tracking. I have successfully implements session tracking with both cookies or URL rewriting. I know that with the HttpSession object, it will always try to use cookie first, if that's disabled, then it'll automatically switch to URL rewriting. However, is there a way to force the HttpSession object to ALWAYS use URL rewriting instead of cookies? I have searched for an answer for a long time and haven't been able to found a solution. Is it possible at all? Thank you very much.

    i was going to say that WebSphere always uses URL rewriting if you enable it at all, but someone beat me to it (indirectly) :-)
    however, that seemed to me to be a violation of the spec, which seemed to imply the behaviour you're describing (only use URL rewriting if cookies are not supported on the current client)
    here's a response someone else made on a websphere newsgroup to a statement in that regard:
    I believe you are technically correct. However from my
    experience, I think the spec if flawed in this area since
    there is no reliable way of determining whether the
    client browser supports cookies. The authority on
    cookies (www.cookiecentral.com) says:
    "To properly detect if a cookie is being accepted via
    the server, the cookie needs to be set on one HTTP
    request and read back in another. This cannot be
    accomplished within 1 request."
    This is asking too much of a servlet engine
    implementation. Even if it did submit a request for this
    purpose, the user could refuse the cookie. So
    then technically the browser supports cookies, but the
    servlet engine infers it doesn't. So if the servlet engine
    infers the browser does not support cookies and so
    encodes the URL, it is again out of spec because the
    browser really does support cookies. By doing it
    however encoding is configured makes things simpler,
    robust, consistent and avoids the flaw.
    My opinion.so, mostly i'm just rambling, but if you're using websphere, you should get the behaviour your boss wants. if you're using something else, i suppose there's a chance it'll "violate" the spec in this same, potentially helpful way.
    btw, i remember somebody else complaining that URL rewriting is less secure than cookies, but i kinda think they're about equal. it seems like either could be intercepted by a sniffer and then used to spoof. but i'm no expert in that stuff...

  • Sessions, URL Rewriting, and Cookies

    First some background, then some questions:
              BACKGROUND
              I have written an application framework to use with JSP/EJB/Servlet
              based applications. This framework does URL rewriting
              (response.encodeUrl) for all URLs generated by the application, and I
              have URL-based session support turned on in WebLogic.
              Despite the fact that my browser is set to support cookies on my test
              machines, I have noticed that intermittently the URL rewriting to
              support session IDs kicks in. Then, later, it goes away again. This
              would seem to indicate that the client browsers are (for no apparent
              reason) deciding to occasionally not support sessions with cookies, so
              that the server has to step in and do URL writing instead.
              QUESTIONS
              1. Has this sort of behavior been reported by anyone else?
              2. Is there a servlet/JSP API anywhere that I can call on a per-HTTP
              transaction basis to see if the browser that is participating in the
              transaction is at that moment supporting cookies?
              3. There are times when my framework needs to delete a cookie by setting
              its maxAge to 0. Most of time time this works, but (as with the session
              ID/URL rewriting above) occasionall the cookie does not get deleted on
              the client brower machine. This screws up some of the application logic
              that I have in the framework. Is this related to the problems listed
              above?
              CONCLUSION
              Any and all information is appreciated, from anyone. Thanks!
              Chris
              

              Hi,
              To answer your question #1, yes I have seen this behaviour, and
              the explanation I feel is as follows.
              1] You access a resource on WL Server & it starts a session, at
              this moment it is not sure whether the browser supports cookies
              so it uses both methods, URL Writing & cookies to store the session
              ID
              2] On the next request, it tries to read the cookie, if it is able
              to read it that means cookies are enabled and there is no need
              to continue with URL Rewriting else it continues wioth URLRewriting.
              To answer Question #2, you can follow a procedure similiar to above
              to find out if browser supports cookies, ie set a cookie & in the
              next request try to read teh value.
              As far as Question #3 is concerned, try setting the magAge to -12
              hours insteda of 0 so that there is no problem even in case of
              a time difference.
              hope this helps
              Rahul
              Chris Dole <[email protected]> wrote:
              >First some background, then some questions:
              >
              >BACKGROUND
              >I have written an application framework to use with JSP/EJB/Servlet
              >based applications. This framework does URL rewriting
              >(response.encodeUrl) for all URLs generated by the application,
              >and I
              >have URL-based session support turned on in WebLogic.
              >
              >Despite the fact that my browser is set to support cookies
              >on my test
              >machines, I have noticed that intermittently the URL rewriting
              >to
              >support session IDs kicks in. Then, later, it goes away
              >again. This
              >would seem to indicate that the client browsers are (for
              >no apparent
              >reason) deciding to occasionally not support sessions
              >with cookies, so
              >that the server has to step in and do URL writing instead.
              >
              >QUESTIONS
              >1. Has this sort of behavior been reported by anyone else?
              >
              >2. Is there a servlet/JSP API anywhere that I can call
              >on a per-HTTP
              >transaction basis to see if the browser that is participating
              >in the
              >transaction is at that moment supporting cookies?
              >
              >3. There are times when my framework needs to delete a
              >cookie by setting
              >its maxAge to 0. Most of time time this works, but (as
              >with the session
              >ID/URL rewriting above) occasionall the cookie does not
              >get deleted on
              >the client brower machine. This screws up some of the
              >application logic
              >that I have in the framework. Is this related to the problems
              >listed
              >above?
              >
              >CONCLUSION
              >Any and all information is appreciated, from anyone. Thanks!
              >
              >Chris
              >
              

  • If user disable cookie how to set and use session with URL Rewritting

    if user disable cookie how to set and use session with URL Rewritting by append session ID in url

    If cookies are disabled, then app server will automatically try to use URL rewriting for session control. Programmer's responsibility is to encode any links or redirects using
    response.encodeURL("/yourPage.jsp")
    and
    response.encodeRedirectURL("/yourPage.jsp")
    See API for details
    http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/http/HttpServletResponse.html#encodeURL(java.lang.String))

  • Please explain this about URL rewriting

    I am trying to write a simple example to understand URL rewriting...
    On Test1 Servlet in the doGet I have the following     
                   HttpSession session = req.getSession(true);
                   session.setAttribute("userid","123");
                   String url = resp.encodeURL("Test2.jsp");
                   System.out.println(url);
                   resp.sendRedirect(url);In the Test2.jsp I have the following
    <P>OK......</P>
    <%String id = (String)session.getAttribute("userid");%>
    <%=id%>Even though I see the URL being appended like
    http://localhost:9080/urlTest/Test2.jsp;jsessionid=00006O173z1PBf6mXOujvK25iJc:-1
    and I also see the result 123 on the screen...
    How do I know that its not using HttpSession and its using URL rewriting?

    The call to encodeURL is what is putting the "jsessionid" section into the URL. That is what it is using to maintain the session.
    So it IS using HTTPSession, but the sessionid is being maintained via URL rewriting, rather than with a session cookie.
    As an experiment, take out the call to "resp.encodeURL()" and see what the result is.
    Also, if you are using the url to redirect to, you should be using the method response.encodeRedirectURL. The rules for encoding a url being used as a redirect are slightly different from one being used as a link on a page.

  • JSP/SERVLETS NOT UNDERSTANDING JAAS SECURITY CONTEXT

    Hi ,
    Instead of using the default form action "j_security_check" for form based authentication
    .I have a custom JAAS loginmodule which is a servlet that gets calls when the
    user clicks on "OK" in the login form..
    Scenario1:
    I have a servlet(unprotected) which calls a EJB(which is protected).
    Depending on who has privileges to execute methods on the EJB bean , the authentication
    happens correctly..
    Scenario2:
    I have a PROTECTED servlet.
    When I execute the servlet in the browser , the login-form comes up .Once I click
    on OK,what is happening is I call my
    custom-loginmodule servlet which then calls the protected servlet.
    Now ..from the custom-loginmodule servlet when the request goes to the PROTECTED
    servlet ,the login-page again comes up...for some reason the servlets or JSPs'
    don't understand that the security context has already been created..
    But if the currently protected servlet is made unprotected and if it is made to
    call a protected EJB, the EJB bean gets the security context.
    I am thinking that security context is propagating but for some reason the JSP/servlet
    domain does not seem to get the already created security context.
    Another thing I noticed was with the default approach of using form-auth as "j_security_check"
    does not seem to work with URL rewriting.
    Any hints is greatly appreciated..
    Thanx,
    krish.
    Krishnan.Venkataraman
    Symphoni Interactive
    Technical Lead.
    [email protected]
    412 414 5385(mobile)
    412 446 2219(Work)
    1 800 439 7757 (# 2219) (Work)
    412 343 6549(Res)
    WEB:http://members.123india.com/krishnan

    hi,
    you may set a <servlet-mapping> in web.xml or you may use
    <form action="/servlet/HelloWorldExample" method=post>
    instead of
    <form action="/HelloWorldExample" method=post>
    the <servlet-mapping> should be:
    <web>
    <servlet>
    <servlet-name>HelloWorldExample</servlet-name>
    </servlet>
    <servlet-mapping>
    <servlet-name>HelloWorldExample</servlet-name>
    <url-pattern>/helloWorld.html<url-pattern>
    <servlet-mapping>
    </web>
    after you add the servlet-mapping, you can access the servlet with the url-pattearn, that is:
    <form action="/helloWorld.html" method=post>
    the internal operation of the first and second methods are different, and you should use second one(user servlet-mapping), and the <url-pattern> has may way to use, if you want learn more, see servlet spec. for more.

  • Using JSP/Servlet to write Word Document to BLOB

    Hi
    I need some help pls
    When I use a normal class with a main method, it loads the word document into a blob and I can read this 100%.Stunning.
    With a JSP/Servlet I cannot get the document out again. The "format" seems to be lost.
    Any ideas,help greatly appreciated:
    Here is the Main class that works:
    package mypackage1;
    import java.io.OutputStream;
    import java.sql.DriverManager;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.PrintWriter;
    import java.io.IOException;
    import java.io.BufferedReader;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileReader;
    import java.io.FileNotFoundException;
    import java.io.Writer;
    import java.sql.Connection;
    import oracle.jdbc.*;
    import oracle.jdbc.OracleResultSet;
    import oracle.sql.BLOB;
    import org.apache.log4j.Logger;
    import Util_Connect.DataBase;
    public class TestLOB
    //static final Logger logger = Logger.getLogger("test");
    public TestLOB()
    public static void main(String args[])
    TestLOB testLOB = new TestLOB();
    testLOB.TestLOBInsert("c:\\my_data\\callcenterpilot.doc");
    public void TestLOBInsert(String fileName)
    Connection conn = getConnection("wizard");
    BLOB blob = null;
    try
    conn.setAutoCommit(false);
    String cmd = "SELECT * FROM so_cs.testlob WHERE docno = 1 FOR UPDATE";
    PreparedStatement pstmt = conn.prepareStatement(cmd);
    ResultSet rset = pstmt.executeQuery(cmd);
    rset.next();
    blob = ((OracleResultSet)rset).getBLOB(2);
    File binaryFile = new File(fileName);
    System.out.println("Document length = " + binaryFile.length());
    FileInputStream instream = new FileInputStream(binaryFile);
    OutputStream outstream = blob.getBinaryOutputStream();
    int size = blob.getBufferSize();
    byte[] buffer = new byte[size];
    int length = -1;
    while ((length = instream.read(buffer)) != -1)
    outstream.write(buffer, 0, length);
    instream.close();
    outstream.close();
    conn.commit();
    closeConnection(conn);
    catch (Exception ex)
    System.out.println("Error =- > "+ex.toString());
    private Connection getConnection(String dataBase)
    Connection conn = null;
    try
    DriverManager.registerDriver(new OracleDriver());
    conn = DriverManager.getConnection("jdbc:oracle:thin:@oraclu5:1600:dwz110","so_cs","so_cs");
    catch (Exception ex)
    System.out.println("Error getting conn"+ex.toString());
    return conn;
    private void closeConnection(Connection conn)
    if (conn != null)
    try
    conn.close();
    catch (Exception se)
    System.out.println("Error closing connection in get last imei"+se.toString());
    Works fine:
    Here is the display servlet: Works when main class inserts file
    package mypackage1;
    import java.io.InputStream;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.PrintWriter;
    import java.io.IOException;
    import java.io.OutputStream;
    import java.sql.DriverManager;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import java.io.BufferedReader;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileReader;
    import java.io.FileNotFoundException;
    import java.io.Writer;
    import java.sql.Connection;
    import oracle.jdbc.*;
    import oracle.jdbc.OracleResultSet;
    import oracle.sql.BLOB;
    import org.apache.log4j.Logger;
    import Util_Connect.DataBase;
    public class DisplayLOB extends HttpServlet
    private static final String CONTENT_TYPE = "text/html; charset=windows-1252";
    static final Logger logger = Logger.getLogger(DisplayLOB.class);
    public void init(ServletConfig config) throws ServletException
    super.init(config);
    public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
    //response.setContentType(CONTENT_TYPE);
    //PrintWriter out = response.getWriter();
    Connection conn = null;
    PreparedStatement pstmt = null;
    try
    conn = getConnection("wizard");
    //out.println("<html>");
    //out.println("<head><title>DisplayLOB</title></head>");
    //out.println("<body>");
    //out.println("<p>The servlet has received a POST. This is the reply.</p>");
    InputStream is=null;
    oracle.sql.BLOB blob=null;
    response.setContentType("application/msword");
    //response.setContentType("audio/mpeg");
    OutputStream os = response.getOutputStream();
    String term = "1";
    String query = "SELECT docdetail FROM testlob WHERE docno = 1";
    pstmt = conn.prepareStatement(query);
    ResultSet rs = pstmt.executeQuery();
    while (rs.next())
    blob=((OracleResultSet)rs).getBLOB(1);
    is=blob.getBinaryStream();
    int pos=0;
    int length=0;
    byte[] b = new byte[blob.getChunkSize()];
    while((length=is.read(b))!= -1)
    pos+=length;
    os.write(b);
    }//try
    catch (Exception se)
    se.printStackTrace();
    finally
    try
    pstmt.close();
    catch (Exception ex)
    System.out.println("Error closing pstmt "+ex.toString());
    //out.println("</body></html>");
    //out.close();
    private Connection getConnection(String dataBase)
    Connection conn = null;
    try
    conn = DataBase.getPoolConnection(dataBase);
    catch (Exception se)
    logger.fatal("Error getting connection: ",se);
    return conn;
    private void closeConnection(Connection conn)
    if (conn != null)
    try
    conn.close();
    catch (Exception se)
    logger.error("Error closing connection in get last imei",se);
    Here is JSP/Servlet
    <%@ page import="org.apache.log4j.*"%>
    <%@ page contentType="text/html; charset=ISO-8859-1" %>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>untitled</title>
    <title>Wizard SMS Interface</title>
    <link rel='stylesheet' type='text/css' href='main1.css'>
    <script language='JavaScript' src='copyright.js'></script>
    </head>
    <pre>
    <%
    //HTTP 1.1
    response.setHeader("Cache-Control","no-cache");
    //HTTP 1.0
    response.setHeader("Pragma","no-cache");
    //prevents caching at the proxy server
    response.setDateHeader ("Expires", 0);
    Logger logger = Logger.getLogger("co.za.mtn.wizard.administration.admin01.jsp");
    %>
    </pre>
    <body>
    <FORM ACTION="/WizardAdministration/uploadfile"
    METHOD="POST"
    ENCTYPE="multipart/form-data">
    <INPUT TYPE="FILE" NAME="example">
    <INPUT TYPE="SUBMIT" NAME="button" VALUE="Upload">
    </FORM>
    </body>
    </html>
    <font> <b>Copyright &copy;
    <script>
    var LMDate = new Date( document.lastModified );
    year = LMDate.getYear();
    document.write(display(year));
    </script>
    Mobile Telephone Networks.
    <p align="left"><i><b><font face="Georgia, Times New Roman, Times, serif" size="1"></font></b></i></p>
    package co.za.mtn.wizard.admin;
    import java.io.InputStream;
    import java.util.Enumeration;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.PrintWriter;
    import java.io.IOException;
    import java.io.OutputStream;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import java.io.BufferedReader;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileReader;
    import java.io.FileNotFoundException;
    import java.io.Writer;
    import java.sql.Connection;
    import oracle.jdbc.OracleResultSet;
    import oracle.sql.BLOB;
    import org.apache.log4j.Logger;
    import Util_Connect.DataBase;
    public class UploadFile extends HttpServlet
    private static final String CONTENT_TYPE = "text/html; charset=windows-1252";
    //static final Logger logger = Logger.getLogger(UploadFile.class);
    public void init(ServletConfig config) throws ServletException
    super.init(config);
    public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
    String headerName = null;
    Enumeration en = request.getHeaderNames();
    try
    while ( en.hasMoreElements() )
    Object ob = en.nextElement();
    headerName = ob.toString();
    System.out.println("Value for headerNAme is >"+headerName+"<");
    String aaa = request.getHeader(headerName);
    System.out.println("Value for aa is >"+aaa+"<");
    catch (Exception ex)
    System.out.println("Error in extracting request headers"+ex.toString());
    Connection conn = getConnection("wizard");
    BLOB blob = null;
    try
    conn.setAutoCommit(false);
    String cmd = "SELECT * FROM so_cs.testlob WHERE docno = 1 FOR UPDATE";
    PreparedStatement pstmt = conn.prepareStatement(cmd);
    ResultSet rset = pstmt.executeQuery(cmd);
    rset.next();
    blob = ((OracleResultSet)rset).getBLOB(2);
    //File binaryFile = new File("h:\\callcenterpilot.doc");
    //System.out.println("Document length = " + binaryFile.length());
    //FileInputStream instream = new FileInputStream(binaryFile);
    response.setHeader("Content-Type","application/vnd.ms-word");
    String contentType = request.getContentType();
    System.out.println("Content type received in servlet is >"+contentType+"<");
    ServletInputStream instream = request.getInputStream();
    OutputStream outstream = blob.getBinaryOutputStream();
    int size = blob.getBufferSize();
    byte[] buffer = new byte[size];
    int length = -1;
    while ((length = instream.read(buffer)) != -1)
    outstream.write(buffer, 0, length);
    instream.close();
    outstream.close();
    conn.commit();
    closeConnection(conn);
    response.setContentType(CONTENT_TYPE);
    PrintWriter out = response.getWriter();
    catch (Exception ex)
    System.out.println("Error =- > "+ex.toString());
    //out.println("</body></html>");
    //out.close();
    private Connection getConnection(String dataBase)
    Connection conn = null;
    try
    conn = DataBase.getPoolConnection(dataBase);
    catch (Exception se)
    System.err.println("Error getting connection: "+se.toString());
    return conn;
    private void closeConnection(Connection conn)
    if (conn != null)
    try
    conn.close();
    catch (Exception se)
    System.err.println("Error closing connection in get last imei"+se.toString());
    This is what the display servlet is showing when the JSP/Servlet insert the document
    -----------------------------7d31422224030e
    Content-Disposition: form-data; name="example"; filename="H:\(your name) Skills Matrix.doc"
    Content-Type: application/msword
    �� ࡱ � > ��     � � ���� � � ���������������������
    Tks
    Andre

    hello,
    there are multiple documents out there, describing the oracle reports server setup. try doc.oracle.com for documentation.
    also it is part of the online-documentation.
    you need to install 9iAS enterprise edition. the server is pre-configured and will listen to the url http://yourserver/dev60cgi/rwcgi60.exe
    passing only this url you will get a help-screen, describing the syntax.
    regards,
    the oracle reports team

Maybe you are looking for

  • In a dynamic page how to share variable between PL/SQL and javascript

    For example, my dynamic page contains such PL/SQL codes: <ORACLE> DECLARE info varchar(100); rowid urowid; procedure doDelete( row_id in urowid ) IS begin Delete From xxx WHERE rowid = row_id; end doDelete; BEGIN Select name, rowid INTO info, rowid F

  • Fill pdf form from database table

    I am working on small application for my employer. We have record fo all new employee in table and want to fill PDF (I-9) from database using APEX application. Below PDF form, we want to fill from database table. http://www.uscis.gov/files/form/I-9.p

  • Problem in displaying stack canvas.....

    anyone plz help...... First let me explain wat I hav done I have a form module with two canvas - one is of content type(Canv1) and another is stacked type(stack1).. In Canv1 there is a button (Click) in WHEN-NEW-FORM-INSTANCE trigger hide_view('stack

  • Knowing an image's size

    Hi, well i'm a Java newbie, and i'll confess i'm still not even 1/3 of my way through my big big java book, lol, but i'm trying to do something and i don't know how to and any help will be very much appreciated... my problem is i want to check the si

  • Need help ASAP methods.

    Hi, As i know we have 5 methods in ASAP.like project preparation,bbp,realization,final praparation,golive. for these do we have any navigation in SAP from SPRO or in IMGor any transaction code. or just we have to follow these methods as therotically.