Polishing
This commit is contained in:
parent
6d1b8b5a31
commit
c685fd7c23
|
@ -260,8 +260,9 @@ public class DataBinder implements PropertyEditorRegistry, TypeConverter {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create the {@link AbstractPropertyBindingResult} instance using standard JavaBean
|
* Create the {@link AbstractPropertyBindingResult} instance using standard
|
||||||
* property access.
|
* JavaBean property access.
|
||||||
|
* @since 4.2.1
|
||||||
*/
|
*/
|
||||||
protected AbstractPropertyBindingResult createBeanPropertyBindingResult() {
|
protected AbstractPropertyBindingResult createBeanPropertyBindingResult() {
|
||||||
BeanPropertyBindingResult result = new BeanPropertyBindingResult(getTarget(),
|
BeanPropertyBindingResult result = new BeanPropertyBindingResult(getTarget(),
|
||||||
|
@ -285,8 +286,9 @@ public class DataBinder implements PropertyEditorRegistry, TypeConverter {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create the {@link AbstractPropertyBindingResult} instance using direct field
|
* Create the {@link AbstractPropertyBindingResult} instance using direct
|
||||||
* access.
|
* field access.
|
||||||
|
* @since 4.2.1
|
||||||
*/
|
*/
|
||||||
protected AbstractPropertyBindingResult createDirectFieldBindingResult() {
|
protected AbstractPropertyBindingResult createDirectFieldBindingResult() {
|
||||||
DirectFieldBindingResult result = new DirectFieldBindingResult(getTarget(),
|
DirectFieldBindingResult result = new DirectFieldBindingResult(getTarget(),
|
||||||
|
@ -299,7 +301,7 @@ public class DataBinder implements PropertyEditorRegistry, TypeConverter {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the internal BindingResult held by this DataBinder,
|
* Return the internal BindingResult held by this DataBinder,
|
||||||
* as AbstractPropertyBindingResult.
|
* as an AbstractPropertyBindingResult.
|
||||||
*/
|
*/
|
||||||
protected AbstractPropertyBindingResult getInternalBindingResult() {
|
protected AbstractPropertyBindingResult getInternalBindingResult() {
|
||||||
if (this.bindingResult == null) {
|
if (this.bindingResult == null) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2012 the original author or authors.
|
* Copyright 2002-2015 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -30,14 +30,17 @@ public class DefaultDataBinderFactory implements WebDataBinderFactory {
|
||||||
|
|
||||||
private final WebBindingInitializer initializer;
|
private final WebBindingInitializer initializer;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create new instance.
|
* Create a new {@code DefaultDataBinderFactory} instance.
|
||||||
* @param initializer for global data binder intialization, or {@code null}
|
* @param initializer for global data binder initialization
|
||||||
|
* (or {@code null} if none)
|
||||||
*/
|
*/
|
||||||
public DefaultDataBinderFactory(WebBindingInitializer initializer) {
|
public DefaultDataBinderFactory(WebBindingInitializer initializer) {
|
||||||
this.initializer = initializer;
|
this.initializer = initializer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new {@link WebDataBinder} for the given target object and
|
* Create a new {@link WebDataBinder} for the given target object and
|
||||||
* initialize it through a {@link WebBindingInitializer}.
|
* initialize it through a {@link WebBindingInitializer}.
|
||||||
|
@ -46,6 +49,7 @@ public class DefaultDataBinderFactory implements WebDataBinderFactory {
|
||||||
@Override
|
@Override
|
||||||
public final WebDataBinder createBinder(NativeWebRequest webRequest, Object target, String objectName)
|
public final WebDataBinder createBinder(NativeWebRequest webRequest, Object target, String objectName)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
|
|
||||||
WebDataBinder dataBinder = createBinderInstance(target, objectName, webRequest);
|
WebDataBinder dataBinder = createBinderInstance(target, objectName, webRequest);
|
||||||
if (this.initializer != null) {
|
if (this.initializer != null) {
|
||||||
this.initializer.initBinder(dataBinder, webRequest);
|
this.initializer.initBinder(dataBinder, webRequest);
|
||||||
|
@ -64,6 +68,7 @@ public class DefaultDataBinderFactory implements WebDataBinderFactory {
|
||||||
*/
|
*/
|
||||||
protected WebDataBinder createBinderInstance(Object target, String objectName, NativeWebRequest webRequest)
|
protected WebDataBinder createBinderInstance(Object target, String objectName, NativeWebRequest webRequest)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
|
|
||||||
return new WebRequestDataBinder(target, objectName);
|
return new WebRequestDataBinder(target, objectName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2014 the original author or authors.
|
* Copyright 2002-2015 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -338,7 +338,7 @@ public abstract class AbstractView extends WebApplicationObjectSupport implement
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a RequestContext to expose under the specified attribute name.
|
* Create a RequestContext to expose under the specified attribute name.
|
||||||
* <p>Default implementation creates a standard RequestContext instance for the
|
* <p>The default implementation creates a standard RequestContext instance for the
|
||||||
* given request and model. Can be overridden in subclasses for custom instances.
|
* given request and model. Can be overridden in subclasses for custom instances.
|
||||||
* @param request current HTTP request
|
* @param request current HTTP request
|
||||||
* @param model combined output Map (never {@code null}),
|
* @param model combined output Map (never {@code null}),
|
||||||
|
|
|
@ -104,7 +104,7 @@ public class UndertowXhrTransport extends AbstractXhrTransport implements XhrTra
|
||||||
}
|
}
|
||||||
|
|
||||||
public UndertowXhrTransport(OptionMap optionMap) throws IOException {
|
public UndertowXhrTransport(OptionMap optionMap) throws IOException {
|
||||||
Assert.notNull(optionMap, "'optionMap' is required");
|
Assert.notNull(optionMap, "OptionMap is required");
|
||||||
this.httpClient = UndertowClient.getInstance();
|
this.httpClient = UndertowClient.getInstance();
|
||||||
this.optionMap = optionMap;
|
this.optionMap = optionMap;
|
||||||
this.worker = Xnio.getInstance().createWorker(optionMap);
|
this.worker = Xnio.getInstance().createWorker(optionMap);
|
||||||
|
@ -142,12 +142,11 @@ public class UndertowXhrTransport extends AbstractXhrTransport implements XhrTra
|
||||||
final SettableListenableFuture<WebSocketSession> connectFuture) {
|
final SettableListenableFuture<WebSocketSession> connectFuture) {
|
||||||
|
|
||||||
if (logger.isTraceEnabled()) {
|
if (logger.isTraceEnabled()) {
|
||||||
logger.trace("Starting XHR receive request, url=" + url);
|
logger.trace("Starting XHR receive request for " + url);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.httpClient.connect(
|
this.httpClient.connect(
|
||||||
new ClientCallback<ClientConnection>() {
|
new ClientCallback<ClientConnection>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completed(ClientConnection connection) {
|
public void completed(ClientConnection connection) {
|
||||||
ClientRequest request = new ClientRequest().setMethod(Methods.POST).setPath(url.getPath());
|
ClientRequest request = new ClientRequest().setMethod(Methods.POST).setPath(url.getPath());
|
||||||
|
@ -158,7 +157,6 @@ public class UndertowXhrTransport extends AbstractXhrTransport implements XhrTra
|
||||||
connection.sendRequest(request, createReceiveCallback(transportRequest,
|
connection.sendRequest(request, createReceiveCallback(transportRequest,
|
||||||
url, httpHeaders, session, connectFuture));
|
url, httpHeaders, session, connectFuture));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void failed(IOException ex) {
|
public void failed(IOException ex) {
|
||||||
throw new SockJsTransportFailureException("Failed to execute request to " + url, ex);
|
throw new SockJsTransportFailureException("Failed to execute request to " + url, ex);
|
||||||
|
@ -181,11 +179,9 @@ public class UndertowXhrTransport extends AbstractXhrTransport implements XhrTra
|
||||||
final SettableListenableFuture<WebSocketSession> connectFuture) {
|
final SettableListenableFuture<WebSocketSession> connectFuture) {
|
||||||
|
|
||||||
return new ClientCallback<ClientExchange>() {
|
return new ClientCallback<ClientExchange>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completed(final ClientExchange exchange) {
|
public void completed(final ClientExchange exchange) {
|
||||||
exchange.setResponseListener(new ClientCallback<ClientExchange>() {
|
exchange.setResponseListener(new ClientCallback<ClientExchange>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completed(ClientExchange result) {
|
public void completed(ClientExchange result) {
|
||||||
ClientResponse response = result.getResponse();
|
ClientResponse response = result.getResponse();
|
||||||
|
@ -216,7 +212,6 @@ public class UndertowXhrTransport extends AbstractXhrTransport implements XhrTra
|
||||||
onFailure(exc);
|
onFailure(exc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void failed(IOException exc) {
|
public void failed(IOException exc) {
|
||||||
IoUtils.safeClose(exchange.getConnection());
|
IoUtils.safeClose(exchange.getConnection());
|
||||||
|
@ -307,7 +302,6 @@ public class UndertowXhrTransport extends AbstractXhrTransport implements XhrTra
|
||||||
final List<ClientResponse> responses, final CountDownLatch latch) {
|
final List<ClientResponse> responses, final CountDownLatch latch) {
|
||||||
|
|
||||||
return new ClientCallback<ClientExchange>() {
|
return new ClientCallback<ClientExchange>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completed(ClientExchange result) {
|
public void completed(ClientExchange result) {
|
||||||
result.setResponseListener(new ClientCallback<ClientExchange>() {
|
result.setResponseListener(new ClientCallback<ClientExchange>() {
|
||||||
|
|
Loading…
Reference in New Issue