本文整理汇总了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());
}
}
示例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);
}
}
}
示例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);
}
}
}
示例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;
}
示例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);
}
}
}
示例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);
}
}
示例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));
}
示例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 ) );
}
示例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);
}
示例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;
}
示例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);
}
}
示例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);
}
示例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);
}
}
示例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;
}
示例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();
}
}