Java Code Examples for org.apache.axis.MessageContext#getProperty()

The following examples show how to use org.apache.axis.MessageContext#getProperty() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AxisClientImpl.java    From tomee with Apache License 2.0 6 votes vote down vote up
/**
 *
 * @param context MessageContext
 * @return HandlerChain
 */
@Override
protected HandlerChain getJAXRPChandlerChain(MessageContext context) {
    QName portQName = (QName) context.getProperty(Call.WSDL_PORT_NAME);
    if (portQName == null) {
        return null;
    }
    String portName = portQName.getLocalPart();

    SeiFactory seiFactory = (SeiFactory) portNameToSEIFactoryMap.get(portName);
    if (seiFactory == null) {
        return null;
    }
    HandlerChain handlerChain = seiFactory.createHandlerChain();
    return handlerChain;
}
 
Example 2
Source File: AbstractSDKService.java    From Knowage-Server with GNU Affero General Public License v3.0 5 votes vote down vote up
protected IEngUserProfile getUserProfile() throws Exception {
	logger.debug("IN");
	IEngUserProfile profile = null;
	try {
		MessageContext mc = MessageContext.getCurrentContext();
		profile = (IEngUserProfile) mc.getProperty(IEngUserProfile.ENG_USER_PROFILE);
		if (profile == null) {
			logger.debug("User profile not found.");
			String userIdentifier = (String) mc.getProperty(WSHandlerConstants.USER);
			logger.debug("User identifier found = [" + userIdentifier + "].");
			if (userIdentifier == null) {
				logger.warn("User identifier not found!! cannot build user profile object");
				throw new Exception("Cannot create user profile");
			} else {
				try {
					profile = UserUtilities.getUserProfile(userIdentifier);
					logger.debug("User profile for userId [" + userIdentifier + "] created.");
				} catch (Exception e) {
					logger.error("Exception creating user profile for userId [" + userIdentifier + "]!", e);
					throw new Exception("Cannot create user profile");
				}
			}
			mc.setProperty(IEngUserProfile.ENG_USER_PROFILE, profile);
		} else {
			logger.debug("User profile for user [" + ((UserProfile) profile).getUserId() + "] retrieved.");
		}
		UserProfile userProfile = (UserProfile) profile;
		logger.info("User profile retrieved: userId = [" + userProfile.getUserId() + "]; username = [" + userProfile.getUserName() + "]");
	} finally {
		logger.debug("OUT");
	}
	return profile;
}
 
Example 3
Source File: HttpHandler.java    From googleads-java-lib with Apache License 2.0 5 votes vote down vote up
/** Sets HTTP request headers based on the Axis message context. */
private void setHttpRequestHeaders(MessageContext msgContext, HttpRequest httpRequest) {
  @SuppressWarnings("unchecked")
  Map<Object, Object> requestHeaders =
      (Map<Object, Object>) msgContext.getProperty(HTTPConstants.REQUEST_HEADERS);
  if (requestHeaders != null) {
    for (Entry<Object, Object> headerEntry : requestHeaders.entrySet()) {
      Object headerKey = headerEntry.getKey();
      if (headerKey == null) {
        continue;
      }
      String headerName = headerKey.toString().trim();
      Object headerValue = headerEntry.getValue();
      if (HTTPConstants.HEADER_AUTHORIZATION.equals(headerName)
          && (headerValue instanceof String)) {
        // HttpRequest expects the Authorization header to be a list of values,
        // so handle the case where it is simply a string.
        httpRequest.getHeaders().setAuthorization((String) headerValue);
      } else {
        httpRequest.getHeaders().set(headerName, headerValue);
      }
    }
  }
  if (msgContext.isPropertyTrue(HTTPConstants.MC_GZIP_REQUEST)) {
    httpRequest.getHeaders().setContentEncoding(HTTPConstants.COMPRESSION_GZIP);
  }
}
 
Example 4
Source File: cfcHandler.java    From openbd-core with GNU General Public License v3.0 3 votes vote down vote up
/**
 * Returns a new cfSession from the specified MessageContext.
 * 
 * @param msgContext
 *          MessageContext for the current request.
 * @return a new cfSession from the specified MessageContext
 */
private cfSession getSession(MessageContext msgContext) {
	HttpServletRequest req = (HttpServletRequest) msgContext.getProperty(HTTPConstants.MC_HTTP_SERVLETREQUEST);
	HttpServletResponse res = (HttpServletResponse) msgContext.getProperty(HTTPConstants.MC_HTTP_SERVLETRESPONSE);
	ServletContext ctxt = req.getSession(true).getServletContext();
	return new cfSession(req, res, ctxt);
}
 
Example 5
Source File: PojoProvider.java    From tomee with Apache License 2.0 2 votes vote down vote up
/**
 *
 * @param msgContext msgContext
 * @param service service
 * @param clsName clsName
 * @param scopeHolder scopeHolder
 * @return
 * @throws Exception
 */
@Override
public Object getServiceObject(MessageContext msgContext, Handler service, String clsName, IntHolder scopeHolder) throws Exception {
    HttpRequest request = (HttpRequest) msgContext.getProperty(AxisWsContainer.REQUEST);
    return request.getAttribute(WsConstants.POJO_INSTANCE);
}