public void setFeatures(List<? extends Feature> features) { this.features = CastUtils.cast(features); }
public void destroy() { FileUtils.maybeDeleteDefaultTempDir(); }
private QName getPayloadElementName(SOAPMessage soapMessage) { try { // we only care about the first element node, not text nodes Element element = DOMUtils.getFirstElement(SAAJUtils.getBody(soapMessage)); if (element != null) { return DOMUtils.getElementQName(element); } } catch (Exception e) { //ignore } return null; }
@Override public InputStream getInputStream() throws IOException { LoadingByteArrayOutputStream bout = new LoadingByteArrayOutputStream(); writeTo(bout); return bout.createInputStream(); } @Override
public URL getSchemaLocation(String namespace) { if ("http://cxf.apache.org/blueprint/jaxws".equals(namespace)) { return getClass().getClassLoader().getResource("schemas/blueprint/jaxws.xsd"); } return super.findCoreSchemaLocation(namespace); }
@Test public void testXMP() throws Exception { Response response = WebClient .create(endPoint + META_PATH) .type("application/msword") .accept("application/rdf+xml") .put(ClassLoader .getSystemResourceAsStream(TikaResourceTest.TEST_DOC)); String result = IOUtils.readStringFromStream((InputStream) response.getEntity()); assertContains("<rdf:li>Maxim Valyanskiy</rdf:li>", result); }
@Override public void thresholdNotReached() { if (chunking) { setFixedLengthStreamingMode(buffer.size()); } }
protected void closeInputStream() throws IOException { //try and consume any content so that the connection might be reusable InputStream ins = connection.getErrorStream(); if (ins == null) { ins = connection.getInputStream(); } if (ins != null) { IOUtils.consume(ins); ins.close(); } } protected int getResponseCode() throws IOException {
public FormattedServiceListWriter(String styleSheetPath, String title, boolean showForeignContexts, Bus bus) { this.styleSheetPath = styleSheetPath; this.title = title; this.showForeignContexts = showForeignContexts; this.bus = bus; if (this.bus != null) { this.atomMap = CastUtils.cast((Map<?, ?>)this.bus.getProperty("org.apache.cxf.extensions.logging.atom.pull")); } }
private void renderStyleSheet(HttpServletRequest request, HttpServletResponse response) throws IOException { response.setContentType("text/css; charset=UTF-8"); URL url = this.getClass().getResource("servicelist.css"); if (url != null) { IOUtils.copy(url.openStream(), response.getOutputStream()); } }
public URL getSchemaLocation(String s) { if ("http://cxf.apache.org/transports/http/configuration".equals(s)) { return getClass().getClassLoader(). getResource("schemas/configuration/http-conf.xsd"); } return super.findCoreSchemaLocation(s); }
protected void addListener(AbstractApplicationContext wac) { try { //spring 2 vs spring 3 return type is different Method m = wac.getClass().getMethod("getApplicationListeners"); Collection<Object> c = CastUtils.cast((Collection<?>)ReflectionUtil .setAccessible(m).invoke(wac)); c.add(this); } catch (Throwable t) { //ignore. } }
protected Map<String, Object> removeHandlerProperties(WrappedMessageContext ctx) { Map<String, Scope> scopes = CastUtils.cast((Map<?, ?>)ctx.get(WrappedMessageContext.SCOPES)); Map<String, Object> handlerScopedStuff = new HashMap<>(); if (scopes != null) { for (Map.Entry<String, Scope> scope : scopes.entrySet()) { if (scope.getValue() == Scope.HANDLER) { handlerScopedStuff.put(scope.getKey(), ctx.get(scope.getKey())); } } for (String key : handlerScopedStuff.keySet()) { ctx.remove(key); } } return handlerScopedStuff; }
private Object createAttachments(Map<String, Object> mc, String propertyName) { if (mc == null) { return null; } Collection<Attachment> attachments = CastUtils.cast((Collection<?>)mc.get(Message.ATTACHMENTS)); Map<String, DataHandler> dataHandlers; if (attachments instanceof WrappedAttachments) { dataHandlers = ((WrappedAttachments) attachments).getAttachments(); } else { if (attachments == null) { attachments = new ArrayList<>(); mc.put(Message.ATTACHMENTS, attachments); } dataHandlers = AttachmentUtil.getDHMap(attachments); mc.put(propertyName, dataHandlers); scopes.put(propertyName, Scope.APPLICATION); } return dataHandlers; }
/** * While extracting the Message.PROTOCOL_HEADERS property from the Message, * this call ensures that the Message.PROTOCOL_HEADERS property is * set on the Message. If it is not set, an empty map is placed there, and * then returned. * * @param message The outbound message * @return The PROTOCOL_HEADERS map */ public static Map<String, List<String>> getSetProtocolHeaders(final Message message) { Map<String, List<String>> headers = CastUtils.cast((Map<?, ?>)message.get(Message.PROTOCOL_HEADERS)); if (null == headers) { headers = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); } else if (headers instanceof HashMap) { Map<String, List<String>> headers2 = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); headers2.putAll(headers); headers = headers2; } message.put(Message.PROTOCOL_HEADERS, headers); return headers; }
public Set<QName> getUnderstoodHeaders() { Set<QName> understood = new HashSet<>(); for (Handler<?> h : getBinding().getHandlerChain()) { if (h instanceof SOAPHandler) { Set<QName> headers = CastUtils.cast(((SOAPHandler<?>) h).getHeaders()); if (headers != null) { understood.addAll(headers); } } } return understood; }
public Set<QName> getUnderstoodHeaders() { Set<QName> understood = new HashSet<>(); for (Handler<?> h : getBinding().getHandlerChain()) { if (h instanceof SOAPHandler) { Set<QName> headers = CastUtils.cast(((SOAPHandler<?>) h).getHeaders()); if (headers != null) { understood.addAll(headers); } } } return understood; }
public Set<QName> getUnderstoodHeaders() { Set<QName> understood = new HashSet<>(); for (Handler<?> h : getBinding().getHandlerChain()) { if (h instanceof SOAPHandler) { Set<QName> headers = CastUtils.cast(((SOAPHandler<?>) h).getHeaders()); if (headers != null) { understood.addAll(headers); } } } return understood; }
@Override protected void initializeWSDLOperation(InterfaceInfo intf, OperationInfo o, Method method) { method = ((JaxWsServiceConfiguration)jaxWsConfiguration).getDeclaredMethod(method); o.setProperty(Method.class.getName(), method); o.setProperty(METHOD, method); initializeWrapping(o, method); // rpc out-message-part-info class mapping Operation op = (Operation)o.getProperty(WSDLServiceBuilder.WSDL_OPERATION); initializeClassInfo(o, method, op == null ? null : CastUtils.cast(op.getParameterOrdering(), String.class)); bindOperation(o, method); sendEvent(Event.INTERFACE_OPERATION_BOUND, o, method); }