Polishing
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 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.
|
||||
@@ -33,7 +33,7 @@ public class StringLiteral extends Literal {
|
||||
|
||||
|
||||
public StringLiteral(String payload, int pos, String value) {
|
||||
super(payload,pos);
|
||||
super(payload, pos);
|
||||
value = value.substring(1, value.length() - 1);
|
||||
this.value = new TypedValue(value.replaceAll("''", "'").replaceAll("\"\"", "\""));
|
||||
this.exitTypeDescriptor = "Ljava/lang/String";
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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,
|
||||
@@ -63,13 +63,13 @@ public class ServletWebRequest extends ServletRequestAttributes implements Nativ
|
||||
private static final List<String> SAFE_METHODS = Arrays.asList("GET", "HEAD");
|
||||
|
||||
/**
|
||||
* Pattern matching ETag multiple field values in headers such as "If-Match", "If-None-Match"
|
||||
* Pattern matching ETag multiple field values in headers such as "If-Match", "If-None-Match".
|
||||
* @see <a href="https://tools.ietf.org/html/rfc7232#section-2.3">Section 2.3 of RFC 7232</a>
|
||||
*/
|
||||
private static final Pattern ETAG_HEADER_VALUE_PATTERN = Pattern.compile("\\*|\\s*((W\\/)?(\"[^\"]*\"))\\s*,?");
|
||||
|
||||
/**
|
||||
* Date formats as specified in the HTTP RFC
|
||||
* Date formats as specified in the HTTP RFC.
|
||||
* @see <a href="https://tools.ietf.org/html/rfc7231#section-7.1.1.1">Section 7.1.1.1 of RFC 7231</a>
|
||||
*/
|
||||
private static final String[] DATE_FORMATS = new String[] {
|
||||
@@ -233,7 +233,6 @@ public class ServletWebRequest extends ServletRequestAttributes implements Nativ
|
||||
}
|
||||
|
||||
// Update response
|
||||
|
||||
boolean isHttpGetOrHead = SAFE_METHODS.contains(getRequest().getMethod());
|
||||
if (this.notModified) {
|
||||
response.setStatus(isHttpGetOrHead ?
|
||||
|
||||
@@ -330,7 +330,8 @@ public class DefaultHandlerExceptionResolver extends AbstractHandlerExceptionRes
|
||||
/**
|
||||
* Handle the case when a {@link org.springframework.web.bind.WebDataBinder} conversion cannot occur.
|
||||
* <p>The default implementation sends an HTTP 500 error, and returns an empty {@code ModelAndView}.
|
||||
* Alternatively, a fallback view could be chosen, or the TypeMismatchException could be rethrown as-is.
|
||||
* Alternatively, a fallback view could be chosen, or the ConversionNotSupportedException could be
|
||||
* rethrown as-is.
|
||||
* @param ex the ConversionNotSupportedException to be handled
|
||||
* @param request current HTTP request
|
||||
* @param response current HTTP response
|
||||
@@ -367,7 +368,7 @@ public class DefaultHandlerExceptionResolver extends AbstractHandlerExceptionRes
|
||||
* Handle the case where a {@linkplain org.springframework.http.converter.HttpMessageConverter message converter}
|
||||
* cannot read from a HTTP request.
|
||||
* <p>The default implementation sends an HTTP 400 error, and returns an empty {@code ModelAndView}.
|
||||
* Alternatively, a fallback view could be chosen, or the HttpMediaTypeNotSupportedException could be
|
||||
* Alternatively, a fallback view could be chosen, or the HttpMessageNotReadableException could be
|
||||
* rethrown as-is.
|
||||
* @param ex the HttpMessageNotReadableException to be handled
|
||||
* @param request current HTTP request
|
||||
@@ -388,7 +389,7 @@ public class DefaultHandlerExceptionResolver extends AbstractHandlerExceptionRes
|
||||
* {@linkplain org.springframework.http.converter.HttpMessageConverter message converter}
|
||||
* cannot write to a HTTP request.
|
||||
* <p>The default implementation sends an HTTP 500 error, and returns an empty {@code ModelAndView}.
|
||||
* Alternatively, a fallback view could be chosen, or the HttpMediaTypeNotSupportedException could
|
||||
* Alternatively, a fallback view could be chosen, or the HttpMessageNotWritableException could
|
||||
* be rethrown as-is.
|
||||
* @param ex the HttpMessageNotWritableException to be handled
|
||||
* @param request current HTTP request
|
||||
|
||||
@@ -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.
|
||||
@@ -35,8 +35,8 @@ import org.springframework.web.util.TagUtils;
|
||||
import org.springframework.web.util.UriUtils;
|
||||
|
||||
/**
|
||||
* JSP tag for creating URLs. Modeled after the JSTL c:url tag with backwards
|
||||
* compatibility in mind.
|
||||
* The {@code <url>} tag creates URLs. Modeled after the JSTL {@code c:url} tag with
|
||||
* backwards compatibility in mind.
|
||||
*
|
||||
* <p>Enhancements to the JSTL functionality include:
|
||||
* <ul>
|
||||
@@ -65,7 +65,8 @@ import org.springframework.web.util.UriUtils;
|
||||
* <pre class="code"><spring:url value="/url/path/{variableName}">
|
||||
* <spring:param name="variableName" value="more than JSTL c:url" />
|
||||
* </spring:url></pre>
|
||||
* Results in:
|
||||
*
|
||||
* <p>The above results in:
|
||||
* {@code /currentApplicationContext/url/path/more%20than%20JSTL%20c%3Aurl}
|
||||
*
|
||||
* @author Scott Andrews
|
||||
@@ -100,7 +101,7 @@ public class UrlTag extends HtmlEscapingAwareTag implements ParamAware {
|
||||
|
||||
|
||||
/**
|
||||
* Sets the value of the URL
|
||||
* Set the value of the URL.
|
||||
*/
|
||||
public void setValue(String value) {
|
||||
if (value.contains(URL_TYPE_ABSOLUTE)) {
|
||||
@@ -118,7 +119,8 @@ public class UrlTag extends HtmlEscapingAwareTag implements ParamAware {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the context path for the URL. Defaults to the current context
|
||||
* Set the context path for the URL.
|
||||
* Defaults to the current context.
|
||||
*/
|
||||
public void setContext(String context) {
|
||||
if (context.startsWith("/")) {
|
||||
@@ -130,16 +132,16 @@ public class UrlTag extends HtmlEscapingAwareTag implements ParamAware {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the variable name to expose the URL under. Defaults to rendering the
|
||||
* URL to the current JspWriter
|
||||
* Set the variable name to expose the URL under.
|
||||
* Defaults to rendering the URL to the current JspWriter.
|
||||
*/
|
||||
public void setVar(String var) {
|
||||
this.var = var;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the scope to export the URL variable to. This attribute has no
|
||||
* meaning unless var is also defined.
|
||||
* Set the scope to export the URL variable to.
|
||||
* This attribute has no meaning unless {@code var} is also defined.
|
||||
*/
|
||||
public void setScope(String scope) {
|
||||
this.scope = TagUtils.getScope(scope);
|
||||
@@ -179,7 +181,7 @@ public class UrlTag extends HtmlEscapingAwareTag implements ParamAware {
|
||||
if (this.var == null) {
|
||||
// print the url to the writer
|
||||
try {
|
||||
pageContext.getOut().print(url);
|
||||
this.pageContext.getOut().print(url);
|
||||
}
|
||||
catch (IOException ex) {
|
||||
throw new JspException(ex);
|
||||
@@ -187,7 +189,7 @@ public class UrlTag extends HtmlEscapingAwareTag implements ParamAware {
|
||||
}
|
||||
else {
|
||||
// store the url as a variable
|
||||
pageContext.setAttribute(var, url, scope);
|
||||
this.pageContext.setAttribute(this.var, url, this.scope);
|
||||
}
|
||||
return EVAL_PAGE;
|
||||
}
|
||||
@@ -198,8 +200,8 @@ public class UrlTag extends HtmlEscapingAwareTag implements ParamAware {
|
||||
* @return the URL value as a String
|
||||
*/
|
||||
String createUrl() throws JspException {
|
||||
HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
|
||||
HttpServletResponse response = (HttpServletResponse) pageContext.getResponse();
|
||||
HttpServletRequest request = (HttpServletRequest) this.pageContext.getRequest();
|
||||
HttpServletResponse response = (HttpServletResponse) this.pageContext.getResponse();
|
||||
|
||||
StringBuilder url = new StringBuilder();
|
||||
if (this.type == UrlType.CONTEXT_RELATIVE) {
|
||||
@@ -250,7 +252,7 @@ public class UrlTag extends HtmlEscapingAwareTag implements ParamAware {
|
||||
protected String createQueryString(List<Param> params, Set<String> usedParams, boolean includeQueryStringDelimiter)
|
||||
throws JspException {
|
||||
|
||||
String encoding = pageContext.getResponse().getCharacterEncoding();
|
||||
String encoding = this.pageContext.getResponse().getCharacterEncoding();
|
||||
StringBuilder qs = new StringBuilder();
|
||||
for (Param param : params) {
|
||||
if (!usedParams.contains(param.getName()) && StringUtils.hasLength(param.getName())) {
|
||||
@@ -287,7 +289,7 @@ public class UrlTag extends HtmlEscapingAwareTag implements ParamAware {
|
||||
protected String replaceUriTemplateParams(String uri, List<Param> params, Set<String> usedParams)
|
||||
throws JspException {
|
||||
|
||||
String encoding = pageContext.getResponse().getCharacterEncoding();
|
||||
String encoding = this.pageContext.getResponse().getCharacterEncoding();
|
||||
for (Param param : params) {
|
||||
String template = URL_TEMPLATE_DELIMITER_PREFIX + param.getName() + URL_TEMPLATE_DELIMITER_SUFFIX;
|
||||
if (uri.contains(template)) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 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.
|
||||
@@ -26,8 +26,8 @@ import org.springframework.web.util.UriComponentsBuilder;
|
||||
|
||||
/**
|
||||
* Container for the base URL of a SockJS endpoint with additional helper methods
|
||||
* to derive related SockJS URLs as the {@link #getInfoUrl() info} URL and
|
||||
* {@link #getTransportUrl(TransportType) transport} URLs.
|
||||
* to derive related SockJS URLs: specifically, the {@link #getInfoUrl() info}
|
||||
* and {@link #getTransportUrl(TransportType) transport} URLs.
|
||||
*
|
||||
* @author Rossen Stoyanchev
|
||||
* @since 4.1
|
||||
@@ -64,7 +64,7 @@ public class SockJsUrlInfo {
|
||||
|
||||
public String getSessionId() {
|
||||
if (this.sessionId == null) {
|
||||
this.sessionId = getUuid().toString().replace("-","");
|
||||
this.sessionId = getUuid().toString().replace("-", "");
|
||||
}
|
||||
return this.sessionId;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user