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); } }
message.setContent(Source.class, new StreamSource(cos.getInputStream())); } catch (Exception e) { throw new Fault(e); in.close(); } catch (Exception e) { throw new Fault(e); source = obj; } else if (message.getContent(DataSource.class) != null) { throw new Fault(new org.apache.cxf.common.i18n.Message( "GETPAYLOAD_OF_DATASOURCE_NOT_VALID_XMLHTTPBINDING", LOG));
public void init() throws ToolException { // initialize if (toolspec == null) { Message message = new Message("TOOLSPEC_NOT_INITIALIZED", LOG); LOG.log(Level.SEVERE, message.toString()); throw new ToolException(message); } }
throw new Fault(new org.apache.cxf.common.i18n.Message("INVOCATION_TARGET_EXC", BUNDLE), e); } catch (IllegalAccessException | IllegalArgumentException e) { throw new Fault(new org.apache.cxf.common.i18n.Message("COULD_NOT_INVOKE", BUNDLE), e); LOG.log(Level.WARNING, "EXCEPTION_WHILE_WRITING_FAULT", nex);
protected void initializeWSDLOperationsForProvider() { Class<?> c = getProviderParameterType(getServiceClass()); if (c == null) { throw new ServiceConstructionException(new Message("INVALID_PROVIDER_EXC", LOG)); LOG.log(Level.WARNING, "COULD_NOT_FIND_ENDPOINT", new Object[] {getEndpointName(), enames});
public FrontEnd getFrontEnd(String name) { FrontEnd frontend = frontends.get(name); if (frontend == null) { Message msg = new Message("FRONTEND_MISSING", LOG, name); throw new ToolException(msg); } return frontend; }
public void init() throws ToolException { // initialize if (toolspec == null) { Message message = new Message("TOOLSPEC_NOT_INITIALIZED", LOG); LOG.log(Level.SEVERE, message.toString()); throw new ToolException(message); } }
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(); } }
throw new Fault(new org.apache.cxf.common.i18n.Message("ATTACHMENT_NOT_SUPPORTED", LOG, o.getClass()));
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 WSDLExtensibilityPlugin getWSDLPlugin(final String key, final Class<?> clz) { StringBuilder sb = new StringBuilder(); sb.append(key); sb.append("-"); sb.append(clz.getName()); WSDLExtensibilityPlugin plugin = wsdlPlugins.get(sb.toString()); if (plugin == null) { throw new ToolException(new Message("FOUND_NO_WSDL_PLUGIN", LOG, sb.toString(), clz)); } return plugin; }
private AbstractWSDLBuilder loadBuilder(String fullClzName) { AbstractWSDLBuilder builder = null; try { builder = (AbstractWSDLBuilder) ClassLoaderUtils .loadClass(fullClzName, getClass()).newInstance(); } catch (Exception e) { Message msg = new Message("LOAD_PROCESSOR_FAILED", LOG, fullClzName); LOG.log(Level.SEVERE, msg.toString()); throw new ToolException(msg, e); } return builder; }
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 Boolean isWrapped(Method m) { // see if someone overrode the default value if (getServiceFactory().getWrapped() != null) { return getServiceFactory().getWrapped(); } m = getDeclaredMethod(m); SOAPBinding ann = m.getAnnotation(SOAPBinding.class); if (ann != null) { if (ann.style().equals(Style.RPC)) { Message message = new Message("SOAPBinding_MESSAGE_RPC", LOG, m.getName()); throw new Fault(new JaxWsConfigurationException(message)); } return !(ann.parameterStyle().equals(ParameterStyle.BARE)); } return isWrapped(); }
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"); }
public FileWriterUtil(String targetDir, OutputStreamCreator osc) throws ToolException { target = new File(targetDir); this.osc = osc == null ? new OutputStreamCreator() : osc; if (!(target.exists()) || !(target.isDirectory())) { Message msg = new Message("DIRECTORY_NOT_EXIST", LOG, target); throw new ToolException(msg); } }
private DataBindingProfile loadDataBindingProfile(String fullClzName) { DataBindingProfile profile = null; try { profile = (DataBindingProfile)ClassLoaderUtils.loadClass(fullClzName, getClass()).newInstance(); } catch (Exception e) { Message msg = new Message("DATABINDING_PROFILE_LOAD_FAIL", LOG, fullClzName); LOG.log(Level.SEVERE, msg.toString()); throw new ToolException(msg); } return profile; }
@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; }
throw new Fault(new org.apache.cxf.common.i18n.Message("CANNOT_SET_HOLDER_OBJECTS", LOG));