githubgit / urlrewritefilter

Automatically exported from code.google.com/p/urlrewritefilter
Other
0 stars 0 forks source link

Please add 303 (See Other) support so urlrewritefilter can be used with Linked Data use cases #94

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

This tool would be extremely useful for Linked Data if you added support for 
HTTP 303 (See Other) redirects.

What is the expected output? What do you see instead?

The behavior of 303 (See Also) should be identical to the 301 
("permanent-redirect") and 302 ("temporary-redirect"). The difference is subtle 
but essential for Linked Data applications. 

What version of the product are you using? On what operating system?

3.2

Please provide any additional information below.

More information about the use of HTTP 303 can be found in this document: 
http://www.w3.org/TR/cooluris/.

Original issue reported on code.google.com by realworl...@gmail.com on 20 Jun 2011 at 2:26

GoogleCodeExporter commented 9 years ago
You can always use a workaround:
<rule>
  <from>/see/other/.*</from>
  <run class="com.example.Redirector" />
</rule>

package com.example;
public class Redirector {
  public void run(HttpServletRequest request, HttpServletResponse response) {
    response.setStatus(HttpServletResponse.SC_SEE_OTHER);
    response.setHeader("Location", "http://example.com/somewhere/else");
  }
}

Original comment by le.xi...@gmail.com on 20 Jun 2011 at 8:21

GoogleCodeExporter commented 9 years ago
Thanks for the hint. Getting this to work with urlrewritefilter 3.2 and Tomcat 
7.0.16 required some extreme voodoo, though: 

<rule>
  <from>/see/other/.*</from>
  <run class="com.example.Redirector" />
  <to>Random but required garbage</to>
</rule>

package com.example;
public class Redirector {
  public void run(HttpServletRequest request, HttpServletResponse response) {
    String location = "http://example.com/somewhere/else";
    response.setStatus(HttpServletResponse.SC_SEE_OTHER);
    response.setHeader("Location", location);
    response.addHeader("Content-Type", "text/plain");
    String entityBody = "See Other: " + location;
    response.setContentLength(entityBody.length());
    response.getOutputStream().write(entityBody.getBytes());
  }
}

Original comment by realworl...@gmail.com on 3 Jul 2011 at 3:11

GoogleCodeExporter commented 9 years ago
I submitted changes to implement a SeeOther redirect in issue 124.  I probably 
should have put the changes here...

Original comment by doug.whi...@gmail.com on 16 Oct 2012 at 3:00