Commit | Line | Data |
---|---|---|
1 | package dolda.jsvc.util; | |
2 | ||
3 | import dolda.jsvc.*; | |
4 | import java.net.*; | |
5 | ||
6 | public class RootRedirect extends Redirect { | |
7 | private final String to; | |
8 | ||
9 | public RootRedirect(String to) { | |
10 | this.to = to; | |
11 | } | |
12 | ||
13 | protected URL target(Request req) { | |
14 | try { | |
15 | return(new URL(req.rooturl(), Misc.stripslashes(to, true, false))); | |
16 | } catch(MalformedURLException e) { | |
17 | throw(new RuntimeException("Bad relative URL: + " + to, e)); | |
18 | } | |
19 | } | |
20 | } |