|
Apache CXF example source code file (MessageImpl.java)
The Apache CXF MessageImpl.java source code/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.cxf.message; import java.io.InputStream; import java.io.OutputStream; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.IdentityHashMap; import java.util.List; import java.util.Map; import java.util.Set; import javax.xml.stream.XMLStreamReader; import javax.xml.stream.XMLStreamWriter; import org.w3c.dom.Node; import org.apache.cxf.Bus; import org.apache.cxf.endpoint.Endpoint; import org.apache.cxf.helpers.CastUtils; import org.apache.cxf.interceptor.InterceptorChain; import org.apache.cxf.io.DelegatingInputStream; import org.apache.cxf.service.Service; import org.apache.cxf.service.model.EndpointInfo; import org.apache.cxf.transport.Destination; public class MessageImpl extends StringMapImpl implements Message { private static final Class<?> DEFAULT_CONTENTS[]; private static final int DEFAULT_CONTENTS_LENGTH; static { Class<?> tmps[]; try { //if SAAJ is there, give it a slot Class<?> cls = Class.forName("javax.xml.soap.SOAPMessage"); tmps = new Class<?>[] { XMLStreamReader.class, XMLStreamWriter.class, InputStream.class, OutputStream.class, List.class, Exception.class, Node.class, DelegatingInputStream.class, cls }; } catch (Throwable e) { tmps = new Class<?>[] { XMLStreamReader.class, XMLStreamWriter.class, InputStream.class, OutputStream.class, List.class, Exception.class, Node.class, DelegatingInputStream.class }; } DEFAULT_CONTENTS = tmps; DEFAULT_CONTENTS_LENGTH = tmps.length; } private Exchange exchange; private String id; private InterceptorChain interceptorChain; private Object[] defaultContents = new Object[DEFAULT_CONTENTS_LENGTH]; private Map<Class contents; private Map<String, Object> contextCache; public MessageImpl() { //nothing } public MessageImpl(Message m) { super(m); if (m instanceof MessageImpl) { MessageImpl impl = (MessageImpl)m; exchange = impl.getExchange(); id = impl.id; interceptorChain = impl.interceptorChain; defaultContents = impl.defaultContents; contents = impl.contents; contextCache = impl.contextCache; } else { throw new RuntimeException("Not a MessageImpl! " + m.getClass()); } } public Collection<Attachment> getAttachments() { return CastUtils.cast((Collection<?>)get(ATTACHMENTS)); } public void setAttachments(Collection<Attachment> attachments) { put(ATTACHMENTS, attachments); } public String getAttachmentMimeType() { //for sub class overriding return null; } public Destination getDestination() { return get(Destination.class); } public Exchange getExchange() { return exchange; } public String getId() { return id; } public InterceptorChain getInterceptorChain() { return this.interceptorChain; } @SuppressWarnings("unchecked") public <T> T getContent(Class Other Apache CXF examples (source code examples)Here is a short list of links related to this Apache CXF MessageImpl.java source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.