• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java IMxRuntimeRequest类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



IMxRuntimeRequest类属于com.mendix.m2ee.api包,在下文中一共展示了IMxRuntimeRequest类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getFingerPrint

import com.mendix.m2ee.api.IMxRuntimeRequest; //导入依赖的package包/类
public static String getFingerPrint(IMxRuntimeRequest req)
{
	String agent = req.getHeader("User-Agent");
	if (agent != null)
		return base64Encode(agent.getBytes());
	
	return "";
}
 
开发者ID:mendix,项目名称:IBM-Watson-Connector-Suite,代码行数:9,代码来源:OpenIDUtils.java


示例2: onCompleteAnonymousLogin

import com.mendix.m2ee.api.IMxRuntimeRequest; //导入依赖的package包/类
public void onCompleteAnonymousLogin(String continuation, IMxRuntimeRequest req, IMxRuntimeResponse resp)
		throws CoreException, IllegalStateException, IOException
{
	try {
		/** Setting up guest sessions is not the responsibility of this module, but otherwise:
			if (Core.getConfiguration().getEnableGuestLogin()) {
				ISession session = Core.initializeGuestSession();
				SessionInitializer.writeSessionCookies(resp, session);
			}
		*/
		SessionInitializer.redirectToIndex(resp, continuation);
	} catch (Exception e) {
		OpenIDHandler.error(resp, ResponseType.INTERNAL_SERVER_ERROR, "Failed to initialize session", e);
	}
}
 
开发者ID:mendix,项目名称:IBM-Watson-Connector-Suite,代码行数:16,代码来源:DefaultLoginHandler.java


示例3: callback

import com.mendix.m2ee.api.IMxRuntimeRequest; //导入依赖的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


示例4: handleIdRes

import com.mendix.m2ee.api.IMxRuntimeRequest; //导入依赖的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


示例5: login

import com.mendix.m2ee.api.IMxRuntimeRequest; //导入依赖的package包/类
private void login(IMxRuntimeRequest req, IMxRuntimeResponse resp) throws Exception {
	String continuation = req.getParameter(CONTINUATION_PARAM);
	detectContinuationJsInjection(continuation);

	//special case 1: already a valid session, do not bother with a new login
	ISession session = this.getSessionFromRequest(req);
	if (session != null && !session.getUser().isAnonymous()) {

		//Logout old session and initialize new session. This will allow for role changes to take effect.
		String userId = session.getUser().getName();
		lockOpenID(userId);
		try {
			loginHandler.onCompleteLogin(userId, continuation, req, resp);
			Core.logout(session);
		} finally {
			unlockOpenID(userId);
		}
	} else if (!started) {
		//special case 2: no OpenID provider discovered
		LOG.warn("OpenId handler is in state 'NOT STARTED'. Falling back to default login.html");
		redirect(resp, FALLBACK_LOGINPAGE);
	} else {
		LOG.debug("Incoming login request, redirecting to OpenID provider");

		AuthRequest authReq = manager.authenticate(discovered, OPENID_RETURN_URL);
		authReq.setImmediate("true".equalsIgnoreCase(req.getParameter(IMMEDIATE_PARAM)));

		String url = authReq.getDestinationUrl(true);

		//MWE: publish the url which can be used to sign off
		if (SINGLESIGNOFF_ENABLED)
			url += "&mxid2.logoffcallback=" +  OpenIDUtils.urlEncode(OPENID_LOGOFF_URL);

		if (continuation != null)
			url += "&mxid2.continuation=" +  OpenIDUtils.urlEncode(continuation);

		redirect(resp, url);
	}
}
 
开发者ID:mendix,项目名称:IBM-Watson-Connector-Suite,代码行数:40,代码来源:OpenIDHandler.java


示例6: forceLogoff

import com.mendix.m2ee.api.IMxRuntimeRequest; //导入依赖的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


示例7: logoff

import com.mendix.m2ee.api.IMxRuntimeRequest; //导入依赖的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


示例8: callback

import com.mendix.m2ee.api.IMxRuntimeRequest; //导入依赖的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


示例9: handleIdRes

import com.mendix.m2ee.api.IMxRuntimeRequest; //导入依赖的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


示例10: login

import com.mendix.m2ee.api.IMxRuntimeRequest; //导入依赖的package包/类
private void login(IMxRuntimeRequest req, IMxRuntimeResponse resp) throws Exception {
	String continuation = req.getParameter(CONTINUATION_PARAM);
	detectContinuationJsInjection(continuation);

	//special case 1: already a valid session, do not bother with a new login
	ISession session = this.getSessionFromRequest(req);
	if (session != null && !session.getUser().isAnonymous()) {

		//Logout old session and initialize new session. This will allow for role changes to take effect.
		String userId = session.getUser().getName();
		lockOpenID(userId);
		try {
			loginHandler.onCompleteLogin(userId, continuation, req, resp);
			Core.logout(session);
		} finally {
			unlockOpenID(userId);
		}
	} else if (!started) {
		//special case 2: no OpenID provider discovered
		log.warn("OpenId handler is in state 'NOT STARTED'. Falling back to default login.html");
		redirect(resp, FALLBACK_LOGINPAGE);
	} else {
		log.debug("Incoming login request, redirecting to OpenID provider");

		AuthRequest authReq = manager.authenticate(discovered, OpenIDReturnURL);
		authReq.setImmediate("true".equalsIgnoreCase(req.getParameter(IMMEDIATE_PARAM)));

		String url = authReq.getDestinationUrl(true);

		//MWE: publish the url which can be used to sign off
		if (SINGLESIGNOFF_ENABLED)
			url += "&mxid2.logoffcallback=" +  OpenIDUtils.urlEncode(OpenIDLogoffURL);

		if (continuation != null)
			url += "&mxid2.continuation=" +  OpenIDUtils.urlEncode(continuation);

		redirect(resp, url);
	}
}
 
开发者ID:mendix,项目名称:EmailModuleWithTemplates,代码行数:40,代码来源:OpenIDHandler.java


示例11: forceLogoff

import com.mendix.m2ee.api.IMxRuntimeRequest; //导入依赖的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


示例12: logoff

import com.mendix.m2ee.api.IMxRuntimeRequest; //导入依赖的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


示例13: processRequest

import com.mendix.m2ee.api.IMxRuntimeRequest; //导入依赖的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


示例14: createSessionForUser

import com.mendix.m2ee.api.IMxRuntimeRequest; //导入依赖的package包/类
/**
 * Given a username, starts a new session for the user and redirects back to index.html. 
 * If no matching account is found for the user, a new account will be created automatically. 
 * @param resp
 * @param req
 * @param user
 * @return 
 * @throws CoreException
 * @throws IOException 
 * @throws NoSuchMethodException 
 * @throws SecurityException 
 */
static public ISession createSessionForUser(IMxRuntimeResponse resp,
		IMxRuntimeRequest req, IUser user) throws Exception {
	
	LOG.info("User " + user.getName() + " authenticated. Starting session..");
	
	String sessionid = req.getCookie(XAS_SESSION_ID);

	ISession session = Core.initializeSession(user, sessionid);
	
	// Used to enable Single Sign Off request (from remote sso *server*); must only sign off user in a particular User Agent / Browser
	String ua = req.getHeader("User-Agent");
	session.setUserAgent(ua);
	
	if (LOG.isDebugEnabled())
		LOG.debug("Created session, fingerprint: " + OpenIDUtils.getFingerPrint(session));
	
	writeSessionCookies(resp, session);
	
	return session;
}
 
开发者ID:mendix,项目名称:IBM-Watson-Connector-Suite,代码行数:33,代码来源:SessionInitializer.java


示例15: login

import com.mendix.m2ee.api.IMxRuntimeRequest; //导入依赖的package包/类
@Deprecated
public static ISession login(String userName, String password, @SuppressWarnings("unused") String locale, IMxRuntimeRequest request) throws CoreException
{
	return Core.login(userName, password, request);
}
 
开发者ID:Finaps,项目名称:BootstrapCarousel,代码行数:6,代码来源:Core.java


示例16: login

import com.mendix.m2ee.api.IMxRuntimeRequest; //导入依赖的package包/类
public static ISession login(String userName, String password, IMxRuntimeRequest request) throws CoreException
{
	return component.core().login(userName, password, request);
}
 
开发者ID:mrgroen,项目名称:qzIndustryPrinting,代码行数:5,代码来源:Core.java


示例17: processRequest

import com.mendix.m2ee.api.IMxRuntimeRequest; //导入依赖的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


示例18: createSessionForUser

import com.mendix.m2ee.api.IMxRuntimeRequest; //导入依赖的package包/类
/**
 * Given a username, starts a new session for the user and redirects back to index.html. 
 * If no matching account is found for the user, a new account will be created automatically. 
 * @param resp
 * @param req
 * @param username
 * @return 
 * @throws CoreException
 * @throws IOException 
 * @throws NoSuchMethodException 
 * @throws SecurityException 
 */
static public ISession createSessionForUser(IMxRuntimeResponse resp,
		IMxRuntimeRequest req, IUser user) throws Exception {
	
	log.info("User " + user.getName() + " authenticated. Starting session..");
	
	String sessionid = req.getCookie(Core.getConfiguration().getSessionIdCookieName());

	ISession session = Core.initializeSession(user, sessionid);
	
	// Used to enable Single Sign Off request (from remote sso *server*); must only sign off user in a particular User Agent / Browser
	String ua = req.getHeader("User-Agent");
	session.setUserAgent(ua);
	
	if (log.isDebugEnabled())
		log.debug("Created session, fingerprint: " + OpenIDUtils.getFingerPrint(session));
	
	writeSessionCookies(resp, session);
	
	return session;
}
 
开发者ID:mendix,项目名称:EmailModuleWithTemplates,代码行数:33,代码来源:SessionInitializer.java


示例19: processRequest

import com.mendix.m2ee.api.IMxRuntimeRequest; //导入依赖的package包/类
@Override
public void processRequest(IMxRuntimeRequest req, IMxRuntimeResponse resp,
		String var3) {

	long start = System.currentTimeMillis();
	
	HttpServletRequest request = req.getHttpServletRequest();
	HttpServletResponse response = resp.getHttpServletResponse();

	String method = request.getMethod();
	URL u;
	try {
		u = new URL(request.getRequestURL().toString());
	} catch (MalformedURLException e1) {
		throw new IllegalStateException(e1);
	}

	String relpath = u.getPath().substring(RestServices.PATH_REST.length() + 1);
	String requestStr =  method + " " + relpath;

	response.setCharacterEncoding(RestServices.UTF8);
	response.setHeader("Expires", "-1");

	if (RestServices.LOGPUBLISH.isDebugEnabled())
		RestServices.LOGPUBLISH.debug("incoming request: " + Utils.getRequestUrl(request));

	RestServiceRequest rsr = new RestServiceRequest(request, response, resp, relpath);
	try {
		ISession existingSession = getSessionFromRequest(req);
		
		executeHandler(rsr, method, relpath, existingSession);
		
		if (RestServices.LOGPUBLISH.isDebugEnabled())
				RestServices.LOGPUBLISH.debug("Served " + requestStr + " in " + (System.currentTimeMillis() - start) + "ms.");
	}
	catch(RestPublishException rre) {
		handleRestPublishException(requestStr, rsr, rre);
	}
	catch(JSONException je) {
		handleJsonException(requestStr, rsr, je);
	}
	catch(Throwable e) {
		Throwable cause = ExceptionUtils.getRootCause(e);
		if (cause instanceof RestPublishException)
			handleRestPublishException(requestStr, rsr, (RestPublishException) cause);
		else if (cause instanceof JSONException)
			handleJsonException(requestStr, rsr, (JSONException) cause);
		if (cause instanceof CustomRestServiceException) {
			CustomRestServiceException rse = (CustomRestServiceException) cause;
			RestServices.LOGPUBLISH.warn(String.format("Failed to serve %s: %d (code: %s): %s", requestStr, rse.getHttpStatus(), rse.getDetail(), rse.getMessage()));
			serveErrorPage(rsr, rse.getHttpStatus(), rse.getMessage(), rse.getDetail());
		}
		else if (cause instanceof WebserviceException) {
			RestServices.LOGPUBLISH.warn("Invalid request " + requestStr + ": " +cause.getMessage());
			serveErrorPage(rsr, HttpStatus.SC_BAD_REQUEST, cause.getMessage(), ((WebserviceException) cause).getFaultCode());
		}
		else {
			RestServices.LOGPUBLISH.error("Failed to serve " + requestStr + ": " +e.getMessage(), e);
			serveErrorPage(rsr, HttpStatus.SC_INTERNAL_SERVER_ERROR, "Failed to serve: " + requestStr + ": An internal server error occurred. Please check the application logs or contact a system administrator.", null);
		}
	}
	finally {
		rsr.dispose();
	}
}
 
开发者ID:mendix,项目名称:RestServices,代码行数:66,代码来源:RestServiceHandler.java


示例20: onCompleteLogin

import com.mendix.m2ee.api.IMxRuntimeRequest; //导入依赖的package包/类
public void onCompleteLogin(String openId, String continuation, IMxRuntimeRequest req, IMxRuntimeResponse resp) throws Exception; 
开发者ID:mendix,项目名称:IBM-Watson-Connector-Suite,代码行数:2,代码来源:ILoginHandler.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ParameterEntry类代码示例发布时间:2022-05-22
下一篇:
Java DefaultDrmSessionManager类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap