Java Code Examples for org.apache.cxf.message.MessageContentsList#get()
The following examples show how to use
org.apache.cxf.message.MessageContentsList#get() .
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: WSS4JEetOutInterceptor.java From eet-client with MIT License | 6 votes |
@Override public void handleMessage(SoapMessage message) throws Fault { super.handleMessage(message); MessageContentsList contents = MessageContentsList.getContentsList(message); if (contents != null && contents.size() == 1) { Object requestObj = contents.get(0); if (requestObj instanceof TrzbaType) { TrzbaType request = (TrzbaType) requestObj; TrzbaHlavickaType header = request.getHlavicka(); // validation is required if getOvereni is unspecified or false. boolean required = header == null || !Boolean.TRUE.equals(header.getOvereni()); message.getExchange().put(WSS4JEetInInterceptor.PROP_SIGNATURE_REQUIRED, required); } } }
Example 2
Source File: SamlFormOutInterceptor.java From cxf with Apache License 2.0 | 6 votes |
@SuppressWarnings("unchecked") protected Form getRequestForm(Message message) { Object ct = message.get(Message.CONTENT_TYPE); if (ct == null || !MediaType.APPLICATION_FORM_URLENCODED.equalsIgnoreCase(ct.toString())) { return null; } MessageContentsList objs = MessageContentsList.getContentsList(message); if (objs != null && objs.size() == 1) { Object obj = objs.get(0); if (obj instanceof Form) { return (Form)obj; } else if (obj instanceof MultivaluedMap) { return new Form((MultivaluedMap<String, String>)obj); } } return null; }
Example 3
Source File: AbstractClient.java From cxf with Apache License 2.0 | 6 votes |
@Override public void handleMessage(Message outMessage) throws Fault { MessageContentsList objs = MessageContentsList.getContentsList(outMessage); if (objs == null || objs.isEmpty()) { return; } OutputStream os = outMessage.getContent(OutputStream.class); if (os == null) { XMLStreamWriter writer = outMessage.getContent(XMLStreamWriter.class); if (writer == null) { return; } } Object body = objs.get(0); Annotation[] customAnns = (Annotation[])outMessage.get(Annotation.class.getName()); Type t = outMessage.get(Type.class); doWriteBody(outMessage, body, t, customAnns, os); }
Example 4
Source File: CustomHandler.java From tomee with Apache License 2.0 | 6 votes |
@Override public void handleMessage(final Message message) throws Fault { if (isResponseAlreadyHandled(message)) { return; } final MessageContentsList objs = MessageContentsList.getContentsList(message); if (objs == null || objs.isEmpty()) { return; } final Object responseObj = objs.get(0); if (Response.class.isInstance(responseObj)) { final Response response = Response.class.cast(responseObj); if (is404(message, response)) { switchResponse(message); } } else { final Object exchangeStatus = message.getExchange().get(Message.RESPONSE_CODE); final int status = exchangeStatus != null ? Integer.class.cast(exchangeStatus) : HttpsURLConnection.HTTP_OK; if (status == HttpsURLConnection.HTTP_NOT_FOUND) { switchResponse(message); } } }
Example 5
Source File: SignatureFaultInterceptor.java From eet-client with MIT License | 5 votes |
@Override public void handleMessage(SoapMessage message) throws Fault { if (message.getExchange().containsKey(WSS4JEetInInterceptor.PROP_SIGNATURE_ERROR)) { MessageContentsList contents = MessageContentsList.getContentsList(message); OdpovedType response = (OdpovedType) contents.get(0); OdpovedChybaType error = response.getChyba(); if (error == null || error.getKod() == ERR_CODE_NO_ERROR) { throw (Fault) message.getExchange().get(WSS4JEetInInterceptor.PROP_SIGNATURE_ERROR); } } }
Example 6
Source File: MessageModeInInterceptor.java From cxf with Apache License 2.0 | 5 votes |
private void doDataSource(final Message message) { MessageContentsList list = (MessageContentsList)message.getContent(List.class); //reconstitute all the parts into a Mime data source if (message.getAttachments() != null && !message.getAttachments().isEmpty() && list != null && !list.isEmpty() && list.get(0) instanceof DataSource) { list.set(0, new MultiPartDataSource(message, (DataSource)list.get(0))); } }
Example 7
Source File: AbstractXmlSecOutInterceptor.java From cxf with Apache License 2.0 | 5 votes |
private Object getRequestBody(Message message) { MessageContentsList objs = MessageContentsList.getContentsList(message); if (objs == null || objs.isEmpty()) { return null; } return objs.get(0); }
Example 8
Source File: ClientRequestContextImpl.java From cxf with Apache License 2.0 | 5 votes |
private Object getMessageContent() { MessageContentsList objs = MessageContentsList.getContentsList(m); if (objs == null || objs.isEmpty()) { return null; } return objs.get(0); }
Example 9
Source File: HTTPConduit.java From cxf with Apache License 2.0 | 5 votes |
protected boolean isChunkingSupported(Message message, String httpMethod) { if (HTTP_POST_METHOD.equals(httpMethod)) { return true; } else if (!HTTP_GET_METHOD.equals(httpMethod)) { MessageContentsList objs = MessageContentsList.getContentsList(message); if (objs != null && !objs.isEmpty()) { Object obj = objs.get(0); return obj.getClass() != String.class || (obj.getClass() == String.class && ((String)obj).length() > 0); } } return false; }
Example 10
Source File: CustomInvoker.java From BIMserver with GNU Affero General Public License v3.0 | 5 votes |
@Override protected Object invoke(Exchange exchange, Object service, Method method, List<Object> arguments) { if (method.getName().equals("login")) { MessageContentsList mcl = (MessageContentsList) super.invoke(exchange, service, method, arguments); String token = (String) mcl.get(0); exchange.getSession().put("token", token); return mcl; } else { return super.invoke(exchange, service, method, arguments); } }
Example 11
Source File: HelloProcessor.java From java-course-ee with MIT License | 4 votes |
@Override public void process(Exchange exchange) throws Exception { MessageContentsList body = exchange.getIn().getBody(MessageContentsList.class); String o = (String) body.get(0); body.set(0, "Hello " + o); }