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


Java IMxRuntimeResponse.addHeader方法代码示例

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


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

示例1: redirectToIndex

import com.mendix.m2ee.api.IMxRuntimeResponse; //导入方法依赖的package包/类
public static void redirectToIndex(IMxRuntimeResponse resp, String continuation)
{
	resp.setStatus(IMxRuntimeResponse.SEE_OTHER);

	//no continuation provided, use index
	if (continuation == null)
		resp.addHeader("location", OpenIDHandler.INDEX_PAGE);
	else {
		if (continuation.trim().startsWith("javascript:")) {
			throw new IllegalArgumentException("Javascript injection detected!");
		} else if (!continuation.startsWith("http://") && !continuation.startsWith("https://")) {
			resp.addHeader("location", OpenIDUtils.APPLICATION_ROOT_URL + continuation);
		} else {
			resp.addHeader("location", continuation);
		}
	}
}
 
开发者ID:mendix,项目名称:IBM-Watson-Connector-Suite,代码行数:18,代码来源:SessionInitializer.java

示例2: logoff

import com.mendix.m2ee.api.IMxRuntimeResponse; //导入方法依赖的package包/类
private void logoff(IMxRuntimeRequest req, IMxRuntimeResponse resp) throws CoreException {
	if (SINGLESIGNOFF_ENABLED) {
		resp.addCookie(getSessionCookieName(), "", "/", "", 0, true);
		resp.addCookie(SessionInitializer.XASID_COOKIE, "", "/", "", 0, true);
		resp.setStatus(IMxRuntimeResponse.SEE_OTHER);
		resp.addHeader("location", OPENID_PROVIDER + "/../" + LOGOFF);
	} else {
		ISession ses = this.getSessionFromRequest(req);
		if (ses != null) {
			Core.logout(ses);
		}
		redirect(resp, INDEX_PAGE);
	}
}
 
开发者ID:mendix,项目名称:IBM-Watson-Connector-Suite,代码行数:15,代码来源:OpenIDHandler.java

示例3: logoff

import com.mendix.m2ee.api.IMxRuntimeResponse; //导入方法依赖的package包/类
private void logoff(IMxRuntimeRequest req, IMxRuntimeResponse resp) throws CoreException {
	if (SINGLESIGNOFF_ENABLED) {
		resp.addCookie(Core.getConfiguration().getSessionIdCookieName(), "", "/", "", 0, true);
		resp.addCookie(SessionInitializer.XASID_COOKIE, "", "/", "", 0, true);
		resp.setStatus(IMxRuntimeResponse.SEE_OTHER);
		resp.addHeader("location", OPENID_PROVIDER + "/../" + LOGOFF);
	} else {
		ISession ses = this.getSessionFromRequest(req);
		if (ses != null) {
			Core.logout(ses);
		}
		redirect(resp, INDEX_PAGE);
	}
}
 
开发者ID:mendix,项目名称:EmailModuleWithTemplates,代码行数:15,代码来源:OpenIDHandler.java

示例4: processRequest

import com.mendix.m2ee.api.IMxRuntimeResponse; //导入方法依赖的package包/类
/**
 * Handles openId related requests. Two requests are supported:
 * 'openid/login': tries to setup a new user session. (Note: does not check if there is already a session)
 * 'openid/callback': used by the openId provider to confirm the identity of the current user
 */
@Override
public void processRequest(IMxRuntimeRequest req, IMxRuntimeResponse resp,
						   String path) throws Exception {

	//always force expiration on this handler!
	resp.addHeader("Expires", "0");

	if (LOG.isDebugEnabled())
		LOG.debug("Incoming request: " + path + " fingerprint: " + getFingerPrint(req));

	if (!OPENID_ENABLED) {
		LOG.info("NOT handling SSO request, disabled by configuration, redirecting to login.html");
		redirect(resp, FALLBACK_LOGINPAGE);
		return;
	}

	if (!started) {
		reconnectToMxID();
	}

	if (!started) {
		LOG.error("NOT handling SSO request, could not connect to MxID 2.0, redirecting to login.html");
		redirect(resp, FALLBACK_LOGINPAGE);
		return;
	}

	try {
		if (LOGOFF.equalsIgnoreCase(path)) {
			logoff(req, resp); //requesting Single Sign Off (from client)
		} else if (FORCE_LOGOFF.equalsIgnoreCase(path)) {
			forceLogoff(req, resp); //requesting Single Sign Off (from server)
		} else if (LOGIN.equalsIgnoreCase(path)) {
			login(req, resp); //requesting authorization
		} else if (CALLBACK.equalsIgnoreCase(path)) {
			callback(req, resp); //redirect from open id provider
		} else {
			error(resp, ResponseType.INTERNAL_SERVER_ERROR, "Unsupported request '" + path + "'", null);
		}
	} catch (Exception e) {
		error(resp, ResponseType.INTERNAL_SERVER_ERROR, "An unexpected exception occurred while handling request " + path, e);
	}
}
 
开发者ID:mendix,项目名称:IBM-Watson-Connector-Suite,代码行数:48,代码来源:OpenIDHandler.java

示例5: redirect

import com.mendix.m2ee.api.IMxRuntimeResponse; //导入方法依赖的package包/类
private void redirect(IMxRuntimeResponse resp, String url) {
	resp.setStatus(IMxRuntimeResponse.SEE_OTHER);
	resp.addHeader("location", url);
}
 
开发者ID:mendix,项目名称:IBM-Watson-Connector-Suite,代码行数:5,代码来源:OpenIDHandler.java

示例6: processRequest

import com.mendix.m2ee.api.IMxRuntimeResponse; //导入方法依赖的package包/类
/**
 * Handles openId related requests. Two requests are supported:
 * 'openid/login': tries to setup a new user session. (Note: does not check if there is already a session)
 * 'openid/callback': used by the openId provider to confirm the identity of the current user
 */
@Override
public void processRequest(IMxRuntimeRequest req, IMxRuntimeResponse resp,
						   String path) throws Exception {

	//always force expiration on this handler!
	resp.addHeader("Expires", "0");

	if (log.isDebugEnabled())
		log.debug("Incoming request: " + path + " fingerprint: " + getFingerPrint(req));

	if (!OPENID_ENABLED) {
		log.info("NOT handling SSO request, disabled by configuration, redirecting to login.html");
		redirect(resp, FALLBACK_LOGINPAGE);
		return;
	}

	if (!started) {
		reconnectToMxID();
	}

	if (!started) {
		log.error("NOT handling SSO request, could not connect to MxID 2.0, redirecting to login.html");
		redirect(resp, FALLBACK_LOGINPAGE);
		return;
	}

	try {
		if (LOGOFF.equalsIgnoreCase(path)) {
			logoff(req, resp); //requesting Single Sign Off (from client)
		} else if (FORCE_LOGOFF.equalsIgnoreCase(path)) {
			forceLogoff(req, resp); //requesting Single Sign Off (from server)
		} else if (LOGIN.equalsIgnoreCase(path)) {
			login(req, resp); //requesting authorization
		} else if (CALLBACK.equalsIgnoreCase(path)) {
			callback(req, resp); //redirect from open id provider
		} else {
			error(resp, ResponseType.INTERNAL_SERVER_ERROR, "Unsupported request '" + path + "'", null);
		}
	} catch (Exception e) {
		error(resp, ResponseType.INTERNAL_SERVER_ERROR, "An unexpected exception occurred while handling request " + path, e);
	}
}
 
开发者ID:mendix,项目名称:EmailModuleWithTemplates,代码行数:48,代码来源:OpenIDHandler.java


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