public class StaticFile extends Object implements TemplateEngine
TEMPLATE_CONTEXT| 构造器和说明 |
|---|
StaticFile() |
public byte[] process(byte[] template,
String templatePath,
Object templateContext)
TemplateEnginetemplateContext with a template to produce output. What constitutes a valid
context is template-engine specific.
Rendering happens on your main thread, so it is important that this method is not IO-bound. For example,
rendering a template using a context that is some sort of active record
that makes trips to the database will block Webbit preventing it from handling other requests. It's important to
make sure any remote data is pre-fetched.
Webbit will pass the request data value keyed with TemplateEngine.TEMPLATE_CONTEXT as the templateContext argument.
It's the programmer's responsibility to make sure the data value is set before the template is rendered,
i.e. before the StaticFileHandler or EmbeddedResourceHandler handler instance handles a request.process 在接口中 TemplateEnginetemplate - the template sourcetemplatePath - the path the template is read from. Allows implementations to cache compiled templates.templateContext - object to merge into the templateDataHolder.data(String),
HttpRequest.data(String, Object)Copyright © 2014. All rights reserved.