org.inria.ns.reflex.modules.web
Class MimeTypeFunction

java.lang.Object
  extended by org.inria.ns.reflex.xml.xpath.XPathFunction.NamedXPathFunction
      extended by org.inria.ns.reflex.modules.web.MimeTypeFunction
All Implemented Interfaces:
XPathFunction

public class MimeTypeFunction
extends XPathFunction.NamedXPathFunction
implements XPathFunction

The web:mime-type() function return the MIME type of a file. Notice that this function act as for the web scheme

Author:
Philippe Poulard
See Also:
WebFileProvider

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.inria.ns.reflex.xml.xpath.XPathFunction
XPathFunction.NamedXPathFunction
 
Constructor Summary
MimeTypeFunction()
           
 
Method Summary
static String evaluate(Object file)
          Return the MIME type of a file.
 Object evaluate(XPathContext context, List args)
          Perform the function.
 
Methods inherited from class org.inria.ns.reflex.xml.xpath.XPathFunction.NamedXPathFunction
getQName, setQName
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.inria.ns.reflex.xml.xpath.XPathFunction
getQName
 

Constructor Detail

MimeTypeFunction

public MimeTypeFunction()
Method Detail

evaluate

public Object evaluate(XPathContext context,
                       List args)
                throws XPathFunctionException
Perform the function.

Specified by:
evaluate in interface XPathFunction
Parameters:
context - The context of the function.
args - The list of arguments of this function.
Returns:
The result of the evaluation.
Throws:
XPathFunctionException - When this function fails to be evaluated.

evaluate

public static String evaluate(Object file)
                       throws FileSystemException
Return the MIME type of a file.

Parameters:
file - The file.
Returns:
Its MIME type.
Throws:
FileSystemException - When the object is not a file.