Redirect doesn't work

Use this forum for questions regarding adoption and functionality of OpenEMM

Moderator: moderator

Redirect doesn't work

Postby zanuda » Thu Feb 26, 2015 8:06 pm

Hello!

I'm using OpenEMM 2013 on Windows Server 2008 and now I discover, that redirect page doesn't work. If I try to click on a link, only internal link like http://<ip_address>:8080/r.html?uid=1.d.n.1z.p4jn50ebmi appears at the browser without redirect. OpenEMM is available on the link http://<ip_address>:8080. Links in the database look well.

Have anyone ideas what is wrong?

One qualification: OpenEMM fixes the fact of clicking a link. I can see the records in database. But no redirection appears. May be it is a problem of Tomcat?
zanuda
 
Posts: 6
Joined: Mon Mar 03, 2014 12:00 pm

Re: Redirect doesn't work

Postby zanuda » Fri Feb 27, 2015 8:49 pm

Problem was resolved. I'm not a java programmer, but it's seems to me that the following code in rdir.java sometimes doesn't work properly:

Code: Select all
      if (AgnUtils.getDefaultValue("redirection.status") == null || AgnUtils.getDefaultIntValue("redirection.status") == 302) {
         res.sendRedirect(fullUrl);
         // res.sendRedirect(aLink.getFullUrl());
      } else {
         res.setStatus(AgnUtils.getDefaultIntValue("redirection.status"));
         res.setHeader("Location", fullUrl);
         res.flushBuffer();
      }


I've checked http response of redirect page and discovered, that the status hasn't been returned, but header "Location" has been added:

HTTP/1.1 0 OK
Server: Apache-Coyote/1.1
Location: http://<link>
Transfer-Encoding: chunked
Date: Fri, 27 Feb 2015 17:25:17 GMT

So my hypothesis is that condition
Code: Select all
AgnUtils.getDefaultValue("redirection.status") == null || AgnUtils.getDefaultIntValue("redirection.status") == 302
doesn't work properly in my case, because header "Location" is added in the "else" branch.

Then I'd tried to comment key redirection.status=302 in emm.properties and redirect started to work. Is my hypothesis correct?

The absence of the key redirection.status=302 generates error
Code: Select all
2015-02-27 22:20:21,591: ERROR [http-8080-1] org.agnitas.util.AgnUtils - getDefa
ultValue: Can't find resource for bundle java.util.PropertyResourceBundle, key r
edirection.status

but it is not critical for me.
zanuda
 
Posts: 6
Joined: Mon Mar 03, 2014 12:00 pm


Return to Using OpenEMM

Who is online

Users browsing this forum: No registered users and 2 guests