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


Java Message.get方法代码示例

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


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

示例1: sendErrorResponse

import org.apache.cxf.message.Message; //导入方法依赖的package包/类
private void sendErrorResponse(Message message, int responseCode) {
    Message outMessage = getOutMessage(message);
    outMessage.put(Message.RESPONSE_CODE, responseCode);
    
    // Set the response headers
    Map<String, List<String>> responseHeaders =
        (Map<String, List<String>>)message.get(Message.PROTOCOL_HEADERS);
    if (responseHeaders != null) {
        responseHeaders.put("WWW-Authenticate", Arrays.asList(new String[]{"Basic realm=realm"}));
        responseHeaders.put("Content-length", Arrays.asList(new String[]{"0"}));
    }
    message.getInterceptorChain().abort();
    try {
        getConduit(message).prepare(outMessage);
        close(outMessage);
    } catch (IOException e) {
    	log.error(e.getMessage()+"  "+ e.getCause());
    }
}
 
开发者ID:GovernIB,项目名称:sistra,代码行数:20,代码来源:BasicAuthAuthorizationInterceptor.java

示例2: handleMessage

import org.apache.cxf.message.Message; //导入方法依赖的package包/类
/**
 * Handles the {@link Connection} in the given {@link Message}.
 * @see DBConnectionResponseInterceptor
 */
@Override
public void handleMessage(final Message message) throws Fault {
	final Connection con = (Connection) message.getExchange().getInMessage().getContextualProperty(
			DBConnectionContextProvider.PROPERTY_CONNECTION);

	if(con != null) {
		try {
			final int responseCode = (int) message.get(Message.RESPONSE_CODE);

			if(Family.familyOf(responseCode).equals(Family.SERVER_ERROR)) {
				con.rollback();
			}
			else {
				con.commit();
			}

			con.close();
		}
		catch(final SQLException e) {
			LOGGER.error("Can't commit/rollback/close db connection because of an SQLException.", e);
		}
	}
}
 
开发者ID:XMBomb,项目名称:InComb,代码行数:28,代码来源:DBConnectionResponseInterceptor.java

示例3: handleMessage

import org.apache.cxf.message.Message; //导入方法依赖的package包/类
@SuppressWarnings({"unchecked", "rawtypes"})
public void handleMessage(Message message)
    throws Fault
{
    
    OperationInfo operation = message.get(MessageInfo.class).getOperation();
    
    String inputName = operation.getInputName();
    
    if (!"getPublicKey".equals(inputName))
    {
        List session = MsgSessionHolder.getInstance().getSession();
        if (session != null && !session.isEmpty())
        {
            Map headers = (Map)message.get(Message.PROTOCOL_HEADERS);
            headers.put("Cookie", session);
        }
    }
}
 
开发者ID:Huawei,项目名称:eSDK_IVS_Java,代码行数:20,代码来源:MsgOutInterceptor.java

示例4: determineContentType

import org.apache.cxf.message.Message; //导入方法依赖的package包/类
private static String determineContentType(Message message) {
    String ct  = (String)message.get(Message.CONTENT_TYPE);
    String enc = (String)message.get(Message.ENCODING);

    if (null != ct) {
        if (enc != null 
            && ct.indexOf("charset=") == -1
            && !ct.toLowerCase().contains("multipart/related")) {
            ct = ct + "; charset=" + enc;
        }
    } else if (enc != null) {
        ct = "text/xml; charset=" + enc;
    } else {
        ct = "text/xml";
    }
    // update the content_type value in the message
    message.put(Message.CONTENT_TYPE, ct);
    return ct;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:20,代码来源:CxfHeaderHelper.java

示例5: handleMessage

import org.apache.cxf.message.Message; //导入方法依赖的package包/类
@SuppressWarnings("rawtypes")
public void handleMessage(Message message)
    throws Fault
{
   
    OperationInfo operation = message.get(MessageInfo.class).getOperation();
    
    String inputName = operation.getInputName();
    
    if("login".equals(inputName) || "getPublicKey".equals(inputName))
    {
        Map headers = (Map)message.get(Message.PROTOCOL_HEADERS);
        List msgSession = (List)headers.get("Set-Cookie");
        if(msgSession != null && !msgSession.isEmpty())
        {
            MsgSessionHolder.getInstance().setSession(msgSession);
        }
    }
}
 
开发者ID:Huawei,项目名称:eSDK_IVS_Java,代码行数:20,代码来源:MsgInInterceptor.java

示例6: createOutputStream

import org.apache.cxf.message.Message; //导入方法依赖的package包/类
protected OutputStream createOutputStream(Message message, 
                                          boolean needToCacheRequest, 
                                          boolean isChunking,
                                          int chunkThreshold) throws IOException {
    HttpURLConnection connection = (HttpURLConnection)message.get(KEY_HTTP_CONNECTION);
    
    if (isChunking && chunkThreshold <= 0) {
        chunkThreshold = 0;
        connection.setChunkedStreamingMode(-1);                    
    }
    try {
        return new URLConnectionWrappedOutputStream(message, connection,
                                       needToCacheRequest, 
                                       isChunking,
                                       chunkThreshold,
                                       getConduitName());
    } catch (URISyntaxException e) {
        throw new IOException(e);
    }
}
 
开发者ID:Huawei,项目名称:eSDK_EC_SDK_Java,代码行数:21,代码来源:URLConnectionHTTPConduit.java

示例7: writeToOutputStream

import org.apache.cxf.message.Message; //导入方法依赖的package包/类
protected boolean writeToOutputStream(Message m, BindingInfo info, Service s) {
    /**
     * Yes, all this code is EXTREMELY ugly. But it gives about a 60-70% performance
     * boost with the JAXB RI, so its worth it. 
     */
    
    if (s == null) {
        return false;
    }
    
    String enc = (String)m.get(Message.ENCODING);
    return info.getClass().getName().equals("org.apache.cxf.binding.soap.model.SoapBindingInfo") 
        && s.getDataBinding().getClass().getName().equals("org.apache.cxf.jaxb.JAXBDataBinding")
        && !MessageUtils.isDOMPresent(m)
        && (enc == null || "UTF-8".equals(enc));
}
 
开发者ID:Huawei,项目名称:eSDK_IVS_Java,代码行数:17,代码来源:AbstractOutDatabindingInterceptor.java

示例8: handleMessage

import org.apache.cxf.message.Message; //导入方法依赖的package包/类
@SuppressWarnings( {"unchecked", "rawtypes"} )
@Override
public void handleMessage( Message message ) throws Fault
{
    System.out.println( message );
    Map<String, List> headers = (Map<String, List>)message
            .get( Message.PROTOCOL_HEADERS );
    String token = "hrsj MCC ";
    String base64Token = Base64.encodeBase64String( token.getBytes() );

    headers.put( "Authorization",
            Collections.singletonList( "Base 64 " + base64Token ) );
}
 
开发者ID:guanhaobi,项目名称:DataStage,代码行数:14,代码来源:RestSecurityInterceptor.java

示例9: get

import org.apache.cxf.message.Message; //导入方法依赖的package包/类
@Override
public OIN get() {
    final Message message = PhaseInterceptorChain.getCurrentMessage();
    final HttpServletRequest httpRequest = (HttpServletRequest) message.get(AbstractHTTPDestination.HTTP_REQUEST);
    final String oinWaardeOndertekenaar = httpRequest.getHeader(OIN.OIN_ONDERTEKENAAR);
    final String oinWaardeTransporteur = httpRequest.getHeader(OIN.OIN_TRANSPORTEUR);
    return new OIN(oinWaardeOndertekenaar, oinWaardeTransporteur);
}
 
开发者ID:MinBZK,项目名称:OperatieBRP,代码行数:9,代码来源:OinResolverImpl.java

示例10: vulBerichtAanMetOinGegevensUitHttpHeader

import org.apache.cxf.message.Message; //导入方法依赖的package包/类
/**
 * Vult het bericht aan met authenticatie informatie.
 *
 * @param message                  oorspronkelijke (niet geparste) bericht
 * @param bijhoudingVerzoekBericht het bericht
 * @return het aangevulde bericht
 */
public BijhoudingVerzoekBericht vulBerichtAanMetOinGegevensUitHttpHeader(
        final Message message,
        final BijhoudingVerzoekBericht bijhoudingVerzoekBericht) {
    final HttpServletRequest httpRequest = (HttpServletRequest) message.get(AbstractHTTPDestination.HTTP_REQUEST);
    bijhoudingVerzoekBericht.setOinWaardeOndertekenaar(httpRequest.getHeader(OIN_ONDERTEKENAAR));
    bijhoudingVerzoekBericht.setOinWaardeTransporteur(httpRequest.getHeader(OIN_TRANSPORTEUR));
    return bijhoudingVerzoekBericht;
}
 
开发者ID:MinBZK,项目名称:OperatieBRP,代码行数:16,代码来源:BerichtAuthenticatieInfoService.java

示例11: handleMessage

import org.apache.cxf.message.Message; //导入方法依赖的package包/类
/**
 * Gets basic authentication information from request and validates key
 * throws an error if key is invalid.
 *
 * @param message http message
 */
public void handleMessage(Message message) {

 try {   
 	//only authenticate if you are trying to write to the db... 
 	HttpServletRequest req = (HttpServletRequest) message.get("HTTP.REQUEST");
 	String method = req.getMethod();
 	
 	if (method!=HttpMethod.GET && method!=HttpMethod.OPTIONS && method!=HttpMethod.HEAD){
	 
  	AuthorizationPolicy policy = apiUserService.getCurrentAuthPolicy();
  	String accessKey = policy.getUserName();
  	String secret = policy.getPassword();
  
if (accessKey==null || accessKey.length()==0
		|| secret==null || secret.length()==0)	{
   	throw new RMapApiException(ErrorCode.ER_NO_USER_TOKEN_PROVIDED);
}		
			
apiUserService.validateKey(accessKey, secret);
 	}
 	
 } catch (RMapApiException ex){ 
 	//generate a response to intercept default message
 	Response response = exceptionHandler.toResponse(ex);
 	message.getExchange().put(Response.class, response);   	
 }
		
}
 
开发者ID:rmap-project,项目名称:rmap,代码行数:35,代码来源:AuthenticationInterceptor.java

示例12: create

import org.apache.cxf.message.Message; //导入方法依赖的package包/类
@Override
public CallbackHandler create(Message message) {
    TLSSessionInfo tlsSession = message.get(TLSSessionInfo.class);
    if (tlsSession == null) {
        return null;
    }
    Certificate cert = getCertificate(message);
    String name = certMapper.getUserName(cert);
    return new UsernamePasswordHandler(name, cert);
}
 
开发者ID:wildfly-extras,项目名称:wildfly-camel-examples,代码行数:11,代码来源:JBossCallbackHandlerTlsCert.java

示例13: handleMessage

import org.apache.cxf.message.Message; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public void handleMessage(Message message)
    throws Fault
{
    // 在header中添加set-cookie属性
    // Set-Cookie=[ASP.NET_SessionId=ib1iynjzjjosqkkb3rcbnz54; path=/;HttpOnly],
    List<String> session = MsgSessionHolder.getInstance().getSession();
    if (null != session && !session.isEmpty())
    {
        Map<String, List<String>> headers = (Map<String, List<String>>)message.get(Message.PROTOCOL_HEADERS);
        headers.put("Cookie", session);
    }
}
 
开发者ID:Huawei,项目名称:eSDK_IVS_Java,代码行数:14,代码来源:MsgOutInterceptor.java

示例14: getChargeBoxId

import org.apache.cxf.message.Message; //导入方法依赖的package包/类
private String getChargeBoxId(Message message) {
    MessageContentsList lst = MessageContentsList.getContentsList(message);
    if (lst == null) {
        return null;
    }

    MessageInfo mi = (MessageInfo) message.get("org.apache.cxf.service.model.MessageInfo");
    for (MessagePartInfo mpi : mi.getMessageParts()) {
        if (CHARGEBOX_ID_HEADER.equals(mpi.getName().getLocalPart())) {
            return (String) lst.get(mpi);
        }
    }

    return null;
}
 
开发者ID:RWTH-i5-IDSG,项目名称:steve-plugsurfing,代码行数:16,代码来源:FromAddressInterceptor.java

示例15: getEndpointAddress

import org.apache.cxf.message.Message; //导入方法依赖的package包/类
private String getEndpointAddress(Message message) {
    AddressingProperties addressProp = (AddressingProperties) message.get(ADDRESSING_PROPERTIES_INBOUND);
    if (addressProp == null) {
        return null;
    }

    EndpointReferenceType from = addressProp.getFrom();
    if (ContextUtils.isGenericAddress(from)) {
        return null;
    } else {
        return from.getAddress().getValue();
    }
}
 
开发者ID:RWTH-i5-IDSG,项目名称:steve-plugsurfing,代码行数:14,代码来源:FromAddressInterceptor.java


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