URL Re-Writing

Hi Guys,
I'm interested in managing urls on incoming requests. For example, if someone clicks on a link that says, www.something.com or www.someone.com, I want them both to direct to the same page. I'm guessing I can do this from the web xml servlet mapping property, but I want to know if there are other ways of doing this.
Also, I want to be able to re-write outgoing urls so they retain the names I want them to have. For example in my servlet I have something like;
String address = "";
address = "RetrieveUser.jsp";
RequestDispatcher dispatcher = request.getRequestDispatcher(address);and then the code will display something like
www.somethinglike.com/RetriveUser.jsp.
However I want it to display,
www.somethinglike.com/WhatIWant.htm
how would I go about achieving this?

What do you mean "the code will display something like" ? The code will contain whatever you write, you are writing the code, right or wrong. Are you referring to the url in the browser window?
What are you trying to do
Note that the RequestDispatcher is a server side redirect, so essentially the client is unaware. Calling the method "sendRedirect" of the response object causes the client to initiate a new get request and that will impact what appears in the browser window of the client. The RequestDispatcher will have no impact.

Similar Messages

  • Change the URL for the usernames.

    Hi developers at Forums, I wanted to add a suggestion for you today. 
    I think using the forum profile link as; http://social.msdn.microsoft.com/profile/afzaal%20ahmad%20zeeshan%20(shani)/ is less attractive as compared to http://social.msdn.microsoft.com/profile/afzaal_ahmad_zeeshan_(shani)/
    Well, a professional in HTML encoding decoding would barely notice the difference but a newbie would have some troubles. URL re-writing as 
    var url = currentUrl.ToString().Replace("%20", "_");
    won't cost much. You can have the very same URL for the server-side codes but for the Browser window you can change the space bar HTML code to an underline, for better readability. 
    ~!Firewall!~

    I am pretty sure you have already read this 
    http://blogs.technet.com/b/exchange/archive/2011/01/17/configuring-multiple-owa-ecp-virtual-directories-on-exchange-2010-client-access-server.aspx
    Can we have more information on the ip section from you.. how is your firewall treating the cas servers??
    UMESH DEUJA MCP,MCTS,MCSA,CCNA

  • WLS 6.1 SP1 URL Rewriting Still Not Working?

              Anyone having success with URL Rewriting? The SessionServlet example is STILL
              not working for me when cookies are disabled. New sessions are created every
              access and the counter never increments past 1.
              Any info would be appreciated.
              Regards, Jeff
              

              The SessionServlet example works fine for me. By default URL re-writing is enabled
              and it will come into picture if the browser doesn't accept cookies.
              Try the examplesWebApp which is in 'examples' domain. It has SessionServlet as
              part of it.
              Sathish Santhanam
              Developer Relations Engineer
              BEA Support
              

  • URL rewrite in iplanet sun web server 6.0

    HI,
    I've been using SunONE web server 6.0 for a while.
    Our website is changing to adapt URL rewrite. Can you please show me how or where to get such information about how to do URL rewrite in web server 6.0?
    http://domain.com/index.php?=c2345 ----> to this nice-looking URL http://domain.com/index/mainsite
    thanks so much!

    This would be non-trivial in WS6.0. Additionally, WS6.0 is end-of-lifed, and has known security problems that are NOT going to be fixed. You should consider upgrading.
    URL re-writing (and much more) is a native feature of WS7.0.

  • Sun Java System Web Server 7.0 available

    I am delighted to announce that Sun Java System Web Server 7.0 is now available for download, purchase, deployment, and more.
    This release builds on the highly scalable and stable heritage of Web Server. It features an entirely re-designed Administration interface designed around clusters, easy access to frequently performed tasks, simplification of frequently performed tasks., and a fully scriptable command line interface featuring functional parity with the browser-based interface.
    In addition to the administration changes this release features:
    o Full 64-bit support for Solaris SPARC and Solaris AMD64 platforms
    o Regular expression pattern matching for URL re-writing and mass hosting
    o If/Then/Else constructs within request processing
    o Advanced sed based input and output filters
    o Dynamic loading of Certificate Revocation Lists (CRLs) without requiring daemon restart
    o Elliptic Curve Cryptography (ECC)
    o Built in request mapping for protection against abnormal load patterns and Denial of Service protection
    o WebDAV ACL support
    o Out-of-box Java support for Servlets 2.4, JSP 2.0, JSF 1.1, JSTL 1.1, JWSDP 2.0 based web services
    o Java session failover and recovery within a cluster of peers
    o Integrated HTTP reverse proxy User-Agent
    o Bundled FastCGI client for use with third party scripting environments such as Perl, PHP, Ruby on Rails, etc
    o Enhancement of perfdump, stats-xml, and SNMP as well as more ability to monitor the Java container and the ACL system
    o Much more
    The software can be downloaded from:
    http://www.sun.com/download/products.xml?id=45ad781d
    The documentation is available at:
    http://docs.sun.com/app/docs/coll/1308.3

    If 7.0 was released, how come http://www.sun.com/webserver still only talks about 6.1?

  • Session handelling and routers

    Hi,
    this is a simple yes or no question. If you know the answer this will only take a few seconds of your time.
    We plan to develop an application using java session objects and run it on multiple servers balanced by an Alteon webswitch. Can webswitches read the session id (called jsession id) even if the end user has cookies disabled (ie the jsession id is written in the url)?
    If you have done this, or know this can definately be done, just say "YES". We will figure out how later on.
    Thanks in advance for your help,
    Sean Cronin.

    Yes. The session object relies on cookies and/or URL re-writing. the sessiontracker just decides what methode to use depending on cookies enabled or not.

  • Problem storing sessions

    My system is set up to redirect based on the group stored in
    the database. My problem is that my code is not retrieving the
    group and storing it as a session. Here is my code:
    include("config.php");
    session_start();
    $connection = @mysql_connect($server, $dbusername,
    $dbpassword)
    or die(mysql_error());
    $db = @mysql_select_db($db_name,$connection)
    or die(mysql_error());
    $sql = "SELECT * FROM $table_users WHERE usr_username =
    '$username' and usr_password = md5('$password')";
    $result = @mysql_query($sql, $connection) or
    die(mysql_error());
    //get the number of rows in the result set
    $num = mysql_num_rows($result);
    //set session variables if there is a match
    if ($num != 0)
    while ($sql = mysql_fetch_object($result))
    $_SESSION[usrid] = $sql -> usr_id;
    $_SESSION[name] = $sql -> usr_name;
    $_SESSION[username] = $sql -> usr_username;
    $_SESSION[password] = $sql -> usr_password;
    $_SESSION[email] = $sql -> usr_email;
    $_SESSION[verified] = $sql -> usr_verified;
    $_SESSION[datereg] = $sql -> usr_date;
    $_SESSION[phone] = $sql -> usr_phone;
    $_SESSION[cell] = $sql -> usr_cell;
    $_SESSION[fax] = $sql -> usr_fax;
    $_SESSION[group] = $sql -> usr_group;
    $_SESSION[squestion] = $sql -> usr_squestion;
    $_SESSION[sanswer] = $sql -> usr_sanswer;
    $_SESSION[company] = $sql -> usr_company;
    $_SESSION[member] = $sql -> usr_member;
    }else{
    header("location:../no_acess.php");
    if($_SESSION[group] == "admin"){
    $_SESSION[redirect] = "admin/index.php";
    }else{
    $group = $_SESSION[group];
    $_SESSION[redirect] = "lindex.php";
    header("location:$_SESSION[redirect]");
    exit;

    I'm thinking that you are using URL re-writing for session management. This is the method where the session id must be written in the URL string of every request. This is probably where your problem lies. To start you should wrap the value you are passing to the sendRedirect() method in a call to response.encodeURL() to ensure the URL maintains the session id. Also any Javascript code that uses URLs should also use the response.encodeURL() method to encode the URL strings.
    For instance, this is what you should do. In your code find the line that says "sendRedirect(someValue);" and change it to "sendRedirect(response.encodeURL(someValue))". If the Javascript is defined in a static HTML file or a .js file change this file to a JSP and make sure the value passed to the open() function is wrappered in a call to response.encodeURL().
    To further explain what I think the problem may be, you have to understand session management as it is implemented in JSPs/servlets. There are various tutorials on this site that will explain it in detail.

  • Steps to create a cookieless domain in Weblogic

    Hi,
    I want to create a cookieless domain, to serve all the static contents like CSS,JS and images for my site to enhance it's performance. Could someone please let me know steps involved to set up a cookieless domain in Weblogic.
    Thanks in advance for yours assistance.
    Regards,
    NM

    Generally session stickiness and failover are two important features provided by application server to manage your sessions effectively.This can be achieved either through cookies or url re-writing.
    For individual applications using servlets,you could disable cookies from the deployment descriptors.
    However,for your specific case,you may want to disable the cookies on your browser if you wish to access the static file directly.
    if you have a jsp or servlet which makes a call to static files ona nother server,then i think what you could do is create a war module with all the static images and disable cookies in the weblogic.xml file by setting cookies-enabled to false.
    -Sandeep

  • Session not shared between multiple wars, with no cookies

    I posted an earlier query on multiple wars in the same application.
    Actually session is maintained and getting shared on the server when
    browser supports cookies.
    When Browser does not support cookies i have the following problem,
    a) Without cookies URL's(href tags) work fine because they are bieng
    rewritten.
    b) The first form i call always has hidden tags with session id value
    and it works fine
    c) But in all susequent forms there is no hidden session id.(My forms
    are all JSP pages.).
    My questiona are
    1) under what situations does the server add session id hidden tags in
    html form.
    2)And how do I get them created automatically when browser does not
    support cookies.
    3) And why are the hidden tags being set for the first request. (I read
    in previous posts that is because the server does not know if browser
    supports cookies for first time) How does it know the second time. What
    html header gives this info.

    >
    1) under what situations does the server add session id hidden tags in
    html form.The webconnector should rewrite the sessionid whenever the browser might
    not support cookies. (And it has configured to allow URL re-writing.)
    Obviously you are having a problem with this, but based on the information
    you are providing I don't have any insight on why yet. Works for me. Try
    opening a support ticket and/or posting some more information.
    >
    2)And how do I get them created automatically when browser does not
    support cookies.This should happen automatically, unless you have changed the NoCookie
    setting in the registry.
    >
    3) And why are the hidden tags being set for the first request. (I read
    in previous posts that is because the server does not know if browser
    supports cookies for first time) How does it know the second time. What
    html header gives this info.Yes, hidden tags are set for the first request because the webconnector
    doesn't know if the browser supports cookies.
    The second request it knows that cookies are supported because the browser
    successfully has returned the cookie it sent the first time.
    David

  • Looking for an expert on session tracking

    I've got some session code running on RH linux using Apache and Tomcat. About 7% of my users experience a session variable not being present after a <jsp:forward> (or sendRedirect). I was thinking that it was related to cookies and how sessions are tracked, but I am using both the default cookie session tracking as well as URL re-writing; when I turn my browser's cookies off, I start seeing the jsessionid being used and everything still seems to work ok.
    Is there anyone out there who might be willing to help me figure this pup out...why 7% of my users can't be tracked (session.getAttribute() doesn't find something that was placed into the session directly before the redirect/forward)?
    /paul
    [email protected]

    OK, I've done a bunch of debugging. It appears all the folks who experience a "loss of session" have a URL with no parameters...even though I now parameters where passed.
    Also, in some cases, the new URL that is being visited is accessed via either a <jsp:forward> or javascript's window.open.
    Anyone know why some browsers might not pass parameters?

  • Re: Cannot get new URLconnection.getInputStream() in JAVA

    new URLConnection.getInputStream() does not seem to work.
    Background: I am trying to POST the data to an ASP page and reading the response back but it does not seem to work...if I comment this line out it works but does not do what it is intended for.
    Basically I am trying to upload files to the server and am connecting to the URL and writing to its stream....but cannot read the response back..Please help as I have tried everything I could and have read the forums but no LUCK yet

    Yeah yeah that is what I meant ...please excuse me for that ... jst getting slightly pissed off with this problem....see the code below...
    BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
    this is where the error is coming from and the server throws error no 500.
    I have tried posting to the same URL using a Form and it works without any issues....please help

  • JRE 1.6u11: can deployment.config point to a PC location?

    I am an Oracle DBA. I need to configure JRE 1.6u11 to use trusted.certs file located on the PC. I can "make it work" if I place the deployment.config file in C:\WINDOWS\Sun\Java\Deployment with it's key, deployment.system.config, pointing to a network location for the deployment.properties file. Deployment.properties file, in turn, then has a key telling where to find trusted.certs, again, in a network location.
    But, I am unable to set the key, deployment.system.config to look for deployment.properties in the same directory that deployment.config uses, namely, C:\WINDOWS\Sun\Java\Deployment\deployment.properties. It seems like the key, deployment.system.config is not set up to point to a PC path, because trusted.certs is not found. I read that deployment.system.config is supposed to describe a URL. Writing the path as a URL has not helped (file://C:\WINDOWS\Sun...).
    I wish to place these files in a location that is not user-specific. I do not wish to put them on the network.
    Do you know why I can't do this, or do you have any suggestions that would make this work?
    Thanks for your time.

    Turns out I had learned that a file is specified in URL as [file://], but in this case I only needed [file:/]. Once I changed this, everything worked just fine.
    My only question now, is since I answered my own question, do I get the points?

  • Environment property on iPlanet/ Sun web server

    We are migrating an application from tomcat to the Sun Web Server / iPlanet . Earlier in the tomcat server, our applications used context xml files and in them we had a setting as follows
    <Environment name="instanceNum" value="100100"
    type="java.lang.String" override="false"/>
    What is the equivalent of the above in the iPlanet server?
    Thank you

    This would be non-trivial in WS6.0. Additionally, WS6.0 is end-of-lifed, and has known security problems that are NOT going to be fixed. You should consider upgrading.
    URL re-writing (and much more) is a native feature of WS7.0.

  • Opendocument issue

    Here is my issue...
    I have two simple reports; report A and B. I am calling report B from A using using Opendocument function by clicking link. After i refresh the report A by clicking Refresh All; if i click report B link I am getting warning message saying "_Are you sure you want to navigate away from this page? You will lose any unsaved modification to this document. Press OK to continue, or Cancel to stay on the current page_."
    Is there any work around to supress the warning message by passing any arguments or java script to opendocument url or writing any SDK code, if you are suggesting any SDK code, pls. let me know where should i write the code.
    Thanks in advance

    Hi venkat,
    See when you are refresh the report it will load the report with new/changed data. At the time when you the link which opens the report B in the same window the report A will prompt you with the message that it is unsaved.
    Better open the report B in seperate window.  i.e mention sWindow=NEW
    http://<servername>:<port>/OpenDocument/opendoc/<platformSpecific>?sDocName=Salesin2003&sPath=[Sales+Re
    ports]&sType=rpt&sWindow=New
    regards
    Sunil

  • EP6 and Citrix

    We want to expose our portal to the internet using the Citrix Access Gateway as an authentication tool.  We are having problems with this, we think due to URL re-writing.
    Has anyone managed to implement a similar model or have any advice as to how we might achieve this?
    Thanks
    Colin

    Stuart,
    single sigon-on from the user's local windows to the citrix desktop should be a standard citrix feature and can be realized.
    For SSO from the citrix desktop to the portal, this also works fine, as the portal won't see a difference between a user calling his browser from the local workstation and from calling it through citrix. In both cases you can follow the guidelines listed in the portal's security geuide (check service.sap.com/securityguide) for this.
    Regards,
    Dominik

Maybe you are looking for