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


Java ServiceContext.getProperty方法代码示例

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


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

示例1: login

import org.apache.axis2.context.ServiceContext; //导入方法依赖的package包/类
public String login(String userName, String password, String host)
        throws LoginAuthenticationExceptionException, RemoteException {
    Boolean loginStatus;
    ServiceContext serviceContext;
    String sessionCookie;
    loginStatus = authenticationAdminStub.login(userName, password, host);
    if (!loginStatus) {
        throw new LoginAuthenticationExceptionException("Login Unsuccessful. Return false as a login status by Server");
    }
    log.info("Login Successful");
    serviceContext = authenticationAdminStub._getServiceClient().getLastOperationContext().getServiceContext();
    sessionCookie = (String) serviceContext.getProperty(HTTPConstants.COOKIE_STRING);
    if (log.isDebugEnabled()) {
        log.debug("SessionCookie :" + sessionCookie);
    }
    return sessionCookie;
}
 
开发者ID:wso2,项目名称:carbon-platform-integration-utils,代码行数:18,代码来源:AuthenticatorClient.java

示例2: getTheImplementationObject

import org.apache.axis2.context.ServiceContext; //导入方法依赖的package包/类
/**
 * Retrieve the implementation object.  This will either return a cached
 * object if present in the ServiceContext, or create a new one via
 * makeNewServiceObject() (and then cache that).
 *
 * @param msgContext the active MessageContext
 * @return the appropriate back-end service object.
 * @throws AxisFault if there's a problem
 */
protected Object getTheImplementationObject(MessageContext msgContext) throws AxisFault {
    ServiceContext serviceContext = msgContext.getServiceContext();
    Object serviceimpl = serviceContext.getProperty(ServiceContext.SERVICE_OBJECT);
    if (serviceimpl != null) {
        // since service impl is there in service context , take that from there
        return serviceimpl;
    } else {
        // create a new service impl class for that service
        serviceimpl = makeNewServiceObject(msgContext);
        //Service initialization
        DependencyManager.initServiceObject(serviceimpl, msgContext.getServiceContext());
        serviceContext.setProperty(ServiceContext.SERVICE_OBJECT, serviceimpl);
        return serviceimpl;
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:25,代码来源:AbstractMessageReceiver.java

示例3: authenticate

import org.apache.axis2.context.ServiceContext; //导入方法依赖的package包/类
public boolean authenticate(String username, String password) throws AuthenticationExceptionException,
        RemoteException {
    try {
        boolean isAuthenticated = stub.login(username,password,NetworkUtils.getLocalHostname());
        if(isAuthenticated){
            ServiceContext serviceContext;
            serviceContext = stub._getServiceClient().getLastOperationContext().getServiceContext();
            String sessionCookie;
            sessionCookie = (String) serviceContext.getProperty(HTTPConstants.COOKIE_STRING);

            this.sessionCookie = sessionCookie;
        }else{
            throw new AuthenticationExceptionException("Authentication Failed");
        }
        return isAuthenticated;
    } catch (SocketException e) {
        throw new AuthenticationExceptionException(e);
    }
}
 
开发者ID:wso2,项目名称:carbon-commons,代码行数:20,代码来源:AuthenticationClient.java

示例4: destroy

import org.apache.axis2.context.ServiceContext; //导入方法依赖的package包/类
@Override
public void destroy(ServiceContext serviceContext) {
    if (log.isDebugEnabled()) {
        log.debug("Destroying rule session bound to transport session");
    }
    //get stored rule session
    RuleSession ruleSession = (RuleSession) serviceContext.getProperty(Constants.RULE_SESSION_OBJECT);

    //dispose it, if exists
    if (ruleSession != null) {
        try {
            ruleSession.destroy();
            serviceContext.removeProperty(Constants.RULE_SESSION_OBJECT);

        } catch (RuleRuntimeException e) {
            log.error("Error occurred while destroying rule session", e);
        }
    }
}
 
开发者ID:wso2,项目名称:carbon-rules,代码行数:20,代码来源:RuleSessionLifecycle.java

示例5: login

import org.apache.axis2.context.ServiceContext; //导入方法依赖的package包/类
public String login(String userName, String password, String host)
        throws LoginAuthenticationExceptionException, RemoteException {
    Boolean loginStatus;
    ServiceContext serviceContext;
    String sessionCookie;

    loginStatus = authenticationAdminStub.login(userName, password, host);

    if (!loginStatus) {
        throw new LoginAuthenticationExceptionException("Login Unsuccessful. Return false as a login status by Server");
    }
    log.info("Login Successful");
    serviceContext = authenticationAdminStub._getServiceClient().getLastOperationContext().getServiceContext();
    sessionCookie = (String) serviceContext.getProperty(HTTPConstants.COOKIE_STRING);
    if (log.isDebugEnabled()) {
        log.debug("SessionCookie :" + sessionCookie);
    }
    return sessionCookie;
}
 
开发者ID:wso2,项目名称:product-es,代码行数:20,代码来源:AuthenticatorClient.java

示例6: authenticate

import org.apache.axis2.context.ServiceContext; //导入方法依赖的package包/类
public String authenticate(String userName, String password) throws RemoteException, LoginAuthenticationExceptionException {
    String sessionCookie = null;
    if (authenticationAdminStub.login(userName, password, "localhost")) {
        System.out.println("登录成功");
        ServiceContext serviceContext = authenticationAdminStub._getServiceClient().getLastOperationContext().getServiceContext();
        sessionCookie = (String) serviceContext.getProperty(HTTPConstants.COOKIE_STRING);
        System.out.println(sessionCookie);
    }
    return sessionCookie;
}
 
开发者ID:DistX,项目名称:Learning,代码行数:11,代码来源:LoginAdminServiceClient.java

示例7: authenticate

import org.apache.axis2.context.ServiceContext; //导入方法依赖的package包/类
protected void authenticate() throws WSO2AdminServicesException
{
    if (sessionCookie == null)
    {
        try
        {
            if (wso2username != null && wso2username.length() >= 0 && wso2password != null)
            {
                getLogger().info(
                    "Authenticate on " + getUrl() + " with '" + wso2username + "'",
                    getClass().getSimpleName());
                AuthenticationAdminStub authenticationStub =
                    new AuthenticationAdminStub(new URL(getUrl()
                        + SERVICES_AUTHENTICATION_ADMIN).toString());
                prepareStubInternal(authenticationStub);
                if (authenticationStub.login(wso2username, wso2password, url.getHost()))
                {
                    ServiceContext serviceContext =
                        authenticationStub._getServiceClient().getLastOperationContext()
                            .getServiceContext();
                    sessionCookie =
                        (String) serviceContext.getProperty(HTTPConstants.COOKIE_STRING);
                    getLogger()
                        .info("Authentication successful.", getClass().getSimpleName());
                }
                else
                {
                    throw new WSO2AdminServicesException("error authenticating user "
                        + wso2username);
                }
            }
        }
        catch (Exception e)
        {
            throw new WSO2AdminServicesException("exception authenticating user "
                + wso2username, e);
        }
    }
}
 
开发者ID:hschott,项目名称:cargo-wso2-container,代码行数:40,代码来源:AbstractWSO2Carbon4xRemoteService.java

示例8: createSessionCookie

import org.apache.axis2.context.ServiceContext; //导入方法依赖的package包/类
private String createSessionCookie(String serverURL, String username, String pwd) throws Exception{
	AuthenticationAdminStub authenticationStub;
	URL url = new URL(serverURL);
	authenticationStub = new AuthenticationAdminStub(serverURL+ "/services/AuthenticationAdmin");
	authenticationStub._getServiceClient().getOptions().setManageSession(true);
	if (authenticationStub.login(username, pwd, url.getHost())){
		ServiceContext serviceContext = authenticationStub._getServiceClient().getLastOperationContext().getServiceContext();
		String sessionCookie = (String) serviceContext.getProperty(HTTPConstants.COOKIE_STRING);
		getLog().info("Authentication to "+serverURL+" successful.");
		return sessionCookie;
	}else{
		return null;
	}
}
 
开发者ID:wso2,项目名称:maven-tools,代码行数:15,代码来源:DeployCarMojo.java

示例9: getSOAPMessageContext

import org.apache.axis2.context.ServiceContext; //导入方法依赖的package包/类
private static SOAPMessageContext getSOAPMessageContext(MessageContext jaxwsMessageContext) {
    org.apache.axis2.context.MessageContext msgContext =
        jaxwsMessageContext.getAxisMessageContext();
    ServiceContext serviceContext = msgContext.getServiceContext();
    SOAPMessageContext soapMessageContext = null;
    if (serviceContext != null) {
        WebServiceContext wsc =
            (WebServiceContext)serviceContext.getProperty(EndpointLifecycleManagerImpl.WEBSERVICE_MESSAGE_CONTEXT);
        if (wsc != null) {
            soapMessageContext = (SOAPMessageContext)wsc.getMessageContext();
        }
    }
    return soapMessageContext;
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:15,代码来源:ContextUtils.java

示例10: retrieveServiceInstance

import org.apache.axis2.context.ServiceContext; //导入方法依赖的package包/类
/**
 * This method locates an existing service implementation instance if
 * one has been previously stored away.
 */
protected Object retrieveServiceInstance(MessageContext mc) {
    Object instance = null;
    ServiceContext serviceContext = mc.getAxisMessageContext().getServiceContext();
    instance = serviceContext.getProperty(ServiceContext.SERVICE_OBJECT);
    return instance;
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:11,代码来源:EndpointLifecycleManagerImpl.java

示例11: getSessionObject

import org.apache.axis2.context.ServiceContext; //导入方法依赖的package包/类
public static Object getSessionObject(String name) {
    MessageContext messageContext = MessageContext.getCurrentMessageContext();
    if (messageContext != null) {
        ServiceContext serviceContext = messageContext.getServiceContext();
        if (serviceContext != null) {
            return serviceContext.getProperty(name);
        }
    }
    return null;
}
 
开发者ID:wso2,项目名称:carbon-commons,代码行数:11,代码来源:LoggingSessionManager.java

示例12: getSessionObject

import org.apache.axis2.context.ServiceContext; //导入方法依赖的package包/类
/**
 * Returns an object stored in the session with the given name.
 */
private static Object getSessionObject(String name) {
	MessageContext messageContext = MessageContext.getCurrentMessageContext();
	if (messageContext != null) {
		ServiceContext serviceContext = messageContext.getServiceContext();
		if (serviceContext != null) {
			return serviceContext.getProperty(name);
		}			
	} else {
		return threadLocalSession.get().get(name);
	}
	return null;
}
 
开发者ID:wso2,项目名称:carbon-data,代码行数:16,代码来源:DSSessionManager.java

示例13: init

import org.apache.axis2.context.ServiceContext; //导入方法依赖的package包/类
public void init(ServiceContext serviceContext) {
    System.out.println("Initializing the service context for service "
            + serviceContext.getAxisService().getName());
    // initialize the count to zero
    if (serviceContext.getProperty(COUNT) == null){
        serviceContext.setProperty(COUNT, new TestPOJO());
    }
    
}
 
开发者ID:syodage,项目名称:Axis2-Samples,代码行数:10,代码来源:SessionService.java

示例14: getCount

import org.apache.axis2.context.ServiceContext; //导入方法依赖的package包/类
public int getCount() {
    ServiceContext serviceContext =
            MessageContext.getCurrentMessageContext().getServiceContext();
    TestPOJO storedVaue = (TestPOJO) serviceContext.getProperty(COUNT);
    System.out.println(" ------------- curent value " + storedVaue.getNumber() + " ------------------ ");
    storedVaue.incrementNumber();
    return storedVaue.getNumber();
}
 
开发者ID:syodage,项目名称:Axis2-Samples,代码行数:9,代码来源:SessionService.java

示例15: doPost

import org.apache.axis2.context.ServiceContext; //导入方法依赖的package包/类
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    String userName = null, userPassword = null;
    ServletContext servletContext = this.getServletContext();
    String backendServerURL = servletContext.getInitParameter(HumanTaskSampleConstants.BACKEND_SERVER_URL);

    // set the required system properties
    System.setProperty("javax.net.ssl.trustStore", servletContext
            .getInitParameter(HumanTaskSampleConstants.CLIENT_TRUST_STORE_PATH).trim());
    System.setProperty("javax.net.ssl.trustStorePassword", servletContext
            .getInitParameter(HumanTaskSampleConstants.CLIENT_TRUST_STORE_PASSWORD).trim());
    System.setProperty("javax.net.ssl.trustStoreType", servletContext
            .getInitParameter(HumanTaskSampleConstants.CLIENT_TRUST_STORE_TYPE).trim());
    try {
        AuthenticationAdminStub authenticationAdminStub = new AuthenticationAdminStub(backendServerURL +
                                                                                      HumanTaskSampleConstants
                                                                                              .SERVICE_URL +
                                                                                      HumanTaskSampleConstants
                                                                                              .AUTHENTICATION_ADMIN_SERVICE_URL);
        // handles logout
        String logout = req.getParameter("logout");
        if (logout != null) {
            authenticationAdminStub.logout();
            req.getRequestDispatcher("/Login.jsp").forward(req, resp);
            return;
        }
        if (req.getParameter("userName") != null) {
            userName = req.getParameter("userName").trim();
        }
        if (req.getParameter("userPassword") != null) {
            userPassword = req.getParameter("userPassword").trim();
        }
        // login to server with given user name and password
        if (authenticationAdminStub.login(userName, userPassword, HumanTaskSampleConstants.HOSTNAME)) {
            ServiceContext serviceContext = authenticationAdminStub._getServiceClient().getLastOperationContext()
                    .getServiceContext();
            String sessionCookie = (String) serviceContext.getProperty(HTTPConstants.COOKIE_STRING);
            HttpSession session = req.getSession();
            session.setAttribute(HumanTaskSampleConstants.USERNAME, userName);
            session.setAttribute(HumanTaskSampleConstants.SESSION_COOKIE, sessionCookie);
            req.getRequestDispatcher("/Home.jsp?queryType=assignedToMe&pageNumber=0").forward(req, resp);

        } else {
            log.warn(userName + " login failed.");
            req.setAttribute("message", "Please enter a valid user name and a password.");
            req.getRequestDispatcher("/Login.jsp").forward(req, resp);
        }

    } catch (Exception e) {
        log.error("Failed to retrieve the user session ", e);
        req.setAttribute(HumanTaskSampleConstants.MESSAGE, e);
        req.getRequestDispatcher("/Login.jsp").forward(req, resp);
    }

}
 
开发者ID:wso2,项目名称:product-ei,代码行数:55,代码来源:LoginManager.java


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