Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bcopy/redirect-servlet
https://github.com/bcopy/redirect-servlet
Last synced: 7 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/bcopy/redirect-servlet
- Owner: bcopy
- License: other
- Created: 2015-07-20T10:06:32.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2014-02-01T00:26:21.000Z (almost 11 years ago)
- Last Synced: 2024-10-10T22:26:53.981Z (28 days ago)
- Language: Java
- Size: 168 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# redirect-servlet.war
Use this when you depressingly find out that you can't use an HTTP server for
your redirects and instead are limited to your Java EE application server.When deployed, it will redirect any path inside the application's context root
to a configurable new URL, including parameters.Example:
| WAR context root | ```new.base.url``` | User enters | Redirected to |
| ----------------- | --------------------------- | --------------------------------------------------------- | -------------------------------------------------------- |
| /redirect-servlet | http://newsite.com | http://oldsite.com/redirect-servlet/index.html?page=about | http://newsite.com/index.html?page=about |
| /redirect-servlet | http://newsite.com | http://oldsite.com/redirect-servlet/page/about/me | http://newsite.com/page/about/me |
| /redirect-servlet | / _(or blank)_ | http://oldsite.com/redirect-servlet/mypage.html | http://oldsite.com/mypage.html |
| /redirect-servlet | /some-servlet | http://oldsite.com/redirect-servlet/mypage.html | http://oldsite.com/some-servlet/mypage.html |
| /redirect-servlet | new-path | http://oldsite.com/redirect-servlet/mypage.html | http://oldsite.com/redirect-servlet/new-path/mypage.html |
| / | http://newsite.com/wiki | http://oldsite.com/ | http://newsite.com/wiki/ |
| /example | http://newsite.com/personal | http://oldsite.com/example/mypage.html | http://newsite.com/personal/mypage.html |## Compatibility
Java EE 5 / Servlet 2.5 and higher (tested on WebSphere Application Server 7)
Lots of quirks on J2EE 1.4 / Servlet 2.4 (modification required for WebSphere
Application Server 6.1)## Usage
Update ```src/main/webapp/WEB-INF/application.properties``` with your desired
```new.base.url```. This is formatted at runtime to remove a trailing ```/```
if it is present.Run ```mvn clean package``` to build the WAR.
Deploy to your application server. You may have to rename the WAR depending
on how your container determines the context root.