Response.sendRedirect throws IOException

I am using jsdk2.0 and I am using servlet runner to test this servlet.
In my servlet if a person is authorized I am sending the person to a particular URL.
if(rs.next())
response.sendRedirect(response.encodeRedirectUrl("https://xyz.com"));
It does go to the URL but It throws a exception which I can see in the servlet runner... IT Says java.io.IOException: Tried to write more than the content length..
sun.servlet.HttpOutputStream.check(HttpOutputStream:java:282)..Dont have a 282 line...
Can someone tell me...I know I am using deprecated method but why is it giving an exception?

your using https which is not supported by sendRedirect as far a i know. There is a special package for ssl afaik.

Similar Messages

  • Is it a bug in WLS6.0 of response.sendRedirect()?

    I got a very strange problem that I found that the code like that:
              response.sendRedirect("../error/error.jsp?url=../hello.jsp&err=hello");
              runs well, but the code like that:
              response.sendRedirect("../error/error.jsp?url=../../hello.jsp&err=hello");
              doesn't work, WLS tells me page not found! Its mean WLS can't go back more than one lever directory!! It's not fun!! Can somebody help me?
              

    Where can I download my test ear file.
    Any way I am keep my source here.
    My Servet Source
    =============================================
    package com.ritesh.tempwork;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import java.util.*;
    public class MyServlet extends HttpServlet {
    * Initialize global variables
    public void init(ServletConfig config) throws ServletException {
         super.init(config);
    * Service the request
    public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
         //getAction
         request.setAttribute("result",new ActionResult());
         this.getServletContext().getRequestDispatcher("/test.jsp").forward(request, response);
    * Get Servlet information
    * @return java.lang.String
    public String getServletInfo() {
         return "com.aclcargo.servlet.ActionMultiplexer Information";
    * Insert the method's description here.
    * Creation date: (7/13/2001 5:30:57 PM)
    public void destroy()
    ====================================================
    My Action Result class
    =====================================================
    package com.ritesh.tempwork;
    i[i]Long postings are being truncated to ~1 kB at this time.

  • HTTP error 302: response.sendRedirect()

    Hi everybody,
    I have a first servlet (AGSenderServlet) sending a file to a second one (AGReceiverServlet). This second servlet I'm receiving a file and then redirect to a JSP page. But I'm getting the following exception:
    13-Sep-2010 13:20:42 org.apache.catalina.core.StandardWrapperValve invoke
    SEVERE: Servlet.service() for servlet AGSenderServlet threw exception
    java.io.IOException: Received HTTP status code 302
            at AGSenderServlet.doGet(AGSenderServlet.java:43)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    ....I've looked on internet and apparently the error 302 is linked to response.sendRedirect().
    Here is my code:
    public class AGReceiverServlet extends HttpServlet {
         public void doGet(HttpServletRequest request,
                HttpServletResponse response)
         throws ServletException, IOException {
             // Create a factory for disk-based file items
              DiskFileItemFactory factory = new DiskFileItemFactory();
             // Create a new file upload handler
              ServletFileUpload upload = new ServletFileUpload(factory);
              String realPath = this.getServletContext().getRealPath("sync/in");
              List items = null;
                        try {
                             items = upload.parseRequest(request);
                        } catch (FileUploadException e) {
                             e.printStackTrace();
                        // Process the uploaded items
                        Iterator iter = items.iterator();
                        try {
                             String fileName = "blabla";
                             while (iter.hasNext()) {
                                  FileItem item = (FileItem) iter.next();
                                  // Process a file upload
                                  if (!item.isFormField()) {                         
                                       fileName = item.getName();
                                       long sizeInBytes = item.getSize();
                                       //Write to File
                                       if (fileName != null) {
                                          fileName = FilenameUtils.getName(fileName);
                                       File uploadedFile = new File(realPath);
                                       if (!uploadedFile.exists())
                                            uploadedFile.mkdirs();
                                       uploadedFile = new File(realPath+"/"+fileName);
                                       item.write(uploadedFile);
                             System.out.println("http://"+request.getServerName()+':'+request.getServerPort()+"/upTool/filereceived.jsp?filename="+fileName);
                             String redirectURL = "http://"+request.getServerName()+':'+request.getServerPort()+"/upTool/filereceived.jsp?filename="+fileName;
                             response.sendRedirect(redirectURL);                         
                        } catch (Exception e) {
                             e.printStackTrace();
         public void doPost(HttpServletRequest request,
                HttpServletResponse response)
         throws ServletException, IOException {
                   doGet(request, response);
    }The file received is saved properly and is ok.
    Using print out I have discovered that it was the running the whole code but not the code in filereceived.jsp (the JSP of the sendRedirect() ).
    I have tried the url used in the sendRedirect() and it works ok.
    Any idea?
    Cheers.

    The AGSenderServlet is sending a file to the AGReceiverServlet using multipart and Postmethod object. Here is the code.
    public class AGSenderServlet extends HttpServlet {
         public void doGet(HttpServletRequest request,
                HttpServletResponse response)
         throws ServletException, IOException {
              String filename = request.getParameter("filename");
              String ext = request.getParameter("ext");
              String serverName = request.getParameter("serverName");
              String port = request.getParameter("port");
              String path = null;
              String uri = "http://"+serverName+":"+port+"/AGReceiverServlet";
              File file = new File((this.getServletContext().getRealPath("/sync/out"))+"\\"+filename+'.'+ext);
              System.out.println("Test = "+file.getAbsolutePath());
              PostMethod post = new PostMethod(uri);
            Part[] parts = new Part[] {
                new FilePart(file.getName(), file) // File you want to upload
            post.setRequestEntity(new MultipartRequestEntity(parts, post.getParams()));
            // Now perform the POST and check for errors
            HttpClient http = new HttpClient();
            int status = http.executeMethod(post);
            if (status != HttpStatus.SC_OK) {
                throw new IOException("Received HTTP status code " + status);
         public void doPost(HttpServletRequest request,
                HttpServletResponse response)
         throws ServletException, IOException {
                   doGet(request, response);
    }Line 43 is just throw new IOException("Received HTTP status code " + status);What do you mean by " then you should handle it." ? I think I handle it. It redirects to the JSP filereceived.jsp which is hosted and available on the server (tried to access it directly by entering the url and it works).
    Edited by: Foobrother on Sep 13, 2010 7:38 AM

  • Strange behaviour with response.sendRedirect

    I have a strange problem with response.sendRedirect
    --The following is part of a class that implements Filter (its main task is to check for authentication)
    The redirect method hresponse.sendRedirect doesnot work (so i had to make it a forward method using dispatcher)
    The second one however, works!!!! how could that be?
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
          throws ServletException, IOException
               HttpServletRequest h =(HttpServletRequest)request;
               HttpServletResponse hresponse = (HttpServletResponse)response;
               ServletContext application = config.getServletContext();
            Connection con = (Connection)application.getAttribute("connection");
               String username = (String)h.getSession().getAttribute("user");
               String credentials = (String)h.getSession().getAttribute("cred");
               PrintWriter out = response.getWriter();
               if (con != null)
                   try
                   Statement     stmt = con.createStatement(
                        ResultSet.TYPE_SCROLL_INSENSITIVE,
                         ResultSet.CONCUR_READ_ONLY);
              ResultSet rs;
                        rs = stmt.executeQuery("SELECT * FROM member WHERE username = '"+ username
                                                                                              +"' AND password ='" + credentials+ "' ");
                        if(rs.next() && rs != null)
         String path = h.getServletPath() ;
              h.getSession().setAttribute("user", username);
              h.getSession().setAttribute("cred", credentials);
              //RequestDispatcher dispatcher = config.getServletContext().getRequestDispatcher(path);
    //dispatcher.forward(request,response);
              String s = hresponse.encodeURL("http://localhost:8080/support/mtext.html");
                   //out.println(s);
                   hresponse.sendRedirect(s);
                        else
         String path = h.getRequestURI();
         String query = h.getQueryString();
    //     String query_sub = query.substring(0,equalPos);
         if (!query_sub.equals("threadID"))
              out.println("error occured");
                   else
              if(query == "null")
                   query="";
              else
                   query= "?" + query;
                   hresponse.sendRedirect(hostPath + "/support/index2.jsp?"+
                   "forward="+h.getRequestURI() + query );
                   }

    Hi,
    response.sendRedirect() may throw an IOException if URL not found.So you have to write throws or try & catch.
    Ajay.

  • On Windows 7 HttpURLConnection.openConnection() throws IOException

    Hi Team,
    In our application we have a to create httpURLCOnnection (url.openConnection())which works fine on Windows XP but throws IOException on Windows7. Does anybody know which settings need to be enabled on windows 7 to resolve this issue?
    Any response would be appreciated. Thanks in Advance.

    Hello Team,
    I have a specific exception which I get when trying to open a url on Windows 7 with IIS authentication enabled. We get exception when trying to get response code of HTTP Connection
    java.io.IOException: Authentication failure
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
    at java.net.HttpURLConnection.getResponseCode(Unknown Source)
    Same code works find on windows XP. Do I need to do any specific settings on Windows7 to work this?
    Thanks in Advance.

  • DOMparser throws IOException when encounters Hungarian Characters

    Hoi!
    I wrote a piece of code that extracts some
    information from an XML document into a vector of Java classes, using the oracle.xml.parser.v2.DOMParser.
    And it worked. Or seemed to work...
    But when I put some articles in the XML file
    in Hungarian, the parser threw IOException.
    If I remplace the Hungarian characters to
    English "equivalents" a -> a etc., it works.
    I don't know. If XML is made up of Unicode characters, what's the problem with it?
    (The hex code of a was E1 in my text editor,
    as I'm using Win NT :(. )
    can I modify the xml prolog somehow?
    I'd rather not write a conversion program
    from a text file to another.
    Any ideas?
    and here's the code:
    DOMParser theParser = new DOMParser();
    XMLStreamToParse = XMLes.class.getResourceAsStream(xmlDocPath);
    theParser.setValidationMode(false);
    try{
    theParser.parse( XMLStreamToParse );
    //this throws IOException
    null

    What are you using as your test client?The test client is WebStone 1.0. WebStone always downloads the whole response, and reports the size of the response in bytes. From this I can see that when the IO exception occurs, webstone is unable to read the whole response, as it reports a smaller size.
    So, I do not think the problem is that the client has prematurely aborted its download. WebStone doesn't work that way. I think something has gone awry on the server side, and this worries me.

  • 6.1 SP5: response.sendRedirect crashes

    Hi all,
    I am porting a JSP app from Iplanet 4.1 to SunONE 6.1 SP5 (Solaris 5.9).
    When I try to do the above statement in a JSP, I get the following in the error log:
    [14/Jun/2007:16:05:05] failure ( 3812): for host 172.16.10.184 trying to POST /jspcontent/ozbet.jsp;jsessionid=43DBC3EA6343C4B0E3BF6AD26B943D25, service-j2ee reports: StandardWrapperValve[jsp]: WEB2792: Servlet.service() for servlet jsp threw exception
    java.lang.IllegalStateException
    at org.apache.catalina.connector.HttpResponseFacade.sendRedirect(HttpResponseFacade.java:179)
    at jsps.jspcontent._ozbet_jsp._jspService(_ozbet_jsp.java:109)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:908)
    at com.iplanet.ias.web.jsp.JspServlet$JspServletWrapper.service(JspServlet.java:687)
    at com.iplanet.ias.web.jsp.JspServlet.serviceJspFile(JspServlet.java:459)
    at com.iplanet.ias.web.jsp.JspServlet.service(JspServlet.java:375)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:908)
    at org.apache.catalina.core.StandardWrapperValve.invokeServletService(StandardWrapperValve.java:771)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:322)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:509)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:212)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:509)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:209)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:509)
    at com.iplanet.ias.web.connector.nsapi.NSAPIProcessor.process(NSAPIProcessor.java:161)
    at com.iplanet.ias.web.WebContainer.service(WebContainer.java:580)
    I am not sure what I need to declare differently in 6.1. The web app jars are in WEB-INF/lib under the docroot.
    The code in the JSP is pretty standard, but ran under Iplanet 4.1.
    try {
         String URL = "https://www.ozbet.com.au/tab/ozbet.htm?p_date=" //has parameters;
    response.sendRedirect(URL);
    catch (ApplicationException e) {
         //do some stuff here
    %>
    <b>ERROR:</b> <%= msg %>"
    <%
    FYI the webapp is working fine wrt to jdbc, jsp etc. It is just the sendRedirect() that is crashing.
    Do I need to declare anything related to NSAPI in obj.conf ?
    Please help and thanks in advance.
    Richard
    Message was edited by:
    r_defonseka
    Message was edited by:
    r_defonseka

    That's not a crash. HttpServletResponse.sendRedirect is throwing an IllegalStateException because you called it after the response had been committed. This is a documented part of the Servlet spec. (See, for example, http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/http/HttpServletResponse.html#sendRedirect(java.lang.String) for the the J2EE 1.3 docs.)
    The most likely problem is that you're calling sendRedirect after an include or after outputting too much data. If you're going to call sendRedirect, you need to do so near the top of your JSP file, before you output a lot of data. Once data has been sent to the client, there's no way for the server to say "oops, never mind, ignore that data and redirect over here instead".

  • Response sendRedirect is not working in JSF

    Hi,
    I am getting an error on calling response.sendRedirect() method in my backing bean. This piece of code is for redirecting:
                if (userCredentials.isExpired() || userCredentials.isInThreshold()  ) { // Just checking for some boundary conditions
                    ViewHandler vh = ctx.getApplication().getViewHandler();
                    String viewUrl = vh.getActionURL(ctx, PATH_FOR_CHANGE_USER_PAGE);               
                    ExternalContext ectx = ctx.getExternalContext();
                    HttpServletResponse response =
                        (HttpServletResponse)ectx.getResponse();       
                    response.sendRedirect(viewUrl);   /// This is where the error is thrown.
                }Here is the stack trace:
    SEVERE: Error Rendering View[/xhtml/home/AppHomePage.xhtml]
    javax.faces.el.EvaluationException: /layout/header.xhtml @27,78 value="#{UserInformation.userName}": Error getting property 'userName' from bean of type com.mrc.web.infrastructure.login.UserInfo: java.lang.IllegalStateException: Response has already been committed, be sure not to write to the OutputStream or to trigger a commit due to any other action before calling this method.
         at com.sun.facelets.el.LegacyValueBinding.getValue(LegacyValueBinding.java:60)
         at javax.faces.component.UIOutput.getValue(UIOutput.java:167)
         at com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getValue(HtmlBasicInputRenderer.java:102)
         at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.getCurrentValue(HtmlBasicRenderer.java:221)
         at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeEnd(HtmlBasicRenderer.java:199)
         at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:740)
         at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:304)
         at org.apache.myfaces.trinidad.render.CoreRenderer.encodeAllChildren(CoreRenderer.java:321)
         at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.PanelPartialRootRenderer.renderContent(PanelPartialRootRenderer.java:64)
         at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.BodyRenderer.renderContent(BodyRenderer.java:142)
         at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.PanelPartialRootRenderer.encodeAll(PanelPartialRootRenderer.java:119)
         at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.BodyRenderer.encodeAll(BodyRenderer.java:78)
         at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:224)
         at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:693)
         at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:252)
         at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:249)
         at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:594)
         at org.apache.myfaces.trinidadinternal.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:182)
         at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:107)
         at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:245)
         at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:137)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:214)
         at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:64)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._invokeDoFilter(TrinidadFilterImpl.java:262)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:219)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:173)
         at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:644)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:391)
         at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:908)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:458)
         at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:226)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:127)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:116)
         at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
         at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:234)
         at oracle.oc4j.network.ServerSocketAcceptHandler.access$700(ServerSocketAcceptHandler.java:29)
         at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:879)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
         at java.lang.Thread.run(Thread.java:595)
    *Caused by: java.lang.IllegalStateException: Response has already been committed, be sure not to write to the OutputStream or to trigger a commit due to any other action before calling this method.*
         at com.evermind.server.http.EvermindHttpServletResponse.sendRedirect(EvermindHttpServletResponse.java:1545)
         at javax.servlet.http.HttpServletResponseWrapper.sendRedirect(HttpServletResponseWrapper.java:170)
         at com.sun.faces.context.ExternalContextImpl.redirect(ExternalContextImpl.java:357)
         at org.apache.myfaces.trinidad.context.ExternalContextDecorator.redirect(ExternalContextDecorator.java:253)
         at com.mrc.web.infrastructure.login.UserInfo.getPasswordThreshold(UserInfo.java:547)
         at com.mrc.web.infrastructure.login.UserInfo.getUserName(UserInfo.java:231)
         at sun.reflect.GeneratedMethodAccessor196.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at com.sun.faces.el.PropertyResolverImpl.getValue(PropertyResolverImpl.java:99)
         at com.sun.facelets.el.LegacyELContext$LegacyELResolver.getValue(LegacyELContext.java:141)
         at com.sun.el.parser.AstValue.getValue(AstValue.java:96)
         at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:183)
         at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:71)
         at com.sun.facelets.el.LegacyValueBinding.getValue(LegacyValueBinding.java:56)
         ... 39 moreI dont think i am calling the 'sendRedirect' method anywhere before this code(if i understood the error message).
    Please help me with some pointers.
    Thanks,
    Srikanth
    Edited by: sriki79 on Jul 26, 2010 5:06 PM
    Edited by: sriki79 on Jul 26, 2010 5:06 PM
    Edited by: sriki79 on Jul 26, 2010 5:07 PM

    Yep, content has already been flushed to the browser and then the redirect cannot work anymore. Move the redirect logic to a filter I'd say.

  • Problem in response.sendredirect()

    Hi
    I am using response.sendredirect() to forword a request to an absolute URL out side my current environment.
    but it's not working....it still tries to process the request in the same environment...
    what can be the problem???

    yes i am passing the absolue URL to the Method.
    "http://blrkec30386:9080/ececWeb/BANKAWAY?Action.Admin.Init=Y&AppSignonBankId=024"
    .

  • Response.sendRedirect doesn't work

    Hi,
    I implemented the post authentication class. I added some code to the onLoginFailed method and i am trying to redirect user for my own page and not the standard error page of opensso (IdP). When using response.sendRedirect("/my_page") i got an error message telling me that redirection has failed because record already committed.
    I think the problem is due to the original redirection done by the IdP, isn't it? Is there a solution to redirect user for my own login failure page?
    Thanks.

    How about this.
    Do a combination of the two.
    Use the post auth plugin to do your work with LDAP it has access and has all the needed information.
    Add the attributes to the ?session?header? in the post auth plugin maybe?
    Use the default failrue url you are sending them to to pull the info out of the session headers and do whatever is needed at that point?
    I would try just populating one attribute first and redirecting using the default failure url to some simple page that prints out to validate if it would work.
    J

  • Response.sendRedirect() doesn't work immediately

    Hello,
    I'm moving my application to JDK 1.4 and IAS 10g.
    It's alright, but I noticed one problem.
    For long operation I created my way to display a "Working..." page.
    I use response.sendRedirect() to an HTML page, with the "Working..." message, that reload itself every five seconds (due to the fact that the message will be replaced, as I explained later).
    Once the operation has terminated it change a session variable that is loaded by the HTML page and it replace the "Working..." message with a "Done!" message.
    The problem is that in IAS 10g it doesn't redirect to the HTML file immediately, it seems that "wait" the operation is almost finished: il redirect to the HTML file displaying "Working...", and after the first reload of the page (5 seconds) it display "Done!".
    This is the part of the code:
    String urlToLoad = "/myApp/tools/template/cache/tempxyz.html";
    // SESSION VALUE: "Working..."
    response.sendRedirect(urlToLoad);
    response.flushBuffer();
    // OPERATIONS
    // CHANGE SESSION VALUE WITH "Done!"
    // END OF METHODThe "response.sendRedirect(urlToLoad);" instruction is executed without any error.
    I also tried to use the absolute path with "http://name_server", but it still doesn't work.
    I hope I explained my situation.
    I already read many post in this and others forums, but I didn't found any working solution.
    Thanks in advance for any suggestions,
    EP

    You could try putting your operations into a new thread... but I don't see why that would be necessary...
    String urlToLoad = "/myApp/tools/template/cache/tempxyz.html";
    // SESSION VALUE: "Working..."
    response.sendRedirect(urlToLoad);
    response.flushBuffer();
    Thread t = new Thread( new Runnable() {
      public void run() {
        // OPERATIONS
         // CHANGE SESSION VALUE WITH "Done!"
    t.start();
    // END OF METHOD(Or put the operations in a method in another class that implements the Runnable interface, ... whatever)

  • Response.sendRedirect doesn't work with IAS 10g

    Hello,
    I'm moving my application to JDK 1.4 and IAS 10g.
    It's alright, but I noticed one problem.
    For long operation I created my way to display my "Working in progress..." page.
    I create an HTML file into a cache folder and I redirect to that file that reload itself every five seconds.
    Once the operation is terminated it change a session variable that is loaded by the HTML page and it ends the "Working in progress..." message.
    The problem is that in IAS 10g it doesn't redirect to the HTML file immediately, it seems that "wait" the operation is almost finished: il redirect to the HTML file, and after 5 seconds it loads the end message of the operation.
    This is the part of the code:
    [WRITE FILE IN c:\application\tools\template\cache as tempxyz.html]
    String urlToLoad = "/myApp/tools/template/cache/tempxyz.html";
    response.sendRedirect(urlToLoad);
    [OPERATIONS]
    [CHANGE SESSION VALUE]
    -END-
    The "response.sendRedirect(urlToLoad);" instruction pass without errors.
    I hope I explained my situation.
    Thanks in advance for any suggestions,
    EP

    Thanks Qiang,
    Ive done exactly as youve said and it must be a rewriting problem as you suggested. Here is the header from accessing the servlet on the Linux host machine (IP 192.168.5.121 called 'BEAST')
    --10:12:27-- http://192.168.5.121:7780/webapp/test
    => `test'
    Connecting to 192.168.5.121:7780... connected.
    HTTP request sent, awaiting response...
    1 HTTP/1.1 302 Moved Temporarily
    2 Date: Wed, 11 May 2005 09:12:27 GMT
    3 Server: Oracle-Application-Server-10g/10.1.2.0.0 Oracle-HTTP-Server
    4 Content-Length: 183
    5 Cache-Control: private
    6 Location: http://BEAST:7779/webapp/testJ.jsp
    7 Keep-Alive: timeout=15, max=100
    8 Connection: Keep-Alive
    9 Content-Type: application/octet-stream
    Location: http://BEAST:7779/webapp/testJ.jsp [following]
    --10:12:27-- http://beast:7779/webapp/testJ.jsp
    => `testJ.jsp.3'
    Resolving beast... done.
    Connecting to beast[127.0.0.1]:7779... connected.
    That worked fine. Here is the header on my windows machine on the network ( IP 192.168.5.120) :
    HTTP/1.1 302 Moved Temporarily
    Date: Wed, 11 May 2005 09:03:21 GMT
    Server: Oracle-Application-Server-10g/10.1.2.0.0 Oracle-HTTP-Server
    Content-Length: 183
    Cache-Control: private
    Location: http://BEAST:7779/webapp/testJ.jsp
    Keep-Alive: timeout=15, max=100
    Connection: Keep-Alive
    Content-Type: application/octet-stream
    I think the problem must be that the response is telling it to redirect to BEAST (which is the name of the server) but the windows box cant resolve the name. Must be why i get the page cannot be displayed.
    The code in the servlet 'test' to redirect is just:
    response.sendRedirect("testJ.jsp");
    Any ideas would be much appreciated on how I can fix this other than setting up a local DNS server?!
    Cheers,
    Rob.

  • Response.sendRedirect is not working for IE5.5

    Hi All,
    I am using response.sendRedirect method to go to different page from jsp file. It was working file before IE was upgraded to version 5.5. It is still working fine with Netscape.
    With IE, it remains on the same page even after executing response.sendRedirect method. IT ACTUALLY GOES TO ANOTHER PAGE AFTER SELECTING REFRESH. Could this be a CACHE problem. However, I tried to append the URL with some random number every time it executes response.sendRedirect method just to make it a different URL and still getting the same result.
    Any Help will be greatly appreciated.
    Thanks.

    Every time I clear the History Cache, It works for the first time and after that it remains on the same page.
    I tried to set the days to store the hist pages as 0.
    please let me know if any other browser settings OR program changes required.
    Thanks.

  • Response.sendRedirect() problem

    Hi all,
    I in facing a problem during using response.sendRedirect() or there is some mistake, please help me...
    I have written two jsp files:
    i.e. first.jsp and second.jsp
    FIRST.JSP is as follwing:
    <%@ page import="java.io.*" %>
    <%
         response.sendRedirect("http://192.168.0.4:9999/mylogo/second.jsp");
    %>
    and SECOND.JSP is as follows:
    <%@ page import="java.io.*" %>
    <%
         String coding=request.getParameter("name").trim();
    %>
         My name is <h1><%= coding %></h1>
    but when i write the follwing in address bar:
    http://localhost:9999/mylogo/first.jsp?name=jake
    an error occurs:
    NullPointerException messae is received. I am using Apache Tomcat/4.1.29.
    Please help me, and tell if ther is any thing missing in this code....
    Thankx in advance...

    When you use redirection, you are sending a header back to the browser which tells it to go somewhere else. This results in an entirely new request. Because of this, any request info from the first page will not be in the second. The advantage of redirects is you can tell the browser to go to any other server.
    If you want to maintain the same request info, you can use forward. Forward only passes control in the server to another page. The browser will have no idea that this is happening, and it cannot go to another server.

  • Response.sendRedirect(URL), problem if '&' is usd as part of paramete value

    i have to redirect to a page having following URL
    http://www.citease.com/afc/d&o_coverage.htm
    now & is part of value rather than a separater of parameters.
    whenever i redirect it as
    strURL = "http://localhost:8080/cms/redirector.jsp?ckUrl=http://www.citease.com/afc/d&o_coverage.htm";
    response.sendRedirect(strURL);
    it will not work properly, will try to access only
    http://www.citease.com/afc/d
    Please help.
    Best regards,
    Waseem Aslam

    Encode the URL, the & should be & amp;.
    You may find the URLEncoder useful.

Maybe you are looking for

  • Apps take a long time to open on mac?

    I have a June 2012 Macbook pro (15 inch base model-nonretina). Apps take ridiculously long to open in OSX (Mountain Lion). When I use bootcamp to go into Windows 7, however, my computer is fast, apps open quickly, and games run on high. It doesn't ma

  • Futura suitcase

    hi there! would there be kind enough tyo help me with my fonts? i'm having trouble with my futura font suitcase, some of it's fonts are not working. i.e. futura book oblique, futura light/oblique, light condensed/lcondensed obique. is there a problem

  • I would like to use Lightroom.  I have Windows desktop, Galaxy S5 phone(android), and iPad.  Is this all compatible?

    I would like to use Lightroom.  I have Windows desktop, Galaxy S5 phone(android), and iPad.  Is this all compatible?

  • Input List of values in Query panel

    Hi , Problem statement :: Develop a page which should have Query panel and table . Query panel should have 2 fields and on the basis of these input values underlined table should display the values. These 2 fields should be inputListOfValues( Input f

  • Security/Authorization

    Can a set of users be displayed  data limited to their department/functional area by applying security or authorization checks? Ex: The Tax group should be able to see only materials/material groups that are non stock and taxable. Edited by: NW on Ju