org.nanocontainer.nanowar.nanoweb
Class NanoWebServlet
java.lang.Object
javax.servlet.GenericServlet
javax.servlet.http.HttpServlet
org.nanocontainer.nanowar.nanoweb.NanoWebServlet
- All Implemented Interfaces:
- KeyConstants, Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig
- public class NanoWebServlet
- extends javax.servlet.http.HttpServlet
- implements KeyConstants
Dispatcher servlet for NanoWeb.
NanoWeb is an ultra simple MVC framework inspired from WebWork It is based on ScriptedContainerBuilderFactory,
PicoContainer, Ognl, Groovy and Velocity.
Design goals:
- One-file configuration (all in an embedded ScriptedContainerBuilderFactory script in web.xml)
- Sensible defaults with the goal to reduce the need for complex configuration
- Non intrusiveness. Actions are PicoComponents/POJOs that extend nothing
- Actions can be written in a compilable scripting language like Groovy
- Actions must implement a String execute() method
- The result from execute will be used to determine the view path. Example: /something.nano + "success" -> /something_success.vm
Other things:
- Map action paths to action classes in nanocontainer servlet script (using groovy)
- Views can set values in actions with Ognl expressions
- Version:
- $Revision: 2528 $
- Author:
- Aslak Hellesøy, Kouhei Mori
- See Also:
- Serialized Form
Method Summary |
protected void |
handleServiceScriptException(ScriptException e,
javax.servlet.http.HttpServletResponse httpServletResponse,
javax.servlet.http.HttpServletRequest httpServletRequest)
This overridable method contains the default behavior for the catching of ScriptException during the
service call. |
void |
init()
|
protected void |
service(javax.servlet.http.HttpServletRequest httpServletRequest,
javax.servlet.http.HttpServletResponse httpServletResponse)
|
Methods inherited from class javax.servlet.http.HttpServlet |
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service |
Methods inherited from class javax.servlet.GenericServlet |
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
NanoWebServlet
public NanoWebServlet()
init
public void init()
throws javax.servlet.ServletException
- Throws:
javax.servlet.ServletException
service
protected void service(javax.servlet.http.HttpServletRequest httpServletRequest,
javax.servlet.http.HttpServletResponse httpServletResponse)
throws javax.servlet.ServletException,
IOException
- Throws:
javax.servlet.ServletException
IOException
handleServiceScriptException
protected void handleServiceScriptException(ScriptException e,
javax.servlet.http.HttpServletResponse httpServletResponse,
javax.servlet.http.HttpServletRequest httpServletRequest)
throws IOException
- This overridable method contains the default behavior for the catching of ScriptException during the
service call. Because different containers suck at handling exceptions, this default behavior displays
a simple page. Teams deploying NanoWebServlet may want to extend and replace this functionality. This
servlet may be participating with some larger model-2 design.
- Parameters:
e
- the script exceptionhttpServletResponse
- the servlet responsehttpServletRequest
- the servlet request
- Throws:
IOException
- if for some bizarre reason the outgoing page cannot be written to.
Copyright © 2003-2006 Codehaus. All Rights Reserved.