BAEL-305: Simplified FrontControllerServlet. Removed unused JBoss deployment descriptor.
This commit is contained in:
parent
4a3460fd01
commit
eb6f0214ca
|
@ -22,24 +22,17 @@ public class FrontControllerServlet extends HttpServlet {
|
|||
|
||||
private FrontCommand getCommand(HttpServletRequest request) {
|
||||
try {
|
||||
return (FrontCommand) getCommandClass(request)
|
||||
.asSubclass(FrontCommand.class)
|
||||
.newInstance();
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("Failed to get command!", e);
|
||||
}
|
||||
}
|
||||
|
||||
private Class getCommandClass(HttpServletRequest request) {
|
||||
try {
|
||||
return Class.forName(
|
||||
Class type = Class.forName(
|
||||
String.format(
|
||||
"com.baeldung.enterprise.patterns.front.controller.commands.%sCommand",
|
||||
request.getParameter("command")
|
||||
)
|
||||
);
|
||||
} catch (ClassNotFoundException e) {
|
||||
return UnknownCommand.class;
|
||||
return (FrontCommand) type
|
||||
.asSubclass(FrontCommand.class)
|
||||
.newInstance();
|
||||
} catch (Exception e) {
|
||||
return new UnknownCommand();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE jboss-web PUBLIC "-//JBoss//DTD Web Application 5.0//EN"
|
||||
"http://www.jboss.org/j2ee/dtd/jboss-web_5_0.dtd">
|
||||
<jboss-web>
|
||||
<context-root>/front-controller/</context-root>
|
||||
</jboss-web>
|
Loading…
Reference in New Issue