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


Java IMxRuntimeResponse.setStatus方法代码示例

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


在下文中一共展示了IMxRuntimeResponse.setStatus方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: callback

import com.mendix.m2ee.api.IMxRuntimeResponse; //导入方法依赖的package包/类
private void callback(IMxRuntimeRequest req, IMxRuntimeResponse resp) throws Exception {
	LOG.debug("Callback from OpenID provider, evaluating..");

	HttpServletRequest origreq = req.getHttpServletRequest();

	//verification request?
	if (origreq.getMethod().equals("HEAD")) {
		handleHeadRequest(resp);
	} else if (req.getHeader("Accept") != null && req.getHeader("Accept").contains("application/xrds+xml")) {
		handleXrds(resp);
	} else {
		ParameterList openidResp = new ParameterList(origreq.getParameterMap());

		String mxid2Continuation = req.getParameter("mxid2.continuation");
		detectContinuationJsInjection(mxid2Continuation);

		String mode = openidResp.getParameter("openid.mode").getValue();
		if ("setup_needed".equalsIgnoreCase(mode)) {
			/*
			 * original request mode is immediate, because checkid setup would not have returned id_res without verified ID. 
			 * Return to return url, but without identity.
			 * 
			 * @See http://openid.net/specs/openid-authentication-2_0.html#negative_assertions
			 */
			if (LOG.isDebugEnabled())
				LOG.debug("Immediate authentication responded with setup_needed. Assuming that the app should continue as anonymous. ");

			loginHandler.onCompleteAnonymousLogin(mxid2Continuation, req, resp);
		} else if ("id_res".equals(mode)) {
			handleIdRes(req, resp, origreq, openidResp, mxid2Continuation);
		} else if ("cancel".equals(mode)) {
			LOG.warn("OpenId login failed: cancelled");
			resp.setStatus(IMxRuntimeResponse.UNAUTHORIZED);
			error(resp, ResponseType.UNAUTHORIZED, "OpenId login failed. Please try again later.", null);
		} else
			throw new IllegalStateException("Unexpected OpenID callback mode: " + mode);
	}
}
 
开发者ID:mendix,项目名称:IBM-Watson-Connector-Suite,代码行数:39,代码来源:OpenIDHandler.java

示例3: handleIdRes

import com.mendix.m2ee.api.IMxRuntimeResponse; //导入方法依赖的package包/类
private void handleIdRes(IMxRuntimeRequest req, IMxRuntimeResponse resp, HttpServletRequest origreq,
						 ParameterList openidResp, String mxid2Continuation) throws Exception {
	// extract the receiving URL from the HTTP request
	StringBuffer receivingURL = new StringBuffer(OPENID_RETURN_URL);

	String queryString = origreq.getQueryString();
	if (queryString != null && queryString.length() > 0)
		receivingURL.append("?").append(origreq.getQueryString());

	// verify the response
	LOG.info("[OpenID Verify Response] receivingurl: " + receivingURL + "; to: " + openidResp.getParameter("openid.return_to"));
	VerificationResult verification = manager.verify(receivingURL.toString(), openidResp, discovered);

	// examine the verification result and extract the verified identifier
	Identifier verified = verification.getVerifiedId();

	if (verified != null) {
		String userId = verified.getIdentifier();
		lockOpenID(userId);
		try {
			loginHandler.onCompleteLogin(userId, mxid2Continuation, req, resp);
		} finally {
			unlockOpenID(userId);
		}
	} else {
		LOG.warn("OpenId authentication failed: " + verification.getStatusMsg());
		resp.setStatus(IMxRuntimeResponse.UNAUTHORIZED);
		error(resp, ResponseType.UNAUTHORIZED, "OpenId authentication request failed. Please try again later.", null);
	}
}
 
开发者ID:mendix,项目名称:IBM-Watson-Connector-Suite,代码行数:31,代码来源:OpenIDHandler.java

示例4: forceLogoff

import com.mendix.m2ee.api.IMxRuntimeResponse; //导入方法依赖的package包/类
private void forceLogoff(IMxRuntimeRequest req, IMxRuntimeResponse resp) {
	String username = req.getParameter("openid");
	String fingerprint = req.getParameter("fingerprint");

	if (SINGLESIGNOFF_ENABLED)
		forceSessionLogoff(username, fingerprint);
	else
		LOG.warn("Received force_logoff request, but single sign off is not unabled in the configuration!");

	resp.setStatus(IMxRuntimeResponse.OK);
	resp.setContentType("text/plain");
}
 
开发者ID:mendix,项目名称:IBM-Watson-Connector-Suite,代码行数:13,代码来源:OpenIDHandler.java

示例5: 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

示例6: error

import com.mendix.m2ee.api.IMxRuntimeResponse; //导入方法依赖的package包/类
public static void error(IMxRuntimeResponse resp, ResponseType responseType, String message, Throwable e) throws IOException {
	resp.setStatus(responseType.status);
	resp.getWriter().write(
			INTERNAL_SERVER_ERROR_MESSAGE
					.replace("{{message}}", StringEscapeUtils.escapeHtml(message))
					.replace("{{title}}", StringEscapeUtils.escapeHtml(responseType.title))
	);
	if (e != null)
		LOG.error("Error while handling OpenID request: " + responseType.title + ":\n" + message + ": " + e.getMessage(), e);
	else
		LOG.error("Error while handling OpenID request: " + responseType.title + ":\n" + message);
}
 
开发者ID:mendix,项目名称:IBM-Watson-Connector-Suite,代码行数:13,代码来源:OpenIDHandler.java

示例7: callback

import com.mendix.m2ee.api.IMxRuntimeResponse; //导入方法依赖的package包/类
private void callback(IMxRuntimeRequest req, IMxRuntimeResponse resp) throws Exception {
	log.debug("Callback from OpenID provider, evaluating..");

	HttpServletRequest origreq = req.getHttpServletRequest();

	//verification request?
	if (origreq.getMethod().equals("HEAD")) {
		handleHeadRequest(resp);
	} else if (req.getHeader("Accept") != null && req.getHeader("Accept").contains("application/xrds+xml")) {
		handleXrds(resp);
	} else {
		ParameterList openidResp = new ParameterList(origreq.getParameterMap());

		String mxid2Continuation = req.getParameter("mxid2.continuation");
		detectContinuationJsInjection(mxid2Continuation);

		String mode = openidResp.getParameter("openid.mode").getValue();
		if ("setup_needed".equalsIgnoreCase(mode)) {
			/*
			 * original request mode is immediate, because checkid setup would not have returned id_res without verified ID. 
			 * Return to return url, but without identity.
			 * 
			 * @See http://openid.net/specs/openid-authentication-2_0.html#negative_assertions
			 */
			if (log.isDebugEnabled())
				log.debug("Immediate authentication responded with setup_needed. Assuming that the app should continue as anonymous. ");

			loginHandler.onCompleteAnonymousLogin(mxid2Continuation, req, resp);
		} else if ("id_res".equals(mode)) {
			handleIdRes(req, resp, origreq, openidResp, mxid2Continuation);
		} else if ("cancel".equals(mode)) {
			log.warn("OpenId login failed: cancelled");
			resp.setStatus(IMxRuntimeResponse.UNAUTHORIZED);
			error(resp, ResponseType.UNAUTHORIZED, "OpenId login failed. Please try again later.", null);
		} else
			throw new IllegalStateException("Unexpected OpenID callback mode: " + mode);
	}
}
 
开发者ID:mendix,项目名称:EmailModuleWithTemplates,代码行数:39,代码来源:OpenIDHandler.java

示例8: handleIdRes

import com.mendix.m2ee.api.IMxRuntimeResponse; //导入方法依赖的package包/类
private void handleIdRes(IMxRuntimeRequest req, IMxRuntimeResponse resp, HttpServletRequest origreq,
						 ParameterList openidResp, String mxid2Continuation) throws Exception {
	// extract the receiving URL from the HTTP request
	StringBuffer receivingURL = new StringBuffer(OpenIDReturnURL);

	String queryString = origreq.getQueryString();
	if (queryString != null && queryString.length() > 0)
		receivingURL.append("?").append(origreq.getQueryString());

	// verify the response
	log.info("[OpenID Verify Response] receivingurl: " + receivingURL + "; to: " + openidResp.getParameter("openid.return_to"));
	VerificationResult verification = manager.verify(receivingURL.toString(), openidResp, discovered);

	// examine the verification result and extract the verified identifier
	Identifier verified = verification.getVerifiedId();

	if (verified != null) {
		String userId = verified.getIdentifier();
		lockOpenID(userId);
		try {
			loginHandler.onCompleteLogin(userId, mxid2Continuation, req, resp);
		} finally {
			unlockOpenID(userId);
		}
	} else {
		log.warn("OpenId authentication failed: " + verification.getStatusMsg());
		resp.setStatus(IMxRuntimeResponse.UNAUTHORIZED);
		error(resp, ResponseType.UNAUTHORIZED, "OpenId authentication request failed. Please try again later.", null);
	}
}
 
开发者ID:mendix,项目名称:EmailModuleWithTemplates,代码行数:31,代码来源:OpenIDHandler.java

示例9: forceLogoff

import com.mendix.m2ee.api.IMxRuntimeResponse; //导入方法依赖的package包/类
private void forceLogoff(IMxRuntimeRequest req, IMxRuntimeResponse resp) {
	String username = req.getParameter("openid");
	String fingerprint = req.getParameter("fingerprint");

	if (SINGLESIGNOFF_ENABLED)
		forceSessionLogoff(username, fingerprint);
	else
		log.warn("Received force_logoff request, but single sign off is not unabled in the configuration!");

	resp.setStatus(IMxRuntimeResponse.OK);
	resp.setContentType("text/plain");
}
 
开发者ID:mendix,项目名称:EmailModuleWithTemplates,代码行数:13,代码来源:OpenIDHandler.java

示例10: 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

示例11: error

import com.mendix.m2ee.api.IMxRuntimeResponse; //导入方法依赖的package包/类
public static void error(IMxRuntimeResponse resp, ResponseType responseType, String message, Throwable e) throws IOException {
	resp.setStatus(responseType.status);
	resp.getWriter().write(
			INTERNAL_SERVER_ERROR_MESSAGE
					.replace("{{message}}", StringEscapeUtils.escapeHtml(message))
					.replace("{{title}}", StringEscapeUtils.escapeHtml(responseType.title))
	);
	if (e != null)
		log.error("Error while handling OpenID request: " + responseType.title + ":\n" + message + ": " + e.getMessage(), e);
	else
		log.error("Error while handling OpenID request: " + responseType.title + ":\n" + message);
}
 
开发者ID:mendix,项目名称:EmailModuleWithTemplates,代码行数:13,代码来源:OpenIDHandler.java

示例12: handleHeadRequest

import com.mendix.m2ee.api.IMxRuntimeResponse; //导入方法依赖的package包/类
private void handleHeadRequest(IMxRuntimeResponse resp) {
	LOG.debug("Callback from OpenID provider, evaluating.. HEAD request not supported, ignoring.");
	resp.setStatus(HttpServletResponse.SC_METHOD_NOT_ALLOWED); //405 - Method Not Allowed
}
 
开发者ID:mendix,项目名称:IBM-Watson-Connector-Suite,代码行数:5,代码来源:OpenIDHandler.java

示例13: 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

示例14: handleHeadRequest

import com.mendix.m2ee.api.IMxRuntimeResponse; //导入方法依赖的package包/类
private void handleHeadRequest(IMxRuntimeResponse resp) {
	log.debug("Callback from OpenID provider, evaluating.. HEAD request not supported, ignoring.");
	resp.setStatus(HttpServletResponse.SC_METHOD_NOT_ALLOWED); //405 - Method Not Allowed
}
 
开发者ID:mendix,项目名称:EmailModuleWithTemplates,代码行数:5,代码来源:OpenIDHandler.java


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