归档插件
| Modifiers | Name | Description |
|---|---|---|
static Integer |
aliasOverridingOrder |
| Type | Name and description |
|---|---|
FileConvertService |
fileConvertService |
OsmEmployeeService |
osmEmployeeService |
SettingService |
settingService |
| Type | Name and description |
|---|---|
String |
archiveTo(String type, String username, String url, String filename, Closure htmlHandler)将文档归档为 html、pdf、图片等类型的文件 |
String |
archiveTo(String type, String username, String controller, String action, String id, String filename, Closure htmlHandler)将文档归档为 html、pdf、图片等类型的文件 |
static void |
bootStrapInit()初始化,以启用Archive SSO |
protected Map |
convertToHtml(String url)请求服务器,获得返回的 HTML |
protected String |
getArchiveUrl(String url, String username)在归档的 URL 后拼接单点登录的参数 |
protected String |
getDocumentUrl(String controller, String action, String id)计算打开文档的全限定 URL,如 http://host:port/Foobar/xxx/1 |
protected void |
logArchive(Object bean, String title, String errorMsg)记录归档日志 |
| Methods inherited from class | Name |
|---|---|
class Object |
Object#wait(long, int), Object#wait(long), Object#wait(), Object#equals(Object), Object#toString(), Object#hashCode(), Object#getClass(), Object#notify(), Object#notifyAll() |
将文档归档为 html、pdf、图片等类型的文件
注意归档完成后即时删除临时文件,或者用FileUtils.moveFile等方式移走。
type - 转换类型,包括 jpg、png、pdf、htmlusername - 有权限访问文档的用户登录名,一般是当前用户url - 访问文档的全限定 URL,如 http://host:port/Foobar/xxx/1filename - 目标文件路径,如果为空,则返回一个临时文件htmlHandler - 处理生成的HTML字符串的闭包,处理完后返回一个新的字符串即可将文档归档为 html、pdf、图片等类型的文件
例如 archiveService.archiveTo("png", "admin", "osmEmployeeAdmin", "show", "1", null, null)
controller - 用于生成文档访问路径的控制器、操作、ID等信息初始化,以启用Archive SSO
SSO成功后,可以通过 “session.sso == "Archive"” 来判断。
请求服务器,获得返回的 HTML
如果 HTTP 请求异常,则直接抛出;如果转换异常,则返回 RuntimeException,包含异常ID和错误消息。
在归档的 URL 后拼接单点登录的参数
计算打开文档的全限定 URL,如 http://host:port/Foobar/xxx/1
记录归档日志