本文整理汇总了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);
}
示例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());
}
示例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());
}