当前位置: 首页>>代码示例>>Java>>正文


Java HttpBindManager.getInstance方法代码示例

本文整理汇总了Java中org.jivesoftware.openfire.http.HttpBindManager.getInstance方法的典型用法代码示例。如果您正苦于以下问题:Java HttpBindManager.getInstance方法的具体用法?Java HttpBindManager.getInstance怎么用?Java HttpBindManager.getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jivesoftware.openfire.http.HttpBindManager的用法示例。


在下文中一共展示了HttpBindManager.getInstance方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: service

import org.jivesoftware.openfire.http.HttpBindManager; //导入方法依赖的package包/类
@Override
protected void service( HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException
{
    final HttpBindManager boshManager = HttpBindManager.getInstance();

    // add CORS headers for all HTTP responses (errors, etc.)
    if (boshManager.isCORSEnabled())
    {
        if (boshManager.isAllOriginsAllowed()) {
            // Set the Access-Control-Allow-Origin header to * to allow all Origin to do the CORS
            response.setHeader( "Access-Control-Allow-Origin", HttpBindManager.HTTP_BIND_CORS_ALLOW_ORIGIN_DEFAULT);
        } else {
            // Get the Origin header from the request and check if it is in the allowed Origin Map.
            // If it is allowed write it back to the Access-Control-Allow-Origin header of the respond.
            final String origin = request.getHeader("Origin");
            if (boshManager.isThisOriginAllowed(origin)) {
                response.setHeader("Access-Control-Allow-Origin", origin);
            }
        }
        response.setHeader("Access-Control-Allow-Methods", HttpBindManager.HTTP_BIND_CORS_ALLOW_METHODS_DEFAULT);
        response.setHeader("Access-Control-Allow-Headers", HttpBindManager.HTTP_BIND_CORS_ALLOW_HEADERS_DEFAULT);
        response.setHeader("Access-Control-Max-Age", HttpBindManager.HTTP_BIND_CORS_MAX_AGE_DEFAULT);
    }
    super.service(request, response);
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:27,代码来源:CORSServlet.java

示例2: execute

import org.jivesoftware.openfire.http.HttpBindManager; //导入方法依赖的package包/类
@Override
public void execute(SessionData data, Element command) {
    DataForm form = new DataForm(DataForm.Type.result);

    FormField field = form.addField();
    field.setType(FormField.Type.hidden);
    field.setVariable("FORM_TYPE");
    field.addValue("http://jabber.org/protocol/admin");

    HttpBindManager manager = HttpBindManager.getInstance();
    boolean isEnabled = manager.isHttpBindEnabled();
    field = form.addField();
    field.setLabel("Http Bind Enabled");
    field.setVariable("httpbindenabled");
    field.addValue(String.valueOf(isEnabled));

    if (isEnabled) {
        field = form.addField();
        field.setLabel("Http Bind Address");
        field.setVariable("httpbindaddress");
        field.addValue(manager.getHttpBindUnsecureAddress());

        field = form.addField();
        field.setLabel("Http Bind Secure Address");
        field.setVariable("httpbindsecureaddress");
        field.addValue(manager.getHttpBindSecureAddress());

        String jsUrl = manager.getJavaScriptUrl();
        if (jsUrl != null) {
            field = form.addField();
            field.setLabel("Http Bind JavaScript Address");
            field.setVariable("javascriptaddress");
            field.addValue(jsUrl);
        }
    }

    command.add(form.getElement());
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:39,代码来源:HttpBindStatus.java

示例3: execute

import org.jivesoftware.openfire.http.HttpBindManager; //导入方法依赖的package包/类
@Override
public void execute(SessionData data, Element command) {
       DataForm form = new DataForm(DataForm.Type.result);

       FormField field = form.addField();
       field.setType(FormField.Type.hidden);
       field.setVariable("FORM_TYPE");
       field.addValue("http://jabber.org/protocol/admin");

       HttpBindManager manager = HttpBindManager.getInstance();
       boolean isEnabled = manager.isHttpBindEnabled();
       field = form.addField();
       field.setLabel("Http Bind Enabled");
       field.setVariable("httpbindenabled");
       field.addValue(String.valueOf(isEnabled));

       if (isEnabled) {
           field = form.addField();
           field.setLabel("Http Bind Address");
           field.setVariable("httpbindaddress");
           field.addValue(manager.getHttpBindUnsecureAddress());

           field = form.addField();
           field.setLabel("Http Bind Secure Address");
           field.setVariable("httpbindsecureaddress");
           field.addValue(manager.getHttpBindSecureAddress());

           String jsUrl = manager.getJavaScriptUrl();
           if (jsUrl != null) {
               field = form.addField();
               field.setLabel("Http Bind JavaScript Address");
               field.setVariable("javascriptaddress");
               field.addValue(jsUrl);
           }
       }

       command.add(form.getElement());
   }
 
开发者ID:coodeer,项目名称:g3server,代码行数:39,代码来源:HttpBindStatus.java


注:本文中的org.jivesoftware.openfire.http.HttpBindManager.getInstance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。