SendRedirect doesn't rewrite URL?

Our application is similar to a web-based email application. Basically the
          situation is this: We have a servlet that is responsible for composing a
          new message. It handles the HTTP post and submits some information to a
          back-end database, then calls HttpResponse.sendRedirect() to redirect the
          browser to, say, the user's inbox to so they can see the results of the
          post.
          The problem we are having, is that sendRedirect() is not rewriting the URL.
          So they are looking at the inbox, but the URL is still the old URL for
          posting a new message. It's as if the redirect is happening on the server
          side and as far as the browser is concerned it is still looking at the old
          URL.
          What we really want is to force the browser to request the new URL. The
          problem with the current situation is that the browser is still pointing to
          the URL for posting a new message, so if they hit refresh in their browser,
          it posts to our submit servlet again and they get a duplicate message in
          their inbox.
          Any help would be appreciated. Thanks.
          -- Erik Ebert
          [email protected]
          

          Jeff Martin <[email protected]> wrote in message
          news:[email protected]...
          > Erik Ebert wrote:
          > >
          > > Our application is similar to a web-based email application. Basically
          the
          > > situation is this: We have a servlet that is responsible for composing
          a
          > > new message. It handles the HTTP post and submits some information to a
          > > back-end database, then calls HttpResponse.sendRedirect() to redirect
          the
          > > browser to, say, the user's inbox to so they can see the results of the
          > > post.
          > >
          > > The problem we are having, is that sendRedirect() is not rewriting the
          URL.
          > > So they are looking at the inbox, but the URL is still the old URL for
          > > posting a new message. It's as if the redirect is happening on the
          server
          > > side and as far as the browser is concerned it is still looking at the
          old
          > > URL.
          > >
          > > What we really want is to force the browser to request the new URL. The
          > > problem with the current situation is that the browser is still pointing
          to
          > > the URL for posting a new message, so if they hit refresh in their
          browser,
          > > it posts to our submit servlet again and they get a duplicate message in
          > > their inbox.
          >
          > You sound correct, so could you post a little code that doesn't work for
          > you?
          >
          > Jeff
          My bad. The error was elsewhere in our code. Sorry to bother the group.
          -- Erik
          

Similar Messages

  • Since updating to 3.6.15 today, back button no longer works and FF doesn't remember URLs

    Since updating to 3.6.15 today, back button no longer works and FF doesn't remember URLs. Not just that memory of previous URLs got wiped out, it still doesn't remember the ones I've typed in since I updated. And No back button, it's really hard to use.
    I went thru all the settings and could not find a way to fix this problem. What is up? I've never had this happen in any version of IE, FF, or Chrome.
    Can I get back previous version? Until then, it's Chrome and IE for me.
    I'll be happy to delete any plug-ins if it will make this problem go away.
    THANKS in advance!

    Thanks. This didn't solve te problem but it seemed to have solved itself. all of a sudden it started working properly, without me even closing FF and starting it up again. Thanks Cor-el, if it happens again I'll try your solution.

  • Apache rewrite URL for integrated ITS

    Hello All,
    What is the Rewrite url for the integrated ITS and proxy pass for the ITS
    Below is the one I have and its not working
    RewriteRule ^/(sap\(.*) https://sapprd.domain.com:8080/sap$1 [P,L]
    ProxyPass /sap https://sapprd.domain.com:8080/sap
    Please let me know the correct Rewrite url for accessing integrated ITS using apache reverse proxy. Should I need say /sap/bc/sap/gui/its
    Thanks,
    Praveen

    Praveen,
    To reverse proxy to HTTPS you need to make sure that you have the mod_proxy_connect module loaded.  Check out http://httpd.apache.org/docs/2.0/mod/mod_proxy.html
    Maybe that will help.
    Regards,
    Keith

  • Imported CSS - rewriter doesn't rewrite backgroung-image: url(...)

    Hello,
    Has anyone run into this problem? Documentation says
    url() inside CSS gets rewritten but it doens't work. My imported CSS has something like inside:
    background-image:url('/images/all_sites/fade_brown_bkgrnd.jpg');
    and it stays the same when passed through rewriter.
    Tried various rules to no avail. Anybody ran into this and found a work-around?
    Help is appreciated!
    Thanks,
    Alex N.

    Alex:
    We are having the same problem. Do you get the problem solved? and how?
    SUN PTS just told us, there is no such bug fix as mentioned, there is workaround, however. (that is, inline the background-image portion in CSS to HTML BODY). We really don't like such workaround since it involves a lot of code changed in a large web application.
    I appreciate your help. Thanks.
    Joe

  • Basic authentication with sendRedirect doesn't work

    Hello from the school of hard knocks:
    Following is my web.xml file. It doesn't ask for a username/password but instead gives a "Page not found 404" error. Behind the scenes the unauthorized page is being accessed via sendRedirect(). If I take out the unauthorized page URL in the web.xml and use in-page authentication (see code below), then the browser prompts 3 times and gives the access anyway!!! This is absolutely ridiculous for Tomcat 4.1.29. Can anyone help me out?
    <code to force authentication in page gleaned from a thread in this form >
    response.setStatus(response.SC_UNAUTHORIZED);
    response.setHeader("WWW-Authenticate", "BASIC realm=\"tomcat\"");
    <web.xml as prescribed by Martin Bond and Debbie Law in Tomcat - KickStart -- should have been kick in the ass >
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
    <servlet>
    <servlet-name>CewolfServlet</servlet-name>
    <servlet-class>de.laures.cewolf.CewolfRenderer</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>CewolfServlet</servlet-name>
    <url-pattern>/cewolf/*</url-pattern>
    </servlet-mapping>
    <error-page>
    <error-code>401</error-code>
    <location>/trnkxref/*</location>
    </error-page>
    <security-constraint>
    <display-name> Web App Access Control - Administrators </display-name>
    <web-resource-collection>
    <web-resource-name> Administration </web-resource-name>
    <url-pattern>/trnkxref/*</url-pattern>
    </web-resource-collection>
    <auth-constraint>
    <role-name> administrator </role-name>
    <role-name> patron </role-name>
    </auth-constraint>
    <user-data-constraint>
    <transport-guarantee> NONE </transport-guarantee>
    </user-data-constraint>
    </security-constraint>
    <login-config>
    <auth-method> BASIC </auth-method>
    <realm-name>tomcat </realm-name>
    </login-config>
    </web-app>

    Found this in the logs. What does it mean? tomcat-users.xml appended below. Has anyone been reading this lameass thread?
    WARNING: Security role name patron used in
    an <auth-constraint> without being defined in a <security-role>
    tomcat-users.xml:
    <?xml version='1.0' encoding='utf-8'?>
    <tomcat-users>
    <role rolename="patron"/>
    <role rolename="administrator"/>
    <role rolename="manager"/>
    <user username="ldp" password="hello" roles="administrator,patron"/>
    </tomcat-users>
    ~

  • 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 doesn't work with Internet Explorer

    I do posts like advised here: http://www.theserverside.com/tt/articles/article.tss?l=RedirectAfterPost. GET-POST-REDIRECT-GET. Now I have a problem when do redirecting to the same page in Internet Explorer. It works good with Mozilla Firefox but not with Internet Explorer. When user click to "Enable"/"Disable" link and do submit, application makes changes on the database. Changes occurs, but redirect to the page doesn't work. When I refresh page, I see that, the changes was occurred. When I use Mozilla Firefox with same JSP, there is no need to refresh page, because, redirect works. When I change redirect URL to other, for example http://www.google.com/, redirect doesn,t work in Internet Explorer too.
    Code of users.jsp JSP:
    <%@ page import="az.ub.ccs.beans.User" %>
    <%@ page contentType="text/html;charset=UTF-8" language="java" %>
    <%@ page errorPage="error.jsp" %>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <jsp:useBean id="bc" scope="page" class="az.ub.ccs.beans.BreadCrumb" />
    <jsp:useBean id="user" scope="request" class="az.ub.ccs.beans.User"/>
    <c:if test="${sessionScope.active == null}"><c:redirect url="login.jsp" /></c:if>
    <%
       if(request.getParameter("stateAction") != null)
          int state = (request.getParameter("stateAction").equals("enable")) ? 0 : 1;
          User.changeUserState(Integer.parseInt(request.getParameter("itemID")), state);
          response.sendRedirect("users.jsp");
          //response.setStatus(HttpServletResponse.SC_SEE_OTHER);
          //response.setHeader("Location", "users.jsp");
       bc.add("Users");
    %>
    <jsp:include page="top.jsp" flush="true">
       <jsp:param name="breadCrumbString" value="${bc.breadCrumbsAsHTML}"/>
       <jsp:param name="pageTitle" value="Users"/>
    </jsp:include>
    <tr>
       <td>
          <table border="1" width="100%">
             <tr class="tableHeader">
                <td>ID</td>
                <td>&#1048;&#1084;&#1103; &#1087;&#1086;&#1083;&#1100;&#1079;&#1086;&#1074;&#1072;&#1090;&#1077;&#1083;&#1103;</td>
                <td>&#1051;&#1086;&#1075;&#1080;&#1085;</td>
                <td>&#1053;&#1086;&#1084;&#1077;&#1088; &#1075;&#1088;&#1091;&#1087;&#1087;&#1099;</td>
                <td>&#1053;&#1072;&#1079;&#1074;&#1072;&#1085;&#1080;&#1077; &#1075;&#1088;&#1091;&#1087;&#1087;&#1099;</td>
                <td>Email</td>
                <td>&#1053;&#1086;&#1084;&#1077;&#1088;</td>
                <td colspan="2">&#1044;&#1077;&#1081;&#1089;&#1090;&#1074;&#1080;&#1077;</td>
             </tr>
             <c:forEach items="${user.userList}" var="user">
             <tr>
                <td align="right">"${user.userID}"</td>
                <td><c:out value="${user.userName}"/></td>
             </c:forEach>
             <tr>
                <td colspan="7"> </td>
                <td colspan="2"><a href="addEditUser.jsp">[Add new]</a></td>
             </tr>
          </table>
          <form name="stateForm" method="post" action="users.jsp">
             <input type="hidden" name="itemID"/>
             <input type="hidden" name="stateAction"/>
          </form>
       </td>
    </tr>
    <jsp:include page="bottom.jsp" flush="true"/>

    I use HttpWatch to see request and response details. Link to the report file of HttpWatch http://tasadar8.googlepages.com/CCSHttpWatch.rar

  • Firefox with URL doesn't open url

    On a Citrix environment I installed Firefox (next to the default IE). I want FireFox to open a specific URL so I create a shortcut that looks like this:
    ""C:\Program Files\Mozilla Firefox\firefox.exe" <servername>:<port>/cid/Application.do"
    But everytime I log in as a user, I get a blank FF page instead of the webpage that's in my shortcut. It just simply seems to ignore it. The URL can be opened in FF, but it doesn't want to do it automatically.
    I reinstalled FF, but that didn't help.

    Solved. The placing of the "" did the trick. Put the path to FF between "" , then a space and then the URL between "".

  • 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)

  • SendRedirect doesn't work!

    Hi all!
    I've got a strange problem:
    when I use a PrintWriter for sending data to user in my servlets, response.sendRedirect("smth") works fine,
    but when I started to use ServletOutputStream, sendRedirect stopped working!
    Please help!
    Thnak you

    Once the data buffer to the client is flushed (you've actually sent data) the sendRedirect command won't do what you want it to. sendRedirect works on the client side similar to putting a <META redirect . . > tag in the head of your page, it doesn't redirect through the server.
    If data has already been sent to the client it will display it and ignore your request for a redirect. PrintWriter was working because the data buffer wasn't flushed before you sent the sendRedirect through the response.
    Why would you want to send output to a page that they were being redirected away from anyway?
    JDB
    SCJP/SCWCD

  • SendRedirect with parameter in URL

    I'm trying to do the following:
    String path = request.getContextPath() + "/servlet/FrontController?thePage=\"index\"";
    response.sendRedirect(path);However, this produces an error, saying that the path is too long. What is wrong with this? Is it not psosible to send a parameter when redirectng a request?

    Sure it's possible to send a parameter. But sendRedirect causes the browser to make a GET-method request for whatever you put in that URL, and there's a fairly small limit to the length of such a URL. It's impossible to tell from that code you posted how long the URL is, but you could find out quite easily.

  • Question on rewriting url

    I have a site www.mydomain.org that also has the .com and .net registered and pointing to the same site. What we would like to do is when someone goes to www.mydomain.com, have the url in the browsers address bar change to www.mydomain.org. We don't want to use redirects, but just have the url change in the browser, because redirects will mess with our web stats. Any ideas?

    Thank you very much. It's very helpful to know the
    cache is based on the complete URL including
    querystring. Is there any docs about it?
    so if I add 3 meta tag to my jsp, proxy or browser
    should not cache?Well, not really. I'm sorta making an assumption here, honestly. The reason is that any caching proxy server can do whatever it wants to associate a cached page with a URL. IF it wants to ignore the query string part of a URL, it could simply trim that. But from the ones I've seen, the full URL was used.
    If you use those response headers, it shouldn't cache in the proxy or browser.
    then the only thing I am worry now is that the
    sessionID is in url, is it easy stolen by someone
    else? I used session very heavy in my app. so if the
    sessionID is not secure enough, it's very dangerous.It doesn't matter if the session ID is in the URL or a cookie. Someone could "steal" it from either place easily enough. It'd still be in the request from the browser, and it has to be because of how the HTTP protocol works. The only way to make it secure is to use SSL.
    The session should always timeout anyway so that the session ID isn't good forever.

  • [SOLVED] nginx, php-cgi, rewrite url, 502 bad gateway.

    Hello everyone.
    I just set my nginx server, with php-cgi, as it is in the wiki site and it is working perfectly. I have just one problem. I am trying to rewrite my url, and I got an error after several refreshes.
    This is my site configuration.
    server {
    listen 80;
    server_name localhost testwebsite testwebsite.homelinux.org;
    access_log logs/testwebsite.access.log main;
    location / {
    root /home/www/testwebsite;
    index index.php;
    if (!-e $request_filename) {
    rewrite ^/(.*)$ /index.php?path=$1 last;
    #rewrite ^/((.*)[^/])$ /index.php?path=$1 last;
    location ~ \.php$ {
    #root www;
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME /home/www/testwebsite/$fastcgi_script_name;
    include fastcgi_params;
    When I am not trying to rewrite the url, everything is ok, but when I try to rewrite it, after several refreshes on the page, I got nginx error: 502 bad gateway, and the cgi deamon stops to work.
    When I restart the fastcgi (I am using the example /etc/rc.d/fastcgi file as it is in the wiki) the web site is working again for several refreshes, and then the fastcgi stops again and I got the bad gateway again.
    Can someone tell me what is wrong with my rewrite rule, please.
    Regards.
    Last edited by Gruntz (2010-04-08 15:58:50)

    I fixed it with that rewrite:
    rewrite  ^([^.]*)$  /index.php?path=$1;

  • [SOLVED] cgit, apache, how to rewrite urls?

    Hello
    I'd like to use cgit like in projects.archlinux.org
    all i want is urls like
    http://domain/repo.git
    however i can only get
    http://domain/cgit.cgi/repo.git
    i tried virtual-root=/ it seems to work (links are shown as http://domain/repo.git) but i get 404s when i click on them
    how can i do that using virtualhost?
    Last edited by poorguy (2010-02-19 21:40:52)

    I've did it. Here's how:
    Note: you have to put "virtual-root=/" line to /etc/cgitrc
    <VirtualHost *:80>
    ServerName git.mydomain.com
    DocumentRoot "/srv/http/cgit"
    DirectoryIndex cgit.cgi
    SetEnv CGIT_CONFIG /etc/cgitrc
    <Directory "/srv/http/cgit">
    Options FollowSymlinks ExecCGI
    Allow from all
    AllowOverride all
    Order allow,deny
    <Files cgit.cgi>
    SetHandler cgi-script
    </Files>
    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^.* /cgit.cgi/$0 [L,PT]
    </Directory>
    <Directory "/srv/gitosis/repositories">
    Allow from all
    </Directory>
    # To debug rewrite just enable them.
    # RewriteLog /var/log/httpd/rewrite_log
    # RewriteLogLevel 9
    ErrorLog /var/log/httpd/gitweb
    </VirtualHost>

Maybe you are looking for

  • Sun Fire V250 Error while booting

    Dear all, I have one Sun Fire V250 which was down for fews days and when I booted now it gives the following messages after booting. Is it the problem with the memory modules. It has 2 DIMM with each of 1 GB. Thanks in Advance sc>+ sc> poweron+ SC Al

  • My iCloud mail on my iMac no longer works,

    My iCloud mail on my iMac no longer works, yesterday it just stopped. I go tth eiMac in mid 2007, same iCloud email account works on a mini mac i purchased last summer, solutions?

  • How to store data in chinese from oracle and show it to jsp?

    hi, please help. i have design a jsp page for registeration of a website in chinese, but after the user have enter the chinses data throught the jsp~ the jsp have shown some monster code~ it can't show the valid date in chinese!!! how can i fix it???

  • ISE 1.3 Sponsored Guest Portal Login Failure

    Hello Team, Ive created a guest account in the sponsor portal for a test guest user, however the state remains in "created" state. Now when the user tries to log on via the sponsored guest portal the error back is "invalid username or password". In I

  • How to add an action after closing a ModalInternalFrame?

    Hi folks I created a ModalInternal Frame: tableMif = new ModalInternalFrame(   getString("ifikPatList"), this, tableP); tableMif.putClientProperty(CLOSE_ON_F1, true);which is being closed when I push F1. But additional to this, I want some other code