Results 1 to 3 of 3
  1. #1
    limeleaf is offline Member
    Join Date
    Jul 2013
    Posts
    1
    Rep Power
    0

    Cool Creating a redirect servlet

    Hi all,

    I am a true Java newbie, and I got the following assignment: to create a servlet that will pass a referrer's URL when user is navigating from my company's secured site to another, non-secured site. Currently, because of the W3C protocol, referrer is not passed (secure web pages should not include the referrer header when linking to a non-secure site. (HTTP/1.1: Security Considerations) .

    We are trying to create a redirect servlet (called, for example, OneRedirect).
    The servlet acts as an intermediary, receiving the link request from our secured site to the non-secured sites, and returns a non-secure redirect response, adding the referrer header from the secured site.

    So, here is what we are doing:

    1. links would be changed to the following format:
    https://www.securedsite.com/OneRedir...securesite.com

    2. OneRedirect.java
    public void doGet(HttpServletRequest request, HttpServletResponse response) {

    response.setHeader(“referer”, “http://www.securedsite.com”);
    String redirectUrl = request.getParameter(“redirectUrl”);
    response.sendRedirect(redirectUrl);
    }


    Can somebody please explain what is happening in step 2 and how to code this Class file correctly?

    I am very new to Java, so explanation in layman's terms would be greatly appreciated!

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,202
    Rep Power
    19

    Default Re: Creating a redirect servlet

    Moved from New to Java.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  3. #3
    gimbal2 is online now Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    3,916
    Rep Power
    5

    Default Re: Creating a redirect servlet

    Quote Originally Posted by limeleaf View Post
    Hi all,

    I am very new to Java, so explanation in layman's terms would be greatly appreciated!
    Yeah that is not possible. You need to become skilled at the very least before you can be helped. Someone else will need to take care of this while you hit the books.

Similar Threads

  1. Redirect to jsp from Servlet using sendRedirect method
    By pateldpk in forum Advanced Java
    Replies: 9
    Last Post: 04-17-2012, 12:42 PM
  2. redirect servlet page to html.
    By ayushi in forum Java Servlet
    Replies: 2
    Last Post: 07-23-2011, 07:57 PM
  3. redirect to a servlet page
    By niteangell21 in forum New To Java
    Replies: 5
    Last Post: 11-15-2010, 02:53 PM
  4. How can I redirect in servlet?
    By Heather in forum Java Servlet
    Replies: 1
    Last Post: 07-14-2007, 05:52 PM

Tags for this Thread

Posting Permissions

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