Polishing

This commit is contained in:
Juergen Hoeller
2018-06-29 21:21:19 +02:00
parent d5bfddac69
commit fa8acfafbf
10 changed files with 170 additions and 126 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -57,7 +57,7 @@ public class GzipResourceResolver extends AbstractResourceResolver {
}
}
catch (IOException ex) {
logger.trace("No gzipped resource for [" + resource.getFilename() + "]", ex);
logger.trace("No gzip resource for [" + resource.getFilename() + "]", ex);
}
return resource;
@@ -69,8 +69,8 @@ public class GzipResourceResolver extends AbstractResourceResolver {
}
@Override
protected String resolveUrlPathInternal(String resourceUrlPath, List<? extends Resource> locations,
ResourceResolverChain chain) {
protected String resolveUrlPathInternal(String resourceUrlPath,
List<? extends Resource> locations, ResourceResolverChain chain) {
return chain.resolveUrlPath(resourceUrlPath, locations);
}
@@ -87,54 +87,67 @@ public class GzipResourceResolver extends AbstractResourceResolver {
this.gzipped = original.createRelative(original.getFilename() + ".gz");
}
@Override
public InputStream getInputStream() throws IOException {
return this.gzipped.getInputStream();
}
@Override
public boolean exists() {
return this.gzipped.exists();
}
@Override
public boolean isReadable() {
return this.gzipped.isReadable();
}
@Override
public boolean isOpen() {
return this.gzipped.isOpen();
}
@Override
public URL getURL() throws IOException {
return this.gzipped.getURL();
}
@Override
public URI getURI() throws IOException {
return this.gzipped.getURI();
}
@Override
public File getFile() throws IOException {
return this.gzipped.getFile();
}
@Override
public long contentLength() throws IOException {
return this.gzipped.contentLength();
}
@Override
public long lastModified() throws IOException {
return this.gzipped.lastModified();
}
@Override
public Resource createRelative(String relativePath) throws IOException {
return this.gzipped.createRelative(relativePath);
}
@Override
public String getFilename() {
return this.original.getFilename();
}
@Override
public String getDescription() {
return this.gzipped.getDescription();
}
@Override
public String getContentEncoding() {
return "gzip";
}

View File

@@ -5,7 +5,7 @@
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -304,12 +304,12 @@ public class VersionResourceResolver extends AbstractResourceResolver {
@Override
public String getDescription() {
return original.getDescription();
return this.original.getDescription();
}
@Override
public InputStream getInputStream() throws IOException {
return original.getInputStream();
return this.original.getInputStream();
}
@Override

View File

@@ -109,9 +109,9 @@
* spring.status : a BindStatus instance holding the command object name,
* expression, value, and error messages and codes for the path supplied
*
* @param path : the path (string value) of the value required to bind to.
* Spring defaults to a command name of "command" but this can be overridden
* by user config.
* @param path the path (string value) of the value required to bind to.
* Spring defaults to a command name of "command" but this can be
* overridden by user configuration.
-->
<#macro bind path>
<#if htmlEscape?exists>
@@ -152,8 +152,8 @@
* of a command or bean.
*
* @param path the name of the field to bind to
* @param attributes any additional attributes for the element (such as class
* or CSS styles or size
* @param attributes any additional attributes for the element
* (such as class or CSS styles or size)
-->
<#macro formInput path attributes="" fieldType="text">
<@bind path/>
@@ -169,8 +169,8 @@
* of 'password'.
*
* @param path the name of the field to bind to
* @param attributes any additional attributes for the element (such as class
* or CSS styles or size
* @param attributes any additional attributes for the element
* (such as class or CSS styles or size)
-->
<#macro formPasswordInput path attributes="">
<@formInput path, attributes, "password"/>
@@ -184,8 +184,8 @@
* the formInput macro with a 'type' parameter of 'hidden'.
*
* @param path the name of the field to bind to
* @param attributes any additional attributes for the element (such as class
* or CSS styles or size
* @param attributes any additional attributes for the element
* (such as class or CSS styles or size)
-->
<#macro formHiddenInput path attributes="">
<@formInput path, attributes, "hidden"/>
@@ -197,8 +197,8 @@
* Display a text area and bind it to an attribute of a command or bean.
*
* @param path the name of the field to bind to
* @param attributes any additional attributes for the element (such as class
* or CSS styles or size
* @param attributes any additional attributes for the element
* (such as class or CSS styles or size)
-->
<#macro formTextarea path attributes="">
<@bind path/>
@@ -214,8 +214,8 @@ ${stringStatusValue}</textarea>
*
* @param path the name of the field to bind to
* @param options a map (value=label) of all the available options
* @param attributes any additional attributes for the element (such as class
* or CSS styles or size
* @param attributes any additional attributes for the element
* (such as class or CSS styles or size)
-->
<#macro formSingleSelect path options attributes="">
<@bind path/>
@@ -240,8 +240,8 @@ ${stringStatusValue}</textarea>
*
* @param path the name of the field to bind to
* @param options a map (value=label) of all the available options
* @param attributes any additional attributes for the element (such as class
* or CSS styles or size
* @param attributes any additional attributes for the element
* (such as class or CSS styles or size)
-->
<#macro formMultiSelect path options attributes="">
<@bind path/>
@@ -260,10 +260,10 @@ ${stringStatusValue}</textarea>
*
* @param path the name of the field to bind to
* @param options a map (value=label) of all the available options
* @param separator the html tag or other character list that should be used to
* separate each option. Typically '&nbsp;' or '<br>'
* @param attributes any additional attributes for the element (such as class
* or CSS styles or size
* @param separator the HTML tag or other character list that should be used to
* separate each option (typically '&nbsp;' or '<br>')
* @param attributes any additional attributes for the element
* (such as class or CSS styles or size)
-->
<#macro formRadioButtons path options separator attributes="">
<@bind path/>
@@ -281,10 +281,10 @@ ${stringStatusValue}</textarea>
*
* @param path the name of the field to bind to
* @param options a map (value=label) of all the available options
* @param separator the html tag or other character list that should be used to
* separate each option. Typically '&nbsp;' or '<br>'
* @param attributes any additional attributes for the element (such as class
* or CSS styles or size
* @param separator the HTML tag or other character list that should be used to
* separate each option (typically '&nbsp;' or '<br>')
* @param attributes any additional attributes for the element
* (such as class or CSS styles or size)
-->
<#macro formCheckboxes path options separator attributes="">
<@bind path/>
@@ -303,8 +303,8 @@ ${stringStatusValue}</textarea>
* Show a single checkbox.
*
* @param path the name of the field to bind to
* @param attributes any additional attributes for the element (such as class
* or CSS styles or size
* @param attributes any additional attributes for the element
* (such as class or CSS styles or size)
-->
<#macro formCheckbox path attributes="">
<@bind path />
@@ -320,12 +320,12 @@ ${stringStatusValue}</textarea>
* Show validation errors for the currently bound field, with
* optional style attributes.
*
* @param separator the html tag or other character list that should be used to
* separate each option. Typically '<br>'.
* @param separator the HTML tag or other character list that should be used to
* separate each option (typically '&nbsp;' or '<br>')
* @param classOrStyle either the name of a CSS class element (which is defined in
* the template or an external CSS file) or an inline style. If the value passed in here
* contains a colon (:) then a 'style=' attribute will be used, else a 'class=' attribute
* will be used.
* the template or an external CSS file) or an inline style. If the value passed
* in here contains a colon (:) then a 'style=' attribute will be used,
* otherwise a 'class=' attribute will be used.
-->
<#macro showErrors separator classOrStyle="">
<#list status.errorMessages as error>