Shortening URLs with JSP

0
No votes yet

OK, attending the Luminis Lounge at Summit was fantastic. It was great meeting people
and exchanging ideas ... and while I'm still motivated, I'll post at least a few things
people asked about and here's number one: the redirect.jsp page

You all know Luminis creates these extremely long URLs like this:

http://portal.yourschool.edu/cp/render.UserLayoutRootNode.uP?uP_tparam=utf&utf=
http%3A%2F%2Fportal.yourschool.edu%2Fcp%2Fip%2Flogin%3F%26sys%3Dsct%26url%3D
https%253A%252F%252Fssb.yourschool.edu%252Fbanner%252Fplsql%252Fbwgksrvy.
P_ShowSurveys

That will SSO you into Banner Self Service's survey page - we use Banner for course surveys
- as well as frame it. We created a simple simple JSP that takes one argument and uses
that to redirect to those crazy links:

http://portal.yourschool.edu/cp/redirect.jsp?id=survey

Here's the code snippet:

  String HOUSING = "housing";
  String SURVEY = "survey";
  String sUrl = "";
  String id = request.getParameter("id");
  if (null == id)
     id = "NONE";

  if (id.equalsIgnoreCase(SURVEY)) {
      sUrl = "http://portal.yourschool.edu/cp/render.UserLayoutRootNode.uP?uP_tparam=utf&utf=http%3A%2F%2Fportal.yourschool.edu%2Fcp%2Fip%2Flogin%3F%26sys%3Dsct%26url%3Dhttps%253A%252F%252Fssb.yourschool.edu%252Fbanner%252Fplsql%252Fbwgksrvy.P_ShowSurveys";
  } else if (id.equalsIgnoreCase(HOUSING)) {
      sUrl = "http://portal.yourschool.edu/cp/render.UserLayoutRootNode.uP?uP_tparam=utf&utf=http%3A%2F%2Fportal.yourschool.edu%2Fcp%2Fip%2Flogin%3F%26sys%3Dsct%26url%3Dhttps%253A%252F%252Fssb.yourschool.edu%252Fbanner%252Fplsql%252Fhwwksint.P_OnlineDormRegistration";
  }

 if (sUrl.length() < 1) {
    /*  Give some error message here */
  } else {
    /* Do some type of redirection here.    
     *
     * We use a JavaScript onLoad redirect, with message
     * to click if the page does not refresh.
     */

 }

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

redirect jsp

That's cool, I am going to attempt to make a controller servlet to handle this, which is basically what you've done. I have wondered why this couldn't work, I see now it can.

Requires a restart?

Hi,

Just wondering if the webserver needs to be restarted if any change is made to the jsp file (say adding new links or modifying existing ones).

thanks

JSP in Luminis

Hi Mike...

I just wanted to say my one sincere regret for the conference was missing your session. Everyone said it was great. :-(

One quick question-someone mentioned to me one of the other things you presented was a way to protect content in jsp files behind portal authentication-have you done anything like this?

Slides from Summit

Are you planning to publish the slides from your Summit 2006 presentation "Luminis as a Java Web Application"?

Carl Olsen
Web Developer, CMS Implementation
Drake University

Does this work only within luminis?

I'm assuming that you already have to have a session established in Luminis for this to work properly. Or have you found a way for it to ask for the login and then pass you on to the redirected URL?

That would be super cool, since then we could just inlcude links in other locations and provide (essentially) one click access in. In all of our attempts, we have run in to the session expired page when trying so have put that type of work on the back burner.

We have been using a similar type of action in targetted content channels where we call specific packages deeper in Self Service and essentially "deep dive" straight to the packages. In those cases, it doesn't really matter what the URL looks like since it is in the URL definition and not seen by end users.

Dallas

To make this a bit more

To make this a bit more flexible, rather than hard coding the switch strings and the paths to redirect, you could create a properties file and at runtime read them into a hash where if the id parameter value, ie: the key into the hash, isn't found you redirect to a default.