org.xins.server.CustomCallingConvention Maven / Gradle / Ivy
/*
* $Id: CustomCallingConvention.java,v 1.29 2010/09/29 17:21:48 agoubard Exp $
*
* See the COPYRIGHT file for redistribution and use restrictions.
*/
package org.xins.server;
import javax.servlet.http.HttpServletRequest;
/**
* Base class for calling convention implementations that are not part of the
* core XINS framework.
*
* Extend this class to create your own calling conventions. Make sure you
* override {@link #matches(HttpServletRequest)}.
*
*
If your custom calling convention takes XML as input, you are advised to
* use {@link #parseXMLRequest(HttpServletRequest)} to parse the request.
*
* @version $Revision: 1.29 $ $Date: 2010/09/29 17:21:48 $
* @author Anthony Goubard
* @author Ernst de Haan
*/
public abstract class CustomCallingConvention extends CallingConvention {
/**
* Constructs a new CustomCallingConvention
.
*/
public CustomCallingConvention() {
// empty
}
/**
* Checks if the specified request can possibly be handled by this calling
* convention as a function invocation.
*
*
Implementations of this method should be optimized for performance,
* as this method may be called for each incoming request. Also, this
* method should not have any side-effects except possibly some caching in
* case there is a match.
*
*
The default implementation of this method always returns
* true
.
*
*
If this method throws any exception, the exception is logged as an
* ignorable exception and false
is assumed.
*
*
This method should only be called by the XINS/Java Server Framework.
*
* @param httpRequest
* the HTTP request to investigate, never null
.
*
* @return
* true
if this calling convention is possibly
* able to handle this request, or false
if it is
* definitely not able to handle this request.
*
* @throws Exception
* if analysis of the request causes an exception; in this case
* false
will be assumed by the framework.
*
* @since XINS 1.4.0
*/
protected boolean matches(HttpServletRequest httpRequest)
throws Exception {
return true;
}
}