當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。