小编Chr*_*son的帖子

寻找GWT验证示例......你在哪里艺术?

作为后续行为,为什么在CellTable中没有使用CompositeCell的正常例子?

我正在尝试添加JSR-303验证支持.我在这里遵循了Koma的配置建议:如何使用gwt-2.4.0安装gwt-validation(注意:我使用GWT 2.4的内置验证,而不是GWT-Validation).

同样,为了获得一些重用,我制作了一对类,ValidatableInputCellAbstractValidatableColumn.我从以下方面获得灵感:

我们来看看他们......

public class ValidatableInputCell extends AbstractInputCell<String, ValidatableInputCell.ValidationData> {

interface Template extends SafeHtmlTemplates {
    @Template("<input type=\"text\" value=\"{0}\" size=\"{1}\" style=\"{2}\" tabindex=\"-1\"></input>")
    SafeHtml input(String value, String width, SafeStyles color);
}

private static Template template;

/**
 * The error message to be displayed as a pop-up near the field
 */
private String errorMessage;

private static final int DEFAULT_INPUT_SIZE = 15;

/**
 * Specifies the width, in characters, of …
Run Code Online (Sandbox Code Playgroud)

validation gwt celltable

11
推荐指数
1
解决办法
5665
查看次数

maven-exec-plugin没有明显原因抛出异常

我在包含带有a的类的Maven项目的根目录中的Windows shell中键入以下内容

public static void main(String [] args)

我想要运行的方法.

mvn exec:java -Dexec.mainClass ="com.spp.config.main.SqlGeneratorHarness"-e

该类存在并在该包中编译(即target/classes/com/spp/config/main/SqlGeneratorHarness.class).

我知道了...

+ Error stacktraces are turned on.  
[INFO] Scanning for projects...  
[INFO] Searching repository for plugin with prefix: 'exec'.  
[INFO] ------------------------------------------------------------------------  
[ERROR] BUILD FAILURE  
[INFO] ------------------------------------------------------------------------  
[INFO] Invalid task '.mainClass=com.spp.config.main.SqlGeneratorHarness': you must specify a valid 
       lifecycle phase, or a goal in the format plugin:goal or pluginGroupId:pluginArtifactId:pluginVersion:goal
[INFO] ------------------------------------------------------------------------
[INFO] Trace org.apache.maven.BuildFailureException: Invalid task' .mainClass=com.spp.config.main.SqlGeneratorHarness': you must specify 
       a valid lifecycle phase, or a goal in the …
Run Code Online (Sandbox Code Playgroud)

java windows exec-maven-plugin

5
推荐指数
1
解决办法
8142
查看次数

为什么在CellTable中没有使用CompositeCell的正确例子?

我已经搜索了GoogleCode,GWT ShowCase,GWT Developer Notes和Google Groups,以了解如何获取/设置CompositeCell的值.没有一个明确的例子可以解释如何在CellTable中使用它.

让我们盯着一些代码......首先是抽象类......

public abstract class ToggleableGrid<T> extends CellTable<T> {

private static final String DEFAULT_TABLE_WIDTH = "100%";
private static final DisplayMode DEFAULT_MODE = DisplayMode.VIEW;

protected void setDefaults() {
    setWidth(DEFAULT_TABLE_WIDTH);
    // Set the message to display when the table is empty.
    setEmptyTableWidget(new Label(UiMessages.INSTANCE.no_results()));
    // Add a selection model so we can select cells
    final SelectionModel<T> selectionModel = new MultiSelectionModel<T>();
    setSelectionModel(selectionModel, DefaultSelectionEventManager.<T> createDefaultManager());
}

public void setInput(List<T> content) {
    setInput(content, DEFAULT_MODE);
}

public void setInput(List<T> content, DisplayMode mode) { …
Run Code Online (Sandbox Code Playgroud)

gwt composite cell gwt-celltable

5
推荐指数
1
解决办法
4293
查看次数

Spring Boot,Websockets无法从Session获取用户(即java.security.Principal)

与工作Spring Boot 1.2.1.RELEASESpring Websockets.有一个部署运行时问题,当运行嵌入式时Jetty 9,我不能java.security.Principal成功地伪装用户()当app部署在除localhost之外的任何其他地方.

我咨过过

下面的配置(我相信)已经"升级"了一个请求

@Configuration
@EnableWebSocketMessageBroker
@EnableScheduling
public class WebSocketConfig extends AbstractWebSocketMessageBrokerConfigurer {

@Override
public void configureMessageBroker(MessageBrokerRegistry registry) {
    // see http://docs.spring.io/spring/docs/current/spring-framework-reference/html/websocket.html#websocket-stomp-handle-broker-relay
    // requires an external broker like AMQP or RabbitMQ
    //registry.enableStompBrokerRelay("/queue/", "/topic/");

    // XXX This might wind up being the impl we actually deploy; but be aware it has certain constraints
    // see http://docs.spring.io/spring/docs/current/spring-framework-reference/html/websocket.html#websocket-stomp-message-flow
    registry.enableSimpleBroker("/queue/", "/topic/");
    registry.setApplicationDestinationPrefixes("/app");
}

@Override
public void registerStompEndpoints(StompEndpointRegistry registry) {
    registry.addEndpoint("/cards").setHandshakeHandler(new UserHandler()).withSockJS(); …
Run Code Online (Sandbox Code Playgroud)

java session spring-boot spring-websocket

5
推荐指数
0
解决办法
2340
查看次数

GWT Date Handing ...拥有客户尊重服务器的时区

我在这里读了很多帖子:GWT日期处理.

特别是与我打成一线的是这一个

从GAE服务器向GWT客户端发送日期和时区

无论如何,我正在努力的项目需要能够将天,小时,分钟间隔显示为网格中的标签.我的团队采用了一种方法,所有日期/时间实例都以ISO8601字符串格式从服务器传递给客户端.客户端应遵守服务器时区.商业用例是所有日期/时间实例都处于"市场时间",因此访问该应用程序的任何浏览器都将在"市场时间"时区中看到并使用日期,该时区恰好是GMT-05:00(如果夏令时有效)或GMT-06:00(如果标准时间有效).

我在Github上发布了一些来源,这里:

https://github.com/fastnsilver/gwt-datehandling-example

尤其...

https://github.com/fastnsilver/gwt-datehandling-example/blob/master/src/main/java/me/fns/gwt/datehandling/client/util/CSTimeUtil.java

和GWTTestCase

https://github.com/fastnsilver/gwt-datehandling-example/blob/master/src/test/java/me/fns/gwt/datehandling/client/util/CSTimeUtilTestGwt.java

希望有人能够盯着我们用于日期处理的公用事业(和测试)并帮助我们看到我们没有看到的东西.

编辑 基本问题是CSTimeUtil#hoursInDay(Date)在生产模式中没有正确计算"过渡日"此方法由其他方法(如CSTimeUtil#dateToHour(Date)CSTimeUtil#labelsForDay(Date))使用.

我已经使用当前的实现部署了我们的应用程序,CSTimeUtil它似乎工作,但并不完全.我真的对备用测试结果感到困惑,例如,mvn gwt:test在Windows上的GWT模式或生产模式下运行,其中OS时区被设置为除美国GMT-05:00或以外的各种时区GMT-06:00.

gwt timezone date

4
推荐指数
1
解决办法
7061
查看次数

Spring MVC,REST,JSON,DispatcherServlet和@RequestMapping

我似乎无法进行简单的REST客户端集成测试.我使用Spring 3.1 MVC与JavaConfig设置.我使用Maven,我可以毫无问题地构建,运行和部署我当前的webapp.

首先,这里有一些代码和配置

我的控制器

@Controller
@RequestMapping("/rest")
public class StubRestController {

@Inject
private TestData testData;

@RequestMapping(value=Endpoints.GET_RESOURCES, method=RequestMethod.GET, produces="application/json")
@ResponseStatus(HttpStatus.OK)
public @ResponseBody JSONObject getResources(@RequestParam(value="q") String query, @RequestParam int indexFrom, @RequestParam int indexTo) throws JSONException {
    return makeRequest(query, indexFrom, indexTo, testData.getResources());
}

@RequestMapping(value=Endpoints.GET_LOCATIONS, method=RequestMethod.GET, produces="application/json")
@ResponseStatus(HttpStatus.OK)
public @ResponseBody JSONObject getLocations(@RequestParam(value="q") String query, @RequestParam int indexFrom, @RequestParam int indexTo) throws JSONException {
    return makeRequest(query, indexFrom, indexTo, testData.getLocations());
}

private JSONObject makeRequest(String query, int indexFrom, int indexTo, String[] data) throws JSONException {
    int count …
Run Code Online (Sandbox Code Playgroud)

rest json spring-mvc dispatcher

3
推荐指数
1
解决办法
2万
查看次数