You can config Handler in JFinalConfig.configHandler() method, Handler can do anything under the jfinal action.
This class contains the information necessary to invoke a Handler. The {@link HandlerDefinition} class provides a definition of how to invokea Handler, this class uses that information with in conjuction with information provided in this class to execute the handler method. This class typically will hold input values and specify where output should be stored.
The handler method to be invoked must have the following method signature:
public void doSomething(HandlerContext handlerCtx)
void
be replaced with any type. Depending on the type of event, return values may be handled differently.
It is advisable to use Java annotations when defining a handler method. See examples of annotations in the com.sun.jsftemplating.handlers package
. Here is an example:
@Handler(id="abc:doSomething",
input={
@HandlerInput(name="foo", type=Integer.class),
@HandlerInput(name="bar", type=My.class, required=true)
},
output={
@HandlerOutput(name="result", type=String.class)
})
public void doSomething(HandlerContext handlerCtx)
@author Ken Paulsen (ken.paulsen@sun.com)
A Handler can be disabled by doing a setLevel(Level.OFF) and can be re-enabled by doing a setLevel with an appropriate level.
Handler classes typically use LogManager properties to set default values for the Handler's Filter, Formatter, and Level. See the specific documentation for each concrete Handler class. @version 1.21, 04/07/06 @since 1.4
Handler
interface is the base interface for JAX-WS handlers.
@since JAX-WS 2.0
index.html;sha=99f6837808c0a79398bf69d83cfb1b82d20cf0cf,Comment
,.jar
@author Sun Microsystems, Inc.
@see HttpmdUtil
@since 2.0
@com.sun.jini.impl This implementation of HTTPMD URLs uses the {@link Logger} namednet.jini.url.httpmd
to log information at the following logging levels:
Level | Description |
---|---|
{@link Levels#FAILED FAILED} | URL input stream detects anincorrect message digest |
See the {@link LogManager} class for one way to use the FAILED
logging level in standard logging configuration files.
Nettosphere server = new Nettosphere.Builder().config( new Config.Builder() .host("127.0.0.1") .port(8080) .resource(new Handler() { void handle(AtmosphereResource r) { r.getResponse().write("Hello World".write("from Nettosphere").flush(); } }) .build()) .build(); server.start();
A handler is just something that processes an XML message.
If an exception occurrs in the invoke method, the entity which started the invocation, is responsible for turning the exception into a fault.
@author Dan Diephouse @since Feb 18, 2004Handler
. It defines all methods that must be implemented by all handlers.
@author Andreas Mecky
@author Terry Dye
@created 9. M�rz 2002
@version 1.0
The {@link #init(Server,String)} method is called before thisHandler
processes the first HTTP request, to allow it to prepare itself, such as by allocating any resources needed for the lifetime of the server
.
The {@link #respond(Request)} method is called to handle an HTTP request.This method, and all methods it calls must be thread-safe since they may handle HTTP requests from multiple sockets concurrently. However, each concurrent request gets its own individual {@link Request} object.
Any instance variables should be initialized in the {@link #init(Server,String)}, and only referenced, but not set in the {@link #respond(Request)} method. If any state needs to be retained, it should be done either by associating it with the {@link Request}object, or using the {@link sunlabs.brazil.session.SessionManager session manager}. Class statics should be avoided, as it is possible, and even common to run multiple unrelated Brazil servers in the same JVM. As above, the {@link sunlabs.brazil.session.SessionManager session manager}should be used instead. @author Stephen Uhler (stephen.uhler@sun.com) @author Colin Stevens (colin.stevens@sun.com) @version 2.3
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|