类 GetHtmlMethod

java.lang.Object
com.publiccms.common.base.BaseMethod
com.publiccms.views.method.tools.GetHtmlMethod
所有已实现的接口:
freemarker.template.TemplateMethodModel, freemarker.template.TemplateMethodModelEx, freemarker.template.TemplateModel

@Component public class GetHtmlMethod extends BaseMethod
getHtml 获取远程页面文本

参数列表

parameter list

パラメータリスト

  1. url:
  2. 参数,map类型或string类型,为空时以get方式请求,不为空时以post方式请求
  3. 请求头,map类型

返回结果

return result

戻り値

  • html:页面文本

使用示例

usage example

使用例

${getHtml('https://www.publiccms.com/')}

${getHtml('https://www.publiccms.com/',"body")}

${getHtml('https://www.publiccms.com/',{"parameters1":"value1","parameters2":"value2"},{"headers1":"value1","headers2":"value2"})}

<script>
$.getJSON('${site.dynamicPath}api/method/getHtml?appToken=接口访问授权Token&parameters=https://www.publiccms.com/', function(data){
console.log(data);
});
</script>
 
  • 字段详细资料

  • 构造器详细资料

    • GetHtmlMethod

      public GetHtmlMethod()
  • 方法详细资料

    • execute

      public Object execute(jakarta.servlet.http.HttpServletRequest request, List<freemarker.template.TemplateModel> arguments) throws freemarker.template.TemplateModelException
      覆盖:
      execute 在类中 BaseMethod
      抛出:
      freemarker.template.TemplateModelException
    • execute

      public Object execute(List<freemarker.template.TemplateModel> arguments) throws freemarker.template.TemplateModelException
      指定者:
      execute 在类中 BaseMethod
      抛出:
      freemarker.template.TemplateModelException
    • execute

      public Object execute(SysSite site, List<freemarker.template.TemplateModel> arguments) throws freemarker.template.TemplateModelException
      抛出:
      freemarker.template.TemplateModelException
    • needAppToken

      public boolean needAppToken()
      指定者:
      needAppToken 在类中 BaseMethod
      返回:
      whether to need app token
    • minParametersNumber

      public int minParametersNumber()
      指定者:
      minParametersNumber 在类中 BaseMethod
      返回:
      min parameters number