Polishing

This commit is contained in:
Juergen Hoeller
2015-10-07 20:06:18 +02:00
parent 44b76d39a4
commit 15b88782f7
2 changed files with 11 additions and 3 deletions

View File

@@ -71,11 +71,15 @@ import org.springframework.util.ReflectionUtils;
/**
* {@link org.springframework.orm.jpa.JpaDialect} implementation for
* Hibernate EntityManager. Developed against Hibernate 3.6 and 4.2/4.3.
* Hibernate EntityManager. Developed and tested against Hibernate 3.6,
* 4.2/4.3 as well as 5.0.
*
* @author Juergen Hoeller
* @author Costin Leau
* @since 2.0
* @see HibernateJpaVendorAdapter
* @see org.hibernate.Session#setFlushMode
* @see org.hibernate.Transaction#setTimeout
*/
@SuppressWarnings("serial")
public class HibernateJpaDialect extends DefaultJpaDialect {

View File

@@ -346,6 +346,7 @@ public abstract class AbstractSockJsService implements SockJsService, CorsConfig
}
String requestInfo = (logger.isDebugEnabled() ? request.getMethod() + " " + request.getURI() : null);
try {
if (sockJsPath.equals("") || sockJsPath.equals("/")) {
if (requestInfo != null) {
@@ -354,12 +355,14 @@ public abstract class AbstractSockJsService implements SockJsService, CorsConfig
response.getHeaders().setContentType(new MediaType("text", "plain", UTF8_CHARSET));
response.getBody().write("Welcome to SockJS!\n".getBytes(UTF8_CHARSET));
}
else if (sockJsPath.equals("/info")) {
if (requestInfo != null) {
logger.debug("Processing transport request: " + requestInfo);
}
this.infoHandler.handle(request, response);
}
else if (sockJsPath.matches("/iframe[0-9-.a-z_]*.html")) {
if (!this.allowedOrigins.isEmpty() && !this.allowedOrigins.contains("*")) {
if (requestInfo != null) {
@@ -377,6 +380,7 @@ public abstract class AbstractSockJsService implements SockJsService, CorsConfig
}
this.iframeHandler.handle(request, response);
}
else if (sockJsPath.equals("/websocket")) {
if (isWebSocketEnabled()) {
if (requestInfo != null) {
@@ -388,6 +392,7 @@ public abstract class AbstractSockJsService implements SockJsService, CorsConfig
logger.debug("WebSocket disabled. Ignoring transport request: " + requestInfo);
}
}
else {
String[] pathSegments = StringUtils.tokenizeToStringArray(sockJsPath.substring(1), "/");
if (pathSegments.length != 3) {
@@ -469,9 +474,8 @@ public abstract class AbstractSockJsService implements SockJsService, CorsConfig
}
if (!WebUtils.isValidOrigin(request, this.allowedOrigins)) {
String origin = request.getHeaders().getOrigin();
if (logger.isWarnEnabled()) {
logger.warn("Origin header value '" + origin + "' not allowed.");
logger.warn("Origin header value '" + request.getHeaders().getOrigin() + "' not allowed.");
}
response.setStatusCode(HttpStatus.FORBIDDEN);
return false;