code
stringlengths
67
466k
docstring
stringlengths
1
13.2k
public void stop() throws MojoExecutionException, IOException, InstanceNotFoundException { try { this.connection.invoke(this.objectName, "shutdown", null, null); } catch (ReflectionException ex) { throw new MojoExecutionException("Shutdown failed", ex.getCause()); } catch (MBeanException ex) { throw new MojoExecutionException("Could not invoke shutdown operation", ex); } }
Stop the application managed by this instance. @throws MojoExecutionException if the JMX service could not be contacted @throws IOException if an I/O error occurs @throws InstanceNotFoundException if the lifecycle mbean cannot be found
public static JMXConnector connect(int port) throws IOException { String url = "service:jmx:rmi:///jndi/rmi://127.0.0.1:" + port + "/jmxrmi"; JMXServiceURL serviceUrl = new JMXServiceURL(url); return JMXConnectorFactory.connect(serviceUrl, null); }
Create a connector for an {@link javax.management.MBeanServer} exposed on the current machine and the current port. Security should be disabled. @param port the port on which the mbean server is exposed @return a connection @throws IOException if the connection to that server failed
public boolean handle(ServerHttpRequest request, ServerHttpResponse response) throws IOException { for (HandlerMapper mapper : this.mappers) { Handler handler = mapper.getHandler(request); if (handler != null) { handle(handler, request, response); return true; } } return false; }
Dispatch the specified request to an appropriate {@link Handler}. @param request the request @param response the response @return {@code true} if the request was dispatched @throws IOException in case of I/O errors
public final void sendingResponse(HttpTrace trace, TraceableResponse response, Supplier<Principal> principal, Supplier<String> sessionId) { setIfIncluded(Include.TIME_TAKEN, () -> System.currentTimeMillis() - trace.getTimestamp().toEpochMilli(), trace::setTimeTaken); setIfIncluded(Include.SESSION_ID, sessionId, trace::setSessionId); setIfIncluded(Include.PRINCIPAL, principal, trace::setPrincipal); trace.setResponse( new HttpTrace.Response(new FilteredTraceableResponse(response))); }
Ends the tracing of the exchange that is being concluded by sending the given {@code response}. @param trace the trace for the exchange @param response the response that concludes the exchange @param principal a supplier for the exchange's principal @param sessionId a supplier for the id of the exchange's session
private void doWithThreadContextClassLoader(ClassLoader classLoader, Runnable code) { ClassLoader existingLoader = (classLoader != null) ? ClassUtils.overrideThreadContextClassLoader(classLoader) : null; try { code.run(); } finally { if (existingLoader != null) { ClassUtils.overrideThreadContextClassLoader(existingLoader); } } }
Some older Servlet frameworks (e.g. Struts, BIRT) use the Thread context class loader to create servlet instances in this phase. If they do that and then try to initialize them later the class loader may have changed, so wrap the call to loadOnStartup in what we think its going to be the main webapp classloader at runtime. @param classLoader the class loader to use @param code the code to run
public TemplateAvailabilityProvider getProvider(String view, ApplicationContext applicationContext) { Assert.notNull(applicationContext, "ApplicationContext must not be null"); return getProvider(view, applicationContext.getEnvironment(), applicationContext.getClassLoader(), applicationContext); }
Get the provider that can be used to render the given view. @param view the view to render @param applicationContext the application context @return a {@link TemplateAvailabilityProvider} or null
public TemplateAvailabilityProvider getProvider(String view, Environment environment, ClassLoader classLoader, ResourceLoader resourceLoader) { Assert.notNull(view, "View must not be null"); Assert.notNull(environment, "Environment must not be null"); Assert.notNull(classLoader, "ClassLoader must not be null"); Assert.notNull(resourceLoader, "ResourceLoader must not be null"); Boolean useCache = environment.getProperty("spring.template.provider.cache", Boolean.class, true); if (!useCache) { return findProvider(view, environment, classLoader, resourceLoader); } TemplateAvailabilityProvider provider = this.resolved.get(view); if (provider == null) { synchronized (this.cache) { provider = findProvider(view, environment, classLoader, resourceLoader); provider = (provider != null) ? provider : NONE; this.resolved.put(view, provider); this.cache.put(view, provider); } } return (provider != NONE) ? provider : null; }
Get the provider that can be used to render the given view. @param view the view to render @param environment the environment @param classLoader the class loader @param resourceLoader the resource loader @return a {@link TemplateAvailabilityProvider} or null
@Override public List<ForeignKey<Record, ?>> getReferences() { return Arrays.<ForeignKey<Record, ?>>asList(Keys.FK_BOOK_AUTHOR, Keys.FK_BOOK_LANGUAGE); }
{@inheritDoc}
public Class<?>[] compile(String... sources) throws CompilationFailedException, IOException { this.loader.clearCache(); List<Class<?>> classes = new ArrayList<>(); CompilerConfiguration configuration = this.loader.getConfiguration(); CompilationUnit compilationUnit = new CompilationUnit(configuration, null, this.loader); ClassCollector collector = this.loader.createCollector(compilationUnit, null); compilationUnit.setClassgenCallback(collector); for (String source : sources) { List<String> paths = ResourceUtils.getUrls(source, this.loader); for (String path : paths) { compilationUnit.addSource(new URL(path)); } } addAstTransformations(compilationUnit); compilationUnit.compile(Phases.CLASS_GENERATION); for (Object loadedClass : collector.getLoadedClasses()) { classes.add((Class<?>) loadedClass); } ClassNode mainClassNode = MainClass.get(compilationUnit); Class<?> mainClass = null; for (Class<?> loadedClass : classes) { if (mainClassNode.getName().equals(loadedClass.getName())) { mainClass = loadedClass; } } if (mainClass != null) { classes.remove(mainClass); classes.add(0, mainClass); } return ClassUtils.toClassArray(classes); }
Compile the specified Groovy sources, applying any {@link CompilerAutoConfiguration}s. All classes defined in the sources will be returned from this method. @param sources the sources to compile @return compiled classes @throws CompilationFailedException in case of compilation failures @throws IOException in case of I/O errors @throws CompilationFailedException in case of compilation errors
public void setServerCustomizers( Collection<? extends JettyServerCustomizer> customizers) { Assert.notNull(customizers, "Customizers must not be null"); this.jettyServerCustomizers = new ArrayList<>(customizers); }
Sets {@link JettyServerCustomizer}s that will be applied to the {@link Server} before it is started. Calling this method will replace any existing customizers. @param customizers the Jetty customizers to apply
public String generate(String url) throws IOException { Object content = this.initializrService.loadServiceCapabilities(url); if (content instanceof InitializrServiceMetadata) { return generateHelp(url, (InitializrServiceMetadata) content); } return content.toString(); }
Generate a report for the specified service. The report contains the available capabilities as advertised by the root endpoint. @param url the url of the service @return the report that describes the service @throws IOException if the report cannot be generated
public ProjectType getDefaultType() { if (this.projectTypes.getDefaultItem() != null) { return this.projectTypes.getDefaultItem(); } String defaultTypeId = getDefaults().get("type"); if (defaultTypeId != null) { return this.projectTypes.getContent().get(defaultTypeId); } return null; }
Return the default type to use or {@code null} if the metadata does not define any default. @return the default project type or {@code null}
protected Mono<ServerResponse> renderErrorView(ServerRequest request) { boolean includeStackTrace = isIncludeStackTrace(request, MediaType.TEXT_HTML); Map<String, Object> error = getErrorAttributes(request, includeStackTrace); HttpStatus errorStatus = getHttpStatus(error); ServerResponse.BodyBuilder responseBody = ServerResponse.status(errorStatus) .contentType(MediaType.TEXT_HTML); return Flux .just("error/" + errorStatus.value(), "error/" + SERIES_VIEWS.get(errorStatus.series()), "error/error") .flatMap((viewName) -> renderErrorView(viewName, responseBody, error)) .switchIfEmpty(this.errorProperties.getWhitelabel().isEnabled() ? renderDefaultErrorView(responseBody, error) : Mono.error(getError(request))) .next(); }
Render the error information as an HTML view. @param request the current request @return a {@code Publisher} of the HTTP response
protected Mono<ServerResponse> renderErrorResponse(ServerRequest request) { boolean includeStackTrace = isIncludeStackTrace(request, MediaType.ALL); Map<String, Object> error = getErrorAttributes(request, includeStackTrace); return ServerResponse.status(getHttpStatus(error)) .contentType(MediaType.APPLICATION_JSON_UTF8) .body(BodyInserters.fromObject(error)); }
Render the error information as a JSON payload. @param request the current request @return a {@code Publisher} of the HTTP response
protected boolean isIncludeStackTrace(ServerRequest request, MediaType produces) { ErrorProperties.IncludeStacktrace include = this.errorProperties .getIncludeStacktrace(); if (include == ErrorProperties.IncludeStacktrace.ALWAYS) { return true; } if (include == ErrorProperties.IncludeStacktrace.ON_TRACE_PARAM) { return isTraceEnabled(request); } return false; }
Determine if the stacktrace attribute should be included. @param request the source request @param produces the media type produced (or {@code MediaType.ALL}) @return if the stacktrace attribute should be included
protected HttpStatus getHttpStatus(Map<String, Object> errorAttributes) { int statusCode = (int) errorAttributes.get("status"); return HttpStatus.valueOf(statusCode); }
Get the HTTP error status information from the error map. @param errorAttributes the current error information @return the error HTTP status
protected RequestPredicate acceptsTextHtml() { return (serverRequest) -> { try { List<MediaType> acceptedMediaTypes = serverRequest.headers().accept(); acceptedMediaTypes.remove(MediaType.ALL); MediaType.sortBySpecificityAndQuality(acceptedMediaTypes); return acceptedMediaTypes.stream() .anyMatch(MediaType.TEXT_HTML::isCompatibleWith); }
Predicate that checks whether the current request explicitly support {@code "text/html"} media type. <p> The "match-all" media type is not considered here. @return the request predicate
private boolean shouldExtract(ProjectGenerationRequest request, ProjectGenerationResponse response) { if (request.isExtract()) { return true; } // explicit name hasn't been provided for an archive and there is no extension if (isZipArchive(response) && request.getOutput() != null && !request.getOutput().contains(".")) { return true; } return false; }
Detect if the project should be extracted. @param request the generation request @param response the generation response @return if the project should be extracted
public static HttpHandler configureCompression(Compression compression, HttpHandler httpHandler) { if (compression == null || !compression.getEnabled()) { return httpHandler; } ContentEncodingRepository repository = new ContentEncodingRepository(); repository.addEncodingHandler("gzip", new GzipEncodingProvider(), 50, Predicates.and(getCompressionPredicates(compression))); return new EncodingHandler(repository).setNext(httpHandler); }
Optionally wrap the given {@link HttpHandler} for HTTP compression support. @param compression the HTTP compression configuration @param httpHandler the HTTP handler to wrap @return the wrapped HTTP handler if compression is enabled, or the handler itself
@SafeVarargs public final Set<Class<?>> scan(Class<? extends Annotation>... annotationTypes) throws ClassNotFoundException { List<String> packages = getPackages(); if (packages.isEmpty()) { return Collections.emptySet(); } ClassPathScanningCandidateComponentProvider scanner = new ClassPathScanningCandidateComponentProvider( false); scanner.setEnvironment(this.context.getEnvironment()); scanner.setResourceLoader(this.context); for (Class<? extends Annotation> annotationType : annotationTypes) { scanner.addIncludeFilter(new AnnotationTypeFilter(annotationType)); } Set<Class<?>> entitySet = new HashSet<>(); for (String basePackage : packages) { if (StringUtils.hasText(basePackage)) { for (BeanDefinition candidate : scanner .findCandidateComponents(basePackage)) { entitySet.add(ClassUtils.forName(candidate.getBeanClassName(), this.context.getClassLoader())); } } } return entitySet; }
Scan for entities with the specified annotations. @param annotationTypes the annotation types used on the entities @return a set of entity classes @throws ClassNotFoundException if an entity class cannot be loaded
public static Tag status(ServerWebExchange exchange) { HttpStatus status = exchange.getResponse().getStatusCode(); if (status == null) { status = HttpStatus.OK; } return Tag.of("status", String.valueOf(status.value())); }
Creates a {@code status} tag based on the response status of the given {@code exchange}. @param exchange the exchange @return the status tag derived from the response status
public static Tag uri(ServerWebExchange exchange) { PathPattern pathPattern = exchange .getAttribute(HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE); if (pathPattern != null) { return Tag.of("uri", pathPattern.getPatternString()); } HttpStatus status = exchange.getResponse().getStatusCode(); if (status != null) { if (status.is3xxRedirection()) { return URI_REDIRECTION; } if (status == HttpStatus.NOT_FOUND) { return URI_NOT_FOUND; } } String path = getPathInfo(exchange); if (path.isEmpty()) { return URI_ROOT; } return URI_UNKNOWN; }
Creates a {@code uri} tag based on the URI of the given {@code exchange}. Uses the {@link HandlerMapping#BEST_MATCHING_PATTERN_ATTRIBUTE} best matching pattern if available. Falling back to {@code REDIRECTION} for 3xx responses, {@code NOT_FOUND} for 404 responses, {@code root} for requests with no path info, and {@code UNKNOWN} for all other requests. @param exchange the exchange @return the uri tag derived from the exchange
public static Tag exception(Throwable exception) { if (exception != null) { String simpleName = exception.getClass().getSimpleName(); return Tag.of("exception", StringUtils.hasText(simpleName) ? simpleName : exception.getClass().getName()); } return EXCEPTION_NONE; }
Creates an {@code exception} tag based on the {@link Class#getSimpleName() simple name} of the class of the given {@code exception}. @param exception the exception, may be {@code null} @return the exception tag derived from the exception
public static Tag outcome(ServerWebExchange exchange) { HttpStatus status = exchange.getResponse().getStatusCode(); if (status != null) { if (status.is1xxInformational()) { return OUTCOME_INFORMATIONAL; } if (status.is2xxSuccessful()) { return OUTCOME_SUCCESS; } if (status.is3xxRedirection()) { return OUTCOME_REDIRECTION; } if (status.is4xxClientError()) { return OUTCOME_CLIENT_ERROR; } return OUTCOME_SERVER_ERROR; } return OUTCOME_UNKNOWN; }
Creates an {@code outcome} tag based on the response status of the given {@code exchange}. @param exchange the exchange @return the outcome tag derived from the response status @since 2.1.0
public HealthIndicatorRegistry createHealthIndicatorRegistry( Map<String, HealthIndicator> healthIndicators) { Assert.notNull(healthIndicators, "HealthIndicators must not be null"); return initialize(new DefaultHealthIndicatorRegistry(), healthIndicators); }
Create a {@link HealthIndicatorRegistry} based on the specified health indicators. @param healthIndicators the {@link HealthIndicator} instances mapped by name @return a {@link HealthIndicator} that delegates to the specified {@code healthIndicators}.
protected boolean isIncludeStackTrace(HttpServletRequest request, MediaType produces) { IncludeStacktrace include = getErrorProperties().getIncludeStacktrace(); if (include == IncludeStacktrace.ALWAYS) { return true; } if (include == IncludeStacktrace.ON_TRACE_PARAM) { return getTraceParameter(request); } return false; }
Determine if the stacktrace attribute should be included. @param request the source request @param produces the media type produced (or {@code MediaType.ALL}) @return if the stacktrace attribute should be included
private void resolveName(ConfigurationMetadataItem item) { item.setName(item.getId()); // fallback ConfigurationMetadataSource source = getSource(item); if (source != null) { String groupId = source.getGroupId(); String dottedPrefix = groupId + "."; String id = item.getId(); if (hasLength(groupId) && id.startsWith(dottedPrefix)) { String name = id.substring(dottedPrefix.length()); item.setName(name); } } }
Resolve the name of an item against this instance. @param item the item to resolve @see ConfigurationMetadataProperty#setName(String)
public void updateAndRestart(ClassLoaderFiles files) { Set<URL> urls = new LinkedHashSet<>(); Set<URL> classLoaderUrls = getClassLoaderUrls(); for (SourceFolder folder : files.getSourceFolders()) { for (Entry<String, ClassLoaderFile> entry : folder.getFilesEntrySet()) { for (URL url : classLoaderUrls) { if (updateFileSystem(url, entry.getKey(), entry.getValue())) { urls.add(url); } } } urls.addAll(getMatchingUrls(classLoaderUrls, folder.getName())); } updateTimeStamp(urls); restart(urls, files); }
Update the current running application with the specified {@link ClassLoaderFiles} and trigger a reload. @param files updated class loader files
protected void restart(Set<URL> urls, ClassLoaderFiles files) { Restarter restarter = Restarter.getInstance(); restarter.addUrls(urls); restarter.addClassLoaderFiles(files); restarter.restart(); }
Called to restart the application. @param urls the updated URLs @param files the updated files
public HazelcastInstance getHazelcastInstance() { if (StringUtils.hasText(this.clientConfig.getInstanceName())) { return HazelcastClient .getHazelcastClientByName(this.clientConfig.getInstanceName()); } return HazelcastClient.newHazelcastClient(this.clientConfig); }
Get the {@link HazelcastInstance}. @return the {@link HazelcastInstance}
public final void load(Class<?> relativeClass, String... resourceNames) { Resource[] resources = new Resource[resourceNames.length]; for (int i = 0; i < resourceNames.length; i++) { resources[i] = new ClassPathResource(resourceNames[i], relativeClass); } this.reader.loadBeanDefinitions(resources); }
Load bean definitions from the given XML resources. @param relativeClass class whose package will be used as a prefix when loading each specified resource name @param resourceNames relatively-qualified names of resources to load
public JSONArray put(int index, Object value) throws JSONException { if (value instanceof Number) { // deviate from the original by checking all Numbers, not just floats & // doubles JSON.checkDouble(((Number) value).doubleValue()); } while (this.values.size() <= index) { this.values.add(null); } this.values.set(index, value); return this; }
Sets the value at {@code index} to {@code value}, null padding this array to the required length if necessary. If a value already exists at {@code index}, it will be replaced. @param index the index to set the value to @param value a {@link JSONObject}, {@link JSONArray}, String, Boolean, Integer, Long, Double, {@link JSONObject#NULL}, or {@code null}. May not be {@link Double#isNaN() NaNs} or {@link Double#isInfinite() infinities}. @return this array. @throws JSONException if processing of json failed
public boolean isNull(int index) { Object value = opt(index); return value == null || value == JSONObject.NULL; }
Returns true if this array has no value at {@code index}, or if its value is the {@code null} reference or {@link JSONObject#NULL}. @param index the index to set the value to @return true if this array has no value at {@code index}
public boolean getBoolean(int index) throws JSONException { Object object = get(index); Boolean result = JSON.toBoolean(object); if (result == null) { throw JSON.typeMismatch(index, object, "boolean"); } return result; }
Returns the value at {@code index} if it exists and is a boolean or can be coerced to a boolean. @param index the index to get the value from @return the value at {@code index} @throws JSONException if the value at {@code index} doesn't exist or cannot be coerced to a boolean.
public boolean optBoolean(int index, boolean fallback) { Object object = opt(index); Boolean result = JSON.toBoolean(object); return result != null ? result : fallback; }
Returns the value at {@code index} if it exists and is a boolean or can be coerced to a boolean. Returns {@code fallback} otherwise. @param index the index to get the value from @param fallback the fallback value @return the value at {@code index} of {@code fallback}
public double getDouble(int index) throws JSONException { Object object = get(index); Double result = JSON.toDouble(object); if (result == null) { throw JSON.typeMismatch(index, object, "double"); } return result; }
Returns the value at {@code index} if it exists and is a double or can be coerced to a double. @param index the index to get the value from @return the {@code value} @throws JSONException if the value at {@code index} doesn't exist or cannot be coerced to a double.
public double optDouble(int index, double fallback) { Object object = opt(index); Double result = JSON.toDouble(object); return result != null ? result : fallback; }
Returns the value at {@code index} if it exists and is a double or can be coerced to a double. Returns {@code fallback} otherwise. @param index the index to get the value from @param fallback the fallback value @return the value at {@code index} of {@code fallback}
public int getInt(int index) throws JSONException { Object object = get(index); Integer result = JSON.toInteger(object); if (result == null) { throw JSON.typeMismatch(index, object, "int"); } return result; }
Returns the value at {@code index} if it exists and is an int or can be coerced to an int. @param index the index to get the value from @return the {@code value} @throws JSONException if the value at {@code index} doesn't exist or cannot be coerced to an int.
public int optInt(int index, int fallback) { Object object = opt(index); Integer result = JSON.toInteger(object); return result != null ? result : fallback; }
Returns the value at {@code index} if it exists and is an int or can be coerced to an int. Returns {@code fallback} otherwise. @param index the index to get the value from @param fallback the fallback value @return the value at {@code index} of {@code fallback}
public long getLong(int index) throws JSONException { Object object = get(index); Long result = JSON.toLong(object); if (result == null) { throw JSON.typeMismatch(index, object, "long"); } return result; }
Returns the value at {@code index} if it exists and is a long or can be coerced to a long. @param index the index to get the value from @return the {@code value} @throws JSONException if the value at {@code index} doesn't exist or cannot be coerced to a long.
public long optLong(int index, long fallback) { Object object = opt(index); Long result = JSON.toLong(object); return result != null ? result : fallback; }
Returns the value at {@code index} if it exists and is a long or can be coerced to a long. Returns {@code fallback} otherwise. @param index the index to get the value from @param fallback the fallback value @return the value at {@code index} of {@code fallback}
public JSONArray getJSONArray(int index) throws JSONException { Object object = get(index); if (object instanceof JSONArray) { return (JSONArray) object; } else { throw JSON.typeMismatch(index, object, "JSONArray"); } }
Returns the value at {@code index} if it exists and is a {@code JSONArray}. @param index the index to get the value from @return the array at {@code index} @throws JSONException if the value doesn't exist or is not a {@code JSONArray}.
public JSONArray optJSONArray(int index) { Object object = opt(index); return object instanceof JSONArray ? (JSONArray) object : null; }
Returns the value at {@code index} if it exists and is a {@code JSONArray}. Returns null otherwise. @param index the index to get the value from @return the array at {@code index} or {@code null}
public JSONObject getJSONObject(int index) throws JSONException { Object object = get(index); if (object instanceof JSONObject) { return (JSONObject) object; } else { throw JSON.typeMismatch(index, object, "JSONObject"); } }
Returns the value at {@code index} if it exists and is a {@code JSONObject}. @param index the index to get the value from @return the object at {@code index} @throws JSONException if the value doesn't exist or is not a {@code JSONObject}.
public JSONObject optJSONObject(int index) { Object object = opt(index); return object instanceof JSONObject ? (JSONObject) object : null; }
Returns the value at {@code index} if it exists and is a {@code JSONObject}. Returns null otherwise. @param index the index to get the value from @return the object at {@code index} or {@code null}
public void ifBound(Consumer<? super T> consumer) { Assert.notNull(consumer, "Consumer must not be null"); if (this.value != null) { consumer.accept(this.value); } }
Invoke the specified consumer with the bound value, or do nothing if no value has been bound. @param consumer block to execute if a value has been bound
public <U> BindResult<U> map(Function<? super T, ? extends U> mapper) { Assert.notNull(mapper, "Mapper must not be null"); return of((this.value != null) ? mapper.apply(this.value) : null); }
Apply the provided mapping function to the bound value, or return an updated unbound result if no value has been bound. @param <U> the type of the result of the mapping function @param mapper a mapping function to apply to the bound value. The mapper will not be invoked if no value has been bound. @return an {@code BindResult} describing the result of applying a mapping function to the value of this {@code BindResult}.
public T orElseCreate(Class<? extends T> type) { Assert.notNull(type, "Type must not be null"); return (this.value != null) ? this.value : BeanUtils.instantiateClass(type); }
Return the object that was bound, or a new instance of the specified class if no value has been bound. @param type the type to create if no value was bound @return the value, if bound, otherwise a new instance of {@code type}
private long decodeMsDosFormatDateTime(long datetime) { LocalDateTime localDateTime = LocalDateTime.of( (int) (((datetime >> 25) & 0x7f) + 1980), (int) ((datetime >> 21) & 0x0f), (int) ((datetime >> 16) & 0x1f), (int) ((datetime >> 11) & 0x1f), (int) ((datetime >> 5) & 0x3f), (int) ((datetime << 1) & 0x3e)); return localDateTime.toEpochSecond( ZoneId.systemDefault().getRules().getOffset(localDateTime)) * 1000; }
Decode MS-DOS Date Time details. See <a href= "https://docs.microsoft.com/en-gb/windows/desktop/api/winbase/nf-winbase-dosdatetimetofiletime"> Microsoft's documentation</a> for more details of the format. @param datetime the date and time @return the date and time as milliseconds since the epoch
protected void launch(String[] args) throws Exception { JarFile.registerUrlProtocolHandler(); ClassLoader classLoader = createClassLoader(getClassPathArchives()); launch(args, getMainClass(), classLoader); }
Launch the application. This method is the initial entry point that should be called by a subclass {@code public static void main(String[] args)} method. @param args the incoming arguments @throws Exception if the application fails to launch
protected ClassLoader createClassLoader(List<Archive> archives) throws Exception { List<URL> urls = new ArrayList<>(archives.size()); for (Archive archive : archives) { urls.add(archive.getUrl()); } return createClassLoader(urls.toArray(new URL[0])); }
Create a classloader for the specified archives. @param archives the archives @return the classloader @throws Exception if the classloader cannot be created
protected MainMethodRunner createMainMethodRunner(String mainClass, String[] args, ClassLoader classLoader) { return new MainMethodRunner(mainClass, args); }
Create the {@code MainMethodRunner} used to launch the application. @param mainClass the main class @param args the incoming arguments @param classLoader the classloader @return the main method runner
public static <T> T unwrap(DataSource dataSource, Class<T> target) { if (target.isInstance(dataSource)) { return target.cast(dataSource); } T unwrapped = safeUnwrap(dataSource, target); if (unwrapped != null) { return unwrapped; } if (DELEGATING_DATA_SOURCE_PRESENT) { DataSource targetDataSource = DelegatingDataSourceUnwrapper .getTargetDataSource(dataSource); if (targetDataSource != null) { return unwrap(targetDataSource, target); } } if (AopUtils.isAopProxy(dataSource)) { Object proxyTarget = AopProxyUtils.getSingletonTarget(dataSource); if (proxyTarget instanceof DataSource) { return unwrap((DataSource) proxyTarget, target); } } return null; }
Return an object that implements the given {@code target} type, unwrapping delegate or proxy if necessary. @param dataSource the datasource to handle @param target the type that the result must implement @param <T> the target type @return an object that implements the target type or {@code null}
protected void configureSsl(AbstractHttp11JsseProtocol<?> protocol, Ssl ssl, SslStoreProvider sslStoreProvider) { protocol.setSSLEnabled(true); protocol.setSslProtocol(ssl.getProtocol()); configureSslClientAuth(protocol, ssl); protocol.setKeystorePass(ssl.getKeyStorePassword()); protocol.setKeyPass(ssl.getKeyPassword()); protocol.setKeyAlias(ssl.getKeyAlias()); String ciphers = StringUtils.arrayToCommaDelimitedString(ssl.getCiphers()); if (StringUtils.hasText(ciphers)) { protocol.setCiphers(ciphers); } if (ssl.getEnabledProtocols() != null) { for (SSLHostConfig sslHostConfig : protocol.findSslHostConfigs()) { sslHostConfig.setProtocols(StringUtils .arrayToCommaDelimitedString(ssl.getEnabledProtocols())); } } if (sslStoreProvider != null) { configureSslStoreProvider(protocol, sslStoreProvider); } else { configureSslKeyStore(protocol, ssl); configureSslTrustStore(protocol, ssl); } }
Configure Tomcat's {@link AbstractHttp11JsseProtocol} for SSL. @param protocol the protocol @param ssl the ssl details @param sslStoreProvider the ssl store provider
public static String toDashedForm(String name, int start) { StringBuilder result = new StringBuilder(); String replaced = name.replace('_', '-'); for (int i = start; i < replaced.length(); i++) { char ch = replaced.charAt(i); if (Character.isUpperCase(ch) && result.length() > 0 && result.charAt(result.length() - 1) != '-') { result.append('-'); } result.append(Character.toLowerCase(ch)); } return result.toString(); }
Return the specified Java Bean property name in dashed form. @param name the source name @param start the starting char @return the dashed from
public void replayTo(Log destination) { synchronized (this.lines) { for (Line line : this.lines) { logTo(destination, line.getLevel(), line.getMessage(), line.getThrowable()); } this.lines.clear(); } }
Replay deferred logging to the specified destination. @param destination the destination for the deferred log messages
public static Log replay(Log source, Class<?> destination) { return replay(source, LogFactory.getLog(destination)); }
Replay from a source log to a destination log when the source is deferred. @param source the source logger @param destination the destination logger class @return the destination
public static Log replay(Log source, Log destination) { if (source instanceof DeferredLog) { ((DeferredLog) source).replayTo(destination); } return destination; }
Replay from a source log to a destination log when the source is deferred. @param source the source logger @param destination the destination logger @return the destination
public MongoClient createMongoClient(MongoClientSettings settings) { Integer embeddedPort = getEmbeddedPort(); if (embeddedPort != null) { return createEmbeddedMongoClient(settings, embeddedPort); } return createNetworkMongoClient(settings); }
Creates a {@link MongoClient} using the given {@code settings}. If the environment contains a {@code local.mongo.port} property, it is used to configure a client to an embedded MongoDB instance. @param settings the settings @return the Mongo client
public static ColorConverter newInstance(Configuration config, String[] options) { if (options.length < 1) { LOGGER.error("Incorrect number of options on style. " + "Expected at least 1, received {}", options.length); return null; } if (options[0] == null) { LOGGER.error("No pattern supplied on style"); return null; } PatternParser parser = PatternLayout.createPatternParser(config); List<PatternFormatter> formatters = parser.parse(options[0]); AnsiElement element = (options.length != 1) ? ELEMENTS.get(options[1]) : null; return new ColorConverter(formatters, element); }
Creates a new instance of the class. Required by Log4J2. @param config the configuration @param options the options @return a new instance, or {@code null} if the options are invalid
public void run() throws Exception { if (this.header.contains("Upgrade: websocket") && this.header.contains("Sec-WebSocket-Version: 13")) { runWebSocket(); } if (this.header.contains("GET /livereload.js")) { this.outputStream.writeHttp(getClass().getResourceAsStream("livereload.js"), "text/javascript"); } }
Run the connection. @throws Exception in case of errors
@Deprecated public Database determineDatabase(DataSource dataSource) { if (this.database != null) { return this.database; } return DatabaseLookup.getDatabase(dataSource); }
Determine the {@link Database} to use based on this configuration and the primary {@link DataSource}. @param dataSource the auto-configured data source @return {@code Database} @deprecated since 2.2.0 in favor of letting the JPA container detect the database to use.
@SuppressWarnings("unchecked") public final Object bind(ConfigurationPropertyName name, Bindable<?> target, AggregateElementBinder elementBinder) { Object result = bindAggregate(name, target, elementBinder); Supplier<?> value = target.getValue(); if (result == null || value == null) { return result; } return merge((Supplier<T>) value, (T) result); }
Perform binding for the aggregate. @param name the configuration property name to bind @param target the target to bind @param elementBinder an element binder @return the bound aggregate or null
public static String getProperty(String key, String defaultValue, String text) { try { String propVal = System.getProperty(key); if (propVal == null) { // Fall back to searching the system environment. propVal = System.getenv(key); } if (propVal == null) { // Try with underscores. String name = key.replace('.', '_'); propVal = System.getenv(name); } if (propVal == null) { // Try uppercase with underscores as well. String name = key.toUpperCase(Locale.ENGLISH).replace('.', '_'); propVal = System.getenv(name); } if (propVal != null) { return propVal; } } catch (Throwable ex) { System.err.println("Could not resolve key '" + key + "' in '" + text + "' as system property or in environment: " + ex); } return defaultValue; }
Search the System properties and environment variables for a value with the provided key. Environment variables in {@code UPPER_CASE} style are allowed where System properties would normally be {@code lower.case}. @param key the key to resolve @param defaultValue the default value @param text optional extra context for an error message if the key resolution fails (e.g. if System properties are not accessible) @return a static property value or null of not found
protected void configureContext(Context context) { this.contextLifecycleListeners.forEach(context::addLifecycleListener); new DisableReferenceClearingContextCustomizer().customize(context); this.tomcatContextCustomizers .forEach((customizer) -> customizer.customize(context)); }
Configure the Tomcat {@link Context}. @param context the Tomcat context
public void setTomcatContextCustomizers( Collection<? extends TomcatContextCustomizer> tomcatContextCustomizers) { Assert.notNull(tomcatContextCustomizers, "TomcatContextCustomizers must not be null"); this.tomcatContextCustomizers = new ArrayList<>(tomcatContextCustomizers); }
Set {@link TomcatContextCustomizer}s that should be applied to the Tomcat {@link Context}. Calling this method will replace any existing customizers. @param tomcatContextCustomizers the customizers to set
@Override public void addContextCustomizers( TomcatContextCustomizer... tomcatContextCustomizers) { Assert.notNull(tomcatContextCustomizers, "TomcatContextCustomizers must not be null"); this.tomcatContextCustomizers.addAll(Arrays.asList(tomcatContextCustomizers)); }
Add {@link TomcatContextCustomizer}s that should be added to the Tomcat {@link Context}. @param tomcatContextCustomizers the customizers to add
public void setTomcatConnectorCustomizers( Collection<? extends TomcatConnectorCustomizer> tomcatConnectorCustomizers) { Assert.notNull(tomcatConnectorCustomizers, "TomcatConnectorCustomizers must not be null"); this.tomcatConnectorCustomizers = new ArrayList<>(tomcatConnectorCustomizers); }
Set {@link TomcatConnectorCustomizer}s that should be applied to the Tomcat {@link Connector}. Calling this method will replace any existing customizers. @param tomcatConnectorCustomizers the customizers to set
@Override public void addConnectorCustomizers( TomcatConnectorCustomizer... tomcatConnectorCustomizers) { Assert.notNull(tomcatConnectorCustomizers, "TomcatConnectorCustomizers must not be null"); this.tomcatConnectorCustomizers.addAll(Arrays.asList(tomcatConnectorCustomizers)); }
Add {@link TomcatConnectorCustomizer}s that should be added to the Tomcat {@link Connector}. @param tomcatConnectorCustomizers the customizers to add
public void setTomcatProtocolHandlerCustomizers( Collection<? extends TomcatProtocolHandlerCustomizer<?>> tomcatProtocolHandlerCustomizers) { Assert.notNull(tomcatProtocolHandlerCustomizers, "TomcatProtocolHandlerCustomizers must not be null"); this.tomcatProtocolHandlerCustomizers = new ArrayList<>( tomcatProtocolHandlerCustomizers); }
Set {@link TomcatProtocolHandlerCustomizer}s that should be applied to the Tomcat {@link Connector}. Calling this method will replace any existing customizers. @param tomcatProtocolHandlerCustomizers the customizers to set @since 2.2.0
@Override public void addProtocolHandlerCustomizers( TomcatProtocolHandlerCustomizer<?>... tomcatProtocolHandlerCustomizers) { Assert.notNull(tomcatProtocolHandlerCustomizers, "TomcatProtocolHandlerCustomizers must not be null"); this.tomcatProtocolHandlerCustomizers .addAll(Arrays.asList(tomcatProtocolHandlerCustomizers)); }
Add {@link TomcatProtocolHandlerCustomizer}s that should be added to the Tomcat {@link Connector}. @param tomcatProtocolHandlerCustomizers the customizers to add @since 2.2.0
public void setContextLifecycleListeners( Collection<? extends LifecycleListener> contextLifecycleListeners) { Assert.notNull(contextLifecycleListeners, "ContextLifecycleListeners must not be null"); this.contextLifecycleListeners = new ArrayList<>(contextLifecycleListeners); }
Set {@link LifecycleListener}s that should be applied to the Tomcat {@link Context}. Calling this method will replace any existing listeners. @param contextLifecycleListeners the listeners to set
public void addContextLifecycleListeners( LifecycleListener... contextLifecycleListeners) { Assert.notNull(contextLifecycleListeners, "ContextLifecycleListeners must not be null"); this.contextLifecycleListeners.addAll(Arrays.asList(contextLifecycleListeners)); }
Add {@link LifecycleListener}s that should be added to the Tomcat {@link Context}. @param contextLifecycleListeners the listeners to add
protected void addPropertySources(ConfigurableEnvironment environment, ResourceLoader resourceLoader) { RandomValuePropertySource.addToEnvironment(environment); new Loader(environment, resourceLoader).load(); }
Add config file property sources to the specified environment. @param environment the environment to add source to @param resourceLoader the resource loader @see #addPostProcessors(ConfigurableApplicationContext)
protected void handleSigInt() { if (this.commandRunner.handleSigInt()) { return; } System.out.println(String.format("%nThanks for using Spring Boot")); System.exit(1); }
Final handle an interrupt signal (CTRL-C).
public void setStatusMapping(Map<String, Integer> statusMapping) { Assert.notNull(statusMapping, "StatusMapping must not be null"); this.statusMapping = new HashMap<>(statusMapping); }
Set specific status mappings. @param statusMapping a map of health status code to HTTP status code
public void addStatusMapping(Map<String, Integer> statusMapping) { Assert.notNull(statusMapping, "StatusMapping must not be null"); this.statusMapping.putAll(statusMapping); }
Add specific status mappings to the existing set. @param statusMapping a map of health status code to HTTP status code
public void addStatusMapping(Status status, Integer httpStatus) { Assert.notNull(status, "Status must not be null"); Assert.notNull(httpStatus, "HttpStatus must not be null"); addStatusMapping(status.getCode(), httpStatus); }
Add a status mapping to the existing set. @param status the status to map @param httpStatus the http status
public void addStatusMapping(String statusCode, Integer httpStatus) { Assert.notNull(statusCode, "StatusCode must not be null"); Assert.notNull(httpStatus, "HttpStatus must not be null"); this.statusMapping.put(statusCode, httpStatus); }
Add a status mapping to the existing set. @param statusCode the status code to map @param httpStatus the http status
public int mapStatus(Status status) { String code = getUniformValue(status.getCode()); if (code != null) { return this.statusMapping.entrySet().stream() .filter((entry) -> code.equals(getUniformValue(entry.getKey()))) .map(Map.Entry::getValue).findFirst() .orElse(WebEndpointResponse.STATUS_OK); } return WebEndpointResponse.STATUS_OK; }
Map the specified {@link Status} to an HTTP status code. @param status the health {@link Status} @return the corresponding HTTP status code
public <T> Source<T> from(Supplier<T> supplier) { Assert.notNull(supplier, "Supplier must not be null"); Source<T> source = getSource(supplier); if (this.sourceOperator != null) { source = this.sourceOperator.apply(source); } return source; }
Return a new {@link Source} from the specified value supplier that can be used to perform the mapping. @param <T> the source type @param supplier the value supplier @return a {@link Source} that can be used to complete the mapping @see #from(Object)
public String getRelativeName() { File folder = this.sourceFolder.getAbsoluteFile(); File file = this.file.getAbsoluteFile(); String folderName = StringUtils.cleanPath(folder.getPath()); String fileName = StringUtils.cleanPath(file.getPath()); Assert.state(fileName.startsWith(folderName), () -> "The file " + fileName + " is not contained in the source folder " + folderName); return fileName.substring(folderName.length() + 1); }
Return the name of the file relative to the source folder. @return the relative name
@Override protected void postProcessContent(Map<String, Object> content) { replaceValue(getNestedMap(content, "commit"), "time", getProperties().getCommitTime()); replaceValue(getNestedMap(content, "build"), "time", getProperties().getInstant("build.time")); }
Post-process the content to expose. By default, well known keys representing dates are converted to {@link Instant} instances. @param content the content to expose
AnsiString append(String text, Code... codes) { if (codes.length == 0 || !isAnsiSupported()) { this.value.append(text); return this; } Ansi ansi = Ansi.ansi(); for (Code code : codes) { ansi = applyCode(ansi, code); } this.value.append(ansi.a(text).reset().toString()); return this; }
Append text with the given ANSI codes. @param text the text to append @param codes the ANSI codes @return this string
protected void logDisabledFork() { if (getLog().isWarnEnabled()) { if (hasAgent()) { getLog().warn("Fork mode disabled, ignoring agent"); } if (hasJvmArgs()) { RunArguments runArguments = resolveJvmArguments(); getLog().warn("Fork mode disabled, ignoring JVM argument(s) [" + Arrays .stream(runArguments.asArray()).collect(Collectors.joining(" ")) + "]"); } if (hasWorkingDirectorySet()) { getLog().warn( "Fork mode disabled, ignoring working directory configuration"); } } }
Log a warning indicating that fork mode has been explicitly disabled while some conditions are present that require to enable it. @see #enableForkByDefault()
protected RunArguments resolveJvmArguments() { StringBuilder stringBuilder = new StringBuilder(); if (this.systemPropertyVariables != null) { stringBuilder.append(this.systemPropertyVariables.entrySet().stream() .map((e) -> SystemPropertyFormatter.format(e.getKey(), e.getValue())) .collect(Collectors.joining(" "))); } if (this.jvmArguments != null) { stringBuilder.append(" ").append(this.jvmArguments); } return new RunArguments(stringBuilder.toString()); }
Resolve the JVM arguments to use. @return a {@link RunArguments} defining the JVM arguments
protected ConditionOutcome getResourceOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) { List<String> found = new ArrayList<>(); for (String location : this.resourceLocations) { Resource resource = context.getResourceLoader().getResource(location); if (resource != null && resource.exists()) { found.add(location); } } if (found.isEmpty()) { ConditionMessage message = startConditionMessage() .didNotFind("resource", "resources") .items(Style.QUOTE, Arrays.asList(this.resourceLocations)); return ConditionOutcome.noMatch(message); } ConditionMessage message = startConditionMessage().found("resource", "resources") .items(Style.QUOTE, found); return ConditionOutcome.match(message); }
Check if one of the default resource locations actually exists. @param context the condition context @param metadata the annotation metadata @return the condition outcome
public WebServiceTemplateBuilder messageSenders( WebServiceMessageSender... messageSenders) { Assert.notNull(messageSenders, "MessageSenders must not be null"); return messageSenders(Arrays.asList(messageSenders)); }
Sets the {@link WebServiceMessageSender WebServiceMessageSenders} that should be used with the {@link WebServiceTemplate}. Setting this value will replace any previously defined message senders, including the HTTP-based message sender, if any. Consider using {@link #additionalMessageSenders(WebServiceMessageSender...)} to keep it with user-defined message senders. @param messageSenders the message senders to set @return a new builder instance. @see #additionalMessageSenders(WebServiceMessageSender...) @see #detectHttpMessageSender(boolean)
public WebServiceTemplateBuilder messageSenders( Collection<? extends WebServiceMessageSender> messageSenders) { Assert.notNull(messageSenders, "MessageSenders must not be null"); return new WebServiceTemplateBuilder(this.detectHttpMessageSender, this.interceptors, this.internalCustomizers, this.customizers, this.messageSenders.set(messageSenders), this.marshaller, this.unmarshaller, this.destinationProvider, this.transformerFactoryClass, this.messageFactory); }
Sets the {@link WebServiceMessageSender WebServiceMessageSenders} that should be used with the {@link WebServiceTemplate}. Setting this value will replace any previously defined message senders, including the HTTP-based message sender, if any. Consider using {@link #additionalMessageSenders(Collection)} to keep it with user-defined message senders. @param messageSenders the message senders to set @return a new builder instance. @see #additionalMessageSenders(Collection) @see #detectHttpMessageSender(boolean)
public WebServiceTemplateBuilder additionalMessageSenders( WebServiceMessageSender... messageSenders) { Assert.notNull(messageSenders, "MessageSenders must not be null"); return additionalMessageSenders(Arrays.asList(messageSenders)); }
Add additional {@link WebServiceMessageSender WebServiceMessageSenders} that should be used with the {@link WebServiceTemplate}. @param messageSenders the message senders to add @return a new builder instance. @see #messageSenders(WebServiceMessageSender...)
public WebServiceTemplateBuilder interceptors(ClientInterceptor... interceptors) { Assert.notNull(interceptors, "Interceptors must not be null"); return interceptors(Arrays.asList(interceptors)); }
Set the {@link ClientInterceptor ClientInterceptors} that should be used with the {@link WebServiceTemplate}. Setting this value will replace any previously defined interceptors. @param interceptors the interceptors to set @return a new builder instance @see #additionalInterceptors(ClientInterceptor...)
public WebServiceTemplateBuilder interceptors( Collection<? extends ClientInterceptor> interceptors) { Assert.notNull(interceptors, "Interceptors must not be null"); return new WebServiceTemplateBuilder(this.detectHttpMessageSender, append(Collections.<ClientInterceptor>emptySet(), interceptors), this.internalCustomizers, this.customizers, this.messageSenders, this.marshaller, this.unmarshaller, this.destinationProvider, this.transformerFactoryClass, this.messageFactory); }
Set the {@link ClientInterceptor ClientInterceptors} that should be used with the {@link WebServiceTemplate}. Setting this value will replace any previously defined interceptors. @param interceptors the interceptors to set @return a new builder instance @see #additionalInterceptors(Collection)
public WebServiceTemplateBuilder additionalInterceptors( ClientInterceptor... interceptors) { Assert.notNull(interceptors, "Interceptors must not be null"); return additionalInterceptors(Arrays.asList(interceptors)); }
Add additional {@link ClientInterceptor ClientInterceptors} that should be used with the {@link WebServiceTemplate}. @param interceptors the interceptors to add @return a new builder instance @see #interceptors(ClientInterceptor...)
public WebServiceTemplateBuilder customizers( WebServiceTemplateCustomizer... customizers) { Assert.notNull(customizers, "Customizers must not be null"); return customizers(Arrays.asList(customizers)); }
Set {@link WebServiceTemplateCustomizer WebServiceTemplateCustomizers} that should be applied to the {@link WebServiceTemplate}. Customizers are applied in the order that they were added after builder configuration has been applied. Setting this value will replace any previously configured customizers. @param customizers the customizers to set @return a new builder instance @see #additionalCustomizers(WebServiceTemplateCustomizer...)
public WebServiceTemplateBuilder customizers( Collection<? extends WebServiceTemplateCustomizer> customizers) { Assert.notNull(customizers, "Customizers must not be null"); return new WebServiceTemplateBuilder(this.detectHttpMessageSender, this.interceptors, this.internalCustomizers, append(Collections.<WebServiceTemplateCustomizer>emptySet(), customizers), this.messageSenders, this.marshaller, this.unmarshaller, this.destinationProvider, this.transformerFactoryClass, this.messageFactory); }
Set {@link WebServiceTemplateCustomizer WebServiceTemplateCustomizers} that should be applied to the {@link WebServiceTemplate}. Customizers are applied in the order that they were added after builder configuration has been applied. Setting this value will replace any previously configured customizers. @param customizers the customizers to set @return a new builder instance @see #additionalCustomizers(Collection)
public WebServiceTemplateBuilder additionalCustomizers( WebServiceTemplateCustomizer... customizers) { Assert.notNull(customizers, "Customizers must not be null"); return additionalCustomizers(Arrays.asList(customizers)); }
Add additional {@link WebServiceTemplateCustomizer WebServiceTemplateCustomizers} that should be applied to the {@link WebServiceTemplate}. Customizers are applied in the order that they were added after builder configuration has been applied. @param customizers the customizers to add @return a new builder instance @see #customizers(WebServiceTemplateCustomizer...)
public WebServiceTemplateBuilder setCheckConnectionForFault( boolean checkConnectionForFault) { return new WebServiceTemplateBuilder(this.detectHttpMessageSender, this.interceptors, append(this.internalCustomizers, new CheckConnectionFaultCustomizer(checkConnectionForFault)), this.customizers, this.messageSenders, this.marshaller, this.unmarshaller, this.destinationProvider, this.transformerFactoryClass, this.messageFactory); }
Indicates whether the connection should be checked for fault indicators ({@code true}), or whether we should rely on the message only ({@code false}). @param checkConnectionForFault whether to check for fault indicators @return a new builder instance. @see WebServiceTemplate#setCheckConnectionForFault(boolean)
public WebServiceTemplateBuilder setCheckConnectionForError( boolean checkConnectionForError) { return new WebServiceTemplateBuilder(this.detectHttpMessageSender, this.interceptors, append(this.internalCustomizers, new CheckConnectionForErrorCustomizer(checkConnectionForError)), this.customizers, this.messageSenders, this.marshaller, this.unmarshaller, this.destinationProvider, this.transformerFactoryClass, this.messageFactory); }
Indicates whether the connection should be checked for error indicators ({@code true}), or whether these should be ignored ({@code false}). @param checkConnectionForError whether to check for error indicators @return a new builder instance. @see WebServiceTemplate#setCheckConnectionForError(boolean)
public WebServiceTemplateBuilder setWebServiceMessageFactory( WebServiceMessageFactory messageFactory) { Assert.notNull(messageFactory, "MessageFactory must not be null"); return new WebServiceTemplateBuilder(this.detectHttpMessageSender, this.interceptors, this.internalCustomizers, this.customizers, this.messageSenders, this.marshaller, this.unmarshaller, this.destinationProvider, this.transformerFactoryClass, messageFactory); }
Sets the {@link WebServiceMessageFactory} to use for creating messages. @param messageFactory the message factory to use for creating messages @return a new builder instance. @see WebServiceTemplate#setMessageFactory(WebServiceMessageFactory)
public WebServiceTemplateBuilder setMarshaller(Marshaller marshaller) { return new WebServiceTemplateBuilder(this.detectHttpMessageSender, this.interceptors, this.internalCustomizers, this.customizers, this.messageSenders, marshaller, this.unmarshaller, this.destinationProvider, this.transformerFactoryClass, this.messageFactory); }
Set the {@link Marshaller} to use to serialize messages. @param marshaller the message marshaller @return a new builder instance. @see WebServiceTemplate#setMarshaller(Marshaller)