public class ServletRequestDispatcher extends Object
private ServletRequestDispatcher mRequestDispatcher = new ServletRequestDispatcher(); //--------------------------------------------------------------------------- public void init() { mRequestDispatcher.registerDefaultHandler(MainPage.class); // Handler invoked if there are no params mRequestDispatcher.registerHandler(PAGE, MAIN_PAGE, MainPage.class); } //--------------------------------------------------------------------------- public void doGet(HttpServletRequest inRequest, HttpServletResponse inResponse) { handleRequest(inRequest, inResponse); } //--------------------------------------------------------------------------- public void doPost(HttpServletRequest inRequest, HttpServletResponse inResponse) { handleRequest(inRequest, inResponse); } //--------------------------------------------------------------------------- private void handleRequest(HttpServletRequest inRequest, HttpServletResponse inResponse) { try { mRequestDispatcher.dispatch(inRequest, inResponse); } catch (Throwable e) { e.printStackTrace(); } }
Constructor and Description |
---|
ServletRequestDispatcher() |
Modifier and Type | Method and Description |
---|---|
void |
dispatch(javax.servlet.http.HttpServletRequest inRequest,
javax.servlet.http.HttpServletResponse inResponse) |
boolean |
getAllowPartialPathMatches() |
ServletRequestDispatcher |
registerDefaultHandler(Class inValue) |
ServletRequestDispatcher |
registerParamHandler(String inParam,
String inValue,
Class inHandlerClass) |
ServletRequestDispatcher |
registerPathHandler(String inPath,
Class inHandlerClass) |
ServletRequestDispatcher |
setAllowPartialPathMatches(boolean inValue)
Specifies whether or not registered path values can be matched to the start of
requested paths as broken by the path separator '/'.
|
public ServletRequestDispatcher()
public ServletRequestDispatcher registerDefaultHandler(Class inValue)
public ServletRequestDispatcher registerPathHandler(String inPath, Class inHandlerClass)
public ServletRequestDispatcher registerParamHandler(String inParam, String inValue, Class inHandlerClass)
public ServletRequestDispatcher setAllowPartialPathMatches(boolean inValue)
inValue
- whether or not registered path values can be matched to the start of
requested paths as broken by the path separator '/'.public boolean getAllowPartialPathMatches()