Results 1 to 7 of 7
  1. #1
    ppo
    ppo is offline Member
    Join Date
    Apr 2010
    Posts
    10
    Rep Power
    0

    Default wan acces to web app during sendredirect local server name

    Hello all,
    I try write here coz, im ou of idea whats goign on in my web application.

    I have jsp web application and application server oracle oc4j, when I use alias name to "server.firma.com" to access webb app from wan I will get
    htp://server.firma.com/contextapp
    I will get mainpage of web app, I can click to any page i will get data from DB
    , but when my application do action something like this response.sendRedirect("/context/webpage") it si redirected to htp://localserverName/context/webpage. and application is down coz localservername is not visible from wan.

    I dont have enought teoretical experience what all is going on background.
    Im thinking about -- if is problem on technical solution DNS ,firewall redirection?
    some setings in oracle manager?
    or if something else is behind this?
    after two days of trying simualted and catch some idea about what is going on, Im realy confused, anyone have some ideas?

    thank Petr, CZ
    Last edited by ppo; 04-01-2010 at 12:48 PM.

  2. #2
    Steve11235's Avatar
    Steve11235 is offline Senior Member
    Join Date
    Dec 2008
    Posts
    1,046
    Rep Power
    7

    Default

    sendRedirect() sends a response to the browser, telling the browser to immediately go to another URL. If you do not send a valid URL, the the redirect won't work. Make sure the URL you are using makes sense from the point of view of a browser on the WAN.
    The Java Tutorial. Read it.

  3. #3
    ppo
    ppo is offline Member
    Join Date
    Apr 2010
    Posts
    10
    Rep Power
    0

    Default

    Quote Originally Posted by Steve11235 View Post
    sendRedirect() sends a response to the browser, telling the browser to immediately go to another URL. If you do not send a valid URL, the the redirect won't work. Make sure the URL you are using makes sense from the point of view of a browser on the WAN.
    Hello Steve,
    thank for reply I put to the redirect valid Url here is my structure
    I have this structure
    test-- appplication context root
    ----web
    ------|
    ----ciselniky
    -------|__metoda
    --------------|__admin
    --------------|-----|____edit.jsp
    --------------|_show.jsp

    I sended redirect when Im on page edit.jp
    I tryied use
    response.sendRedirect("../show.jsp?saved=1");
    response.sendRedirect("/test/ciselniky/metoda/show.jsp?saved=1");

    both didnt work, for mine point of application logic it is correct url, but I can be wrong.

    if I use <jsp:forward page="../show.jsp?saved=1"/> or <jsp:forward page="/test/ciselniky/metoda/show.jsp?saved=1"/>

    the page is corectly forwarded, but I need switch url too, today I will try how it will work with javascript location, but I dont wana use it, im wana understand what is going here :), it seems like some mine basic missunderstanding.
    nice spring(seasson) and thank for yours ideas.
    Petr , Cz

  4. #4
    ppo
    ppo is offline Member
    Join Date
    Apr 2010
    Posts
    10
    Rep Power
    0

    Default

    I tested window.location.replace("../show.jsp?saved=1");
    and server wasnt changed and correct page is show.

    This is only test solution I dont wana use it.

  5. #5
    Steve11235's Avatar
    Steve11235 is offline Senior Member
    Join Date
    Dec 2008
    Posts
    1,046
    Rep Power
    7

    Default

    if I use <jsp:forward page="../show.jsp?saved=1"/> or <jsp:forward page="/test/ciselniky/metoda/show.jsp?saved=1"/>

    the page is corectly forwarded
    Your Web application server compiles your JSP into a servlet. Find the source for the servlet, most likely in a "work" sub-directory, and see how the tags are coded there.
    The Java Tutorial. Read it.

  6. #6
    ppo
    ppo is offline Member
    Join Date
    Apr 2010
    Posts
    10
    Rep Power
    0

    Default

    Hi Steve, thank for support in this.
    I looked and post what I found.

    // forward --- jsp cast
    <% // Ukladaci blok
    if (request.getParameter("toSave") != null) {
    if (bean.validate(request, validFieldsReference)) {

    bean.setCiselnik(request, loggedUser.getId());
    if (dao.save(bean.getJednotka())) {
    %>
    <jsp:forward page="../show.jsp?saved=1"/>
    <%
    }
    }
    }
    // forward --- prelozena cast

    // Ukladaci blok
    if (request.getParameter("toSave") != null) {
    if (bean.validate(request, validFieldsReference)) {

    bean.setCiselnik(request, loggedUser.getId());
    if (dao.save(bean.getJednotka())) {

    __ojsp_s_out.write(__oracle_jsp_text[71]);
    if (true) {
    String __url=OracleJspRuntime.toStr("../show.jsp");
    // Forward
    pageContext.forward( __url);
    return;
    }
    __ojsp_s_out.write(__oracle_jsp_text[72]);

    }
    }
    }

    // reddirect -- jsp cast
    // Ukladaci blok
    if (request.getParameter("toSave") != null) {
    if (bean.validate(request, validFieldsReference)) {
    bean.setCiselnik(request, loggedUser.getId());
    if (dao.save(bean.getMetoda())) {
    response.sendRedirect("../show.jsp?saved=1"); // -- didnt work
    }
    }
    }
    // reddirect -- prevedena cast
    // Ukladaci blok
    if (request.getParameter("toSave") != null) {
    if (bean.validate(request, validFieldsReference)) {
    bean.setCiselnik(request, loggedUser.getId());
    if (dao.save(bean.getMetoda())) {
    response.sendRedirect("../show.jsp?saved=1"); // -- didnt work
    }
    }
    }

    I seems that I can try use something like OracleJspRuntime.toStr("../show.jsp") to get valid url.
    What do you think?
    Last edited by ppo; 04-06-2010 at 01:36 PM.

  7. #7
    ppo
    ppo is offline Member
    Join Date
    Apr 2010
    Posts
    10
    Rep Power
    0

    Default

    Hello Steve,
    we found solution.

    Oracle Aplication Server use apache, and apache have in http conf property useCanonicalName = On
    On -- > mean use servername
    Off -- > mean use hostName
    How I said simple missunderstanding.

    Thank for support.
    take care

    Petr, cz
    Last edited by ppo; 04-07-2010 at 09:34 AM.

Similar Threads

  1. Replies: 9
    Last Post: 09-01-2009, 07:17 PM
  2. Replies: 0
    Last Post: 03-05-2009, 05:45 PM
  3. How to allow one user to acces resource
    By SantoshBK09 in forum Advanced Java
    Replies: 1
    Last Post: 01-06-2009, 03:11 PM
  4. Replies: 0
    Last Post: 11-29-2008, 08:54 PM
  5. searching the local ip server from the WAN machine
    By Amruth Shreyass in forum Networking
    Replies: 0
    Last Post: 08-21-2008, 01:52 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •