commit | author | age
|
f4a79c
|
1 |
/*
|
U |
2 |
* To change this license header, choose License Headers in Project Properties.
|
|
3 |
* To change this template file, choose Tools | Templates
|
|
4 |
* and open the template in the editor.
|
|
5 |
*/
|
|
6 |
package de.uhilger.um.web;
|
|
7 |
|
|
8 |
import java.io.IOException;
|
|
9 |
import javax.servlet.Filter;
|
|
10 |
import javax.servlet.FilterChain;
|
|
11 |
import javax.servlet.FilterConfig;
|
|
12 |
import javax.servlet.ServletException;
|
|
13 |
import javax.servlet.ServletRequest;
|
|
14 |
import javax.servlet.ServletResponse;
|
|
15 |
import javax.servlet.http.HttpServletRequest;
|
|
16 |
|
|
17 |
/**
|
|
18 |
*
|
|
19 |
* @author hilgeru
|
|
20 |
*/
|
|
21 |
public class NiceFilter implements Filter {
|
|
22 |
|
|
23 |
@Override
|
|
24 |
public void init(FilterConfig filterConfig) throws ServletException {
|
|
25 |
// ...
|
|
26 |
}
|
|
27 |
|
|
28 |
@Override
|
|
29 |
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
|
|
30 |
if(request instanceof HttpServletRequest) {
|
|
31 |
HttpServletRequest hr = (HttpServletRequest) request;
|
|
32 |
String servletPath = hr.getServletPath();
|
|
33 |
String[] path = servletPath.split("/");
|
|
34 |
request.getRequestDispatcher("../api?c=de.uhilger.um.api.UserMgr&m=" + path[2]).forward(request, response);
|
|
35 |
}
|
|
36 |
}
|
|
37 |
|
|
38 |
@Override
|
|
39 |
public void destroy() {
|
|
40 |
// ...
|
|
41 |
}
|
|
42 |
|
|
43 |
}
|