Refine search
public JaxWsWebServicePublisherBeanPostProcessor() throws SecurityException, NoSuchMethodException, ClassNotFoundException { try { servletClass = ClassLoaderUtils.loadClass(CXF_SERVLET_CLASS_NAME, getClass()); } catch (ClassNotFoundException e) { Message message = new Message("SERVLET_CLASS_MISSING", LOG, CXF_SERVLET_CLASS_NAME); LOG.severe(message.toString()); throw e; } servletGetBusMethod = servletClass.getMethod("getBus"); }
private HttpServletResponse getHttpResponseFromMessage(Message message) throws IOException { Object responseObj = message.get(HTTP_RESPONSE); if (responseObj instanceof HttpServletResponse) { return (HttpServletResponse)responseObj; } else if (null != responseObj) { String m = (new org.apache.cxf.common.i18n.Message("UNEXPECTED_RESPONSE_TYPE_MSG", LOG, responseObj.getClass())).toString(); LOG.log(Level.WARNING, m); throw new IOException(m); } else { String m = (new org.apache.cxf.common.i18n.Message("NULL_RESPONSE_MSG", LOG)).toString(); LOG.log(Level.WARNING, m); throw new IOException(m); } }
public void setRegistry(DestinationRegistry newRegistry) { w.lock(); try { if (registry.getDestinations().isEmpty()) { this.registry = newRegistry; } else { String m = new org.apache.cxf.common.i18n.Message("CANNOT_CHANGE_REGISTRY_ALREADY_IN_USE", LOG).toString(); LOG.log(Level.SEVERE, m); throw new RuntimeException(m); } } finally { w.unlock(); } }
public <T extends EndpointReference> T getEndpointReference(Class<T> clazz, Element... referenceParameters) { if (W3CEndpointReference.class.isAssignableFrom(clazz)) { return clazz.cast(getEndpointReference(referenceParameters)); } throw new WebServiceException(new org.apache.cxf.common.i18n.Message( "ENDPOINTREFERENCE_TYPE_NOT_SUPPORTED", LOG, clazz .getName()).toString()); }
public <T extends EndpointReference> T getEndpointReference(Class<T> clazz, Element... referenceParameters) { if (W3CEndpointReference.class.isAssignableFrom(clazz)) { return clazz.cast(getEndpointReference(referenceParameters)); } throw new WebServiceException(new Message("ENDPOINTREFERENCE_TYPE_NOT_SUPPORTED", LOG, clazz.getName()).toString()); }
private void checkRespectBindingFeature(List<ExtensibilityElement> bindingExtensors) { if (bindingExtensors != null) { Iterator<ExtensibilityElement> extensionElements = bindingExtensors.iterator(); while (extensionElements.hasNext()) { ExtensibilityElement ext = extensionElements.next(); if (ext instanceof UnknownExtensibilityElement && Boolean.TRUE.equals(ext.getRequired()) && this.wsFeatures != null) { for (WebServiceFeature feature : this.wsFeatures) { if (feature instanceof RespectBindingFeature && feature.isEnabled()) { org.apache.cxf.common.i18n.Message message = new org.apache.cxf.common.i18n.Message("UNKONWN_REQUIRED_WSDL_BINDING", LOG); LOG.severe(message.toString()); throw new WebServiceException(message.toString()); } } } } } }
protected void finalizeServletInit(ServletConfig servletConfig) throws ServletException { InputStream is = getResourceAsStream("/WEB-INF" + STATIC_RESOURCES_MAP_RESOURCE); if (is == null) { is = getResourceAsStream(STATIC_RESOURCES_MAP_RESOURCE); } if (is != null) { try { Properties props = new Properties(); props.load(is); for (String name : props.stringPropertyNames()) { staticContentTypes.put(name, props.getProperty(name)); } is.close(); } catch (IOException ex) { String message = new org.apache.cxf.common.i18n.Message("STATIC_RESOURCES_MAP_LOAD_FAILURE", BUNDLE).toString(); LOG.warning(message); } } }
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { Class<?> clazz = ClassHelper.getRealClass(getServletBus(), bean); if (clazz.isAnnotationPresent(WebService.class)) { WebService ws = clazz.getAnnotation(WebService.class); String url = urlPrefix + ws.serviceName(); Message message = new Message("SELECTED_SERVICE", LOG, beanName, clazz.getName(), url); LOG.info(message.toString()); createAndPublishEndpoint(url, bean); registerHandler(url, new ServletAdapter(shadowCxfServlet)); } else { Message message = new Message("REJECTED_NO_ANNOTATION", LOG, beanName, clazz.getName()); LOG.fine(message.toString()); } return bean; }
public EndpointReference readEndpointReference(Source eprInfoset) { try { final XMLStreamReader reader = StaxUtils.createXMLStreamReader(eprInfoset); return AccessController.doPrivileged(new PrivilegedExceptionAction<EndpointReference>() { public EndpointReference run() throws Exception { Unmarshaller unmarshaller = null; try { unmarshaller = getJAXBContext().createUnmarshaller(); return (EndpointReference)unmarshaller.unmarshal(reader); } finally { try { StaxUtils.close(reader); } catch (XMLStreamException e) { // Ignore } JAXBUtils.closeUnmarshaller(unmarshaller); } } }); } catch (PrivilegedActionException pae) { Exception e = pae.getException(); if (e instanceof JAXBException) { throw new WebServiceException(new Message("ERROR_UNMARSHAL_ENDPOINTREFERENCE", LOG) .toString(), e); } throw new SecurityException(e); } }
private String setEncoding(final Message inMessage, final HttpServletRequest req, final String contentType) throws IOException { String enc = HttpHeaderHelper.findCharset(contentType); if (enc == null) { enc = req.getCharacterEncoding(); } // work around a bug with Jetty which results in the character // encoding not being trimmed correctly. if (enc != null && enc.endsWith("\"")) { enc = enc.substring(0, enc.length() - 1); } if (enc != null || "POST".equals(req.getMethod()) || "PUT".equals(req.getMethod())) { //allow gets/deletes/options to not specify an encoding String normalizedEncoding = HttpHeaderHelper.mapCharset(enc); if (normalizedEncoding == null) { String m = new org.apache.cxf.common.i18n.Message("INVALID_ENCODING_MSG", LOG, enc).toString(); LOG.log(Level.WARNING, m); throw new IOException(m); } inMessage.put(Message.ENCODING, normalizedEncoding); } return contentType; } protected Message retrieveFromContinuation(HttpServletRequest req) {
@Override public String getId(Map<String, Object> context) { String id = null; if (isMultiplexWithAddress()) { String address = (String)context.get(Message.PATH_INFO); if (null != address) { int afterLastSlashIndex = address.lastIndexOf("/") + 1; if (afterLastSlashIndex > 0 && afterLastSlashIndex < address.length()) { id = address.substring(afterLastSlashIndex); } } else { getLogger().log(Level.WARNING, new org.apache.cxf.common.i18n.Message( "MISSING_PATH_INFO", LOG).toString()); } } else { return super.getId(context); } return id; }
public Endpoint createEndpoint(String bindingId, Object implementor, WebServiceFeature ... features) { EndpointImpl ep = null; if (EndpointUtils.isValidImplementor(implementor)) { Bus bus = BusFactory.getThreadDefaultBus(); ep = createEndpointImpl(bus, bindingId, implementor, features); return ep; } throw new WebServiceException(new Message("INVALID_IMPLEMENTOR_EXC", LOG).toString()); }
@Override public Endpoint createEndpoint(String bindingId, Object implementor) { Endpoint ep = null; if (EndpointUtils.isValidImplementor(implementor)) { Bus bus = BusFactory.getThreadDefaultBus(); ep = createEndpointImpl(bus, bindingId, implementor); return ep; } throw new WebServiceException(new Message("INVALID_IMPLEMENTOR_EXC", LOG).toString()); } //new in 2.2
private QName getPortTypeName(Class<?> serviceEndpointInterface) { Class<?> seiClass = serviceEndpointInterface; if (!serviceEndpointInterface.isAnnotationPresent(WebService.class)) { Message msg = new Message("SEI_NO_WEBSERVICE_ANNOTATION", BUNDLE, serviceEndpointInterface .getCanonicalName()); throw new WebServiceException(msg.toString()); seiClass = Thread.currentThread().getContextClassLoader().loadClass(epi); } catch (ClassNotFoundException e) { Message msg = new Message("COULD_NOT_LOAD_CLASS", BUNDLE, epi); throw new WebServiceException(msg.toString()); Message msg = new Message("SEI_NO_WEBSERVICE_ANNOTATION", BUNDLE, seiClass.getCanonicalName()); throw new WebServiceException(msg.toString());
public EndpointReference getEndpointReference(Element... referenceParameters) { if (!isPublished()) { throw new WebServiceException(new org.apache.cxf.common.i18n.Message("ENDPOINT_NOT_PUBLISHED", LOG).toString()); } if (getBinding() instanceof HTTPBinding) { throw new UnsupportedOperationException(new org.apache.cxf.common.i18n.Message( "GET_ENDPOINTREFERENCE_UNSUPPORTED_BINDING", LOG).toString()); } W3CEndpointReferenceBuilder builder = new W3CEndpointReferenceBuilder(); builder.address(address); builder.serviceName(serviceName); builder.endpointName(endpointName); if (referenceParameters != null) { for (Element referenceParameter : referenceParameters) { builder.referenceParameter(referenceParameter); } } builder.wsdlDocumentLocation(wsdlLocation); ClassLoader cl = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(EndpointReferenceBuilder.class.getClassLoader()); return builder.build(); } finally { Thread.currentThread().setContextClassLoader(cl); } }
if (jettyFactory == null && addr != null && addr.startsWith("http")) { String m = new org.apache.cxf.common.i18n.Message("NO_HTTP_DESTINATION_FACTORY_FOUND", LOG).toString(); LOG.log(Level.SEVERE, m); throw new IOException(m);
public Endpoint createEndpoint(String bindingId, Class<?> implementorClass, Invoker invoker, WebServiceFeature ... features) { if (EndpointUtils.isValidImplementor(implementorClass)) { Bus bus = BusFactory.getThreadDefaultBus(); JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean(); if (features != null) { factory.getJaxWsServiceFactory().setWsFeatures(Arrays.asList(features)); } if (invoker != null) { factory.setInvoker(new JAXWSMethodInvoker(invoker)); try { invoker.inject(new WebServiceContextImpl()); } catch (Exception e) { throw new WebServiceException(new Message("ENDPOINT_CREATION_FAILED_MSG", LOG).toString(), e); } } EndpointImpl ep = new EndpointImpl(bus, null, factory); ep.setImplementorClass(implementorClass); return ep; } throw new WebServiceException(new Message("INVALID_IMPLEMENTOR_EXC", LOG).toString()); }