小编Tho*_*yer的帖子

为什么这个异常FileItemStream $ ItemSkippedException?

在gwt Web应用程序中.我必须发送一个文件和一些附加的参数.

在ServerSide上

try {

        ServletFileUpload upload = new ServletFileUpload();

        FileItemIterator iterator = upload.getItemIterator(request);

        while (iterator.hasNext()) {
            FileItemStream item = iterator.next();


            if (item.isFormField()) {

                String fieldName=item.getFieldName();
                String fieldValue = Streams.asString(item.openStream());
                System.out.println(" chk  " +fieldName +"  =  "+ fieldValue);
            } else {
                stream = item.openStream();
                fileName = item.getName();
                mimetype = item.getContentType();
                int c;
                while ((c = stream.read()) != -1) { 
                  System.out.print((char) c); 
                    }
            }
        }
    }catch (Exception e) {
        // TODO: handle exception
        e.printStackTrace();
    }
    System.out.println("out of try");
    ByteArrayOutputStream output = …
Run Code Online (Sandbox Code Playgroud)

java file-upload apache-commons-fileupload

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

GWT Java - "getWidget()"已被弃用 - 是什么取代了它?

我正在使用代码加载图像(请参见下文)我通过stackoverflow找到了.但是,我现在注意到"getWidget()"已被弃用.而不是等到这个不再可用,我想现在解决这个问题.我该怎么用而不是"getWidget()"?

// Add a finish handler which will load the image once the upload finishes
            existingdefaultUploader.addOnFinishUploadHandler(onReplaceFinishUploaderHandler);
            existingdefaultUploader.getFileInput().getWidget().setStyleName("customButton");
            existingdefaultUploader.getFileInput().getWidget().setSize("100px", "20px");
Run Code Online (Sandbox Code Playgroud)

问候,

格林

java gwt gwtupload

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

在GWT模块的.html文件中未调用Servlet过滤器

也许我只是缺少一些基本的知识,但我无法弄清楚为什么servlet过滤器没有捕获主GWT模块的.html文件上的GET请求.

我的过滤器在web.xml中定义为

<filter>
    <filter-name>GaeAuthFilter</filter-name>
    <filter-class>com.test.GaeAuthFilter</filter-class>
</filter>
<filter-mapping>
    <filter-name>GaeAuthFilter</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>
Run Code Online (Sandbox Code Playgroud)

当我在开发模式下启动应用程序时,它会在浏览器中打开http://127.0.0.1:8888/AdminPanel.html?gwt.codesvr=127.0.0.1:9997,但过滤器中没有任何内容:(

我需要这个的原因是我不希望我的身份验证在RequestFactory ajax调用上失败,因为它看起来很丑,因为它先加载html然后重定向到Google Accounts登录页面.我想在访问html页面时捕获未经身​​份验证的用户,因此浏览器甚至不会加载网站的受保护区域.

作为替代方案,我尝试使用web.xml的"security-constraint"部分,但它也忽略了对.html文件的调用.

请指教.

谢谢!

java gwt google-app-engine servlets servlet-filters

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

具有CheckBoxes的GWT CellTable获得所有选中的Box

我的GWT Projekt中有一个CellTable,每行都有一个CheckBox.不知何故,我需要迭代cellTable中的所有行,并需要检查是否选中了每行的CheckBox.

我不知道该怎么做,我无法找到任何显示如何.

private Column<Article, Boolean> showPinColumn = new Column<Article, Boolean>(new CheckboxCell()) {
    public Boolean getValue(Article object) {
        return false;
    }
};
Run Code Online (Sandbox Code Playgroud)

gwt celltable gwt-celltable

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

GWT:Provider vs AsyncProvider

GWT中的provider和AsyncProvider有什么区别.我的理解是两者都用于代码分割和延迟实例化.所以我无法决定,在哪种情况下我们选择Provider而不是AsyncProvider?

提前致谢!

gwt gwt-gin gwtp

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

Eclipse报告web.xml文件不存在,即使它确实存在

我有一个GWT项目.我创建了web.xml并将其放在webapp/WEB-INF,war/WEB-INF以及war /中.但Eclipse不断向我提出错误

The web.xml file does not exist
Run Code Online (Sandbox Code Playgroud)

当我右键单击错误并查看属性时,我看到此条目

In folder: <myproject>/war
Run Code Online (Sandbox Code Playgroud)

虽然我把文件放在那里,为什么Eclipse会报告错误?

gwt war web-inf google-eclipse-plugin

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

杰克逊加工问题

我已经把头发拉了好几天了.我无法弄清楚发生了什么.我正在使用GWT开发WebApp,它使用RestAPI与不同的服务器通信.我使用Jersey客户端与GWT项目的Server部分中的不同服务器进行通信.

基本上,我遇到Jackson解析从RestAPI服务器返回的JSON的问题.它正在解析的JSON对象在Android应用程序以及IOS应用程序中成功使用,而RestAPI服务器没有任何问题.

本质上,为了调试这个问题,我拿出Jersey媒体插件并让jersey返回一个对象的字符串,然后将字符串传递给ObjectMapper.我使用的是最新的Jackson版本2.4.4.

我有一个自定义反序列化器,可以使用日期格式,我收到的错误总是在这个日期.原始JSON看起来很好,但Jackson对象映射器抛出错误.错误并不总是在相同的位置,但始终与lastInspectionDate.错误有时说字符串是空的,它试图解析,或者字符串是一些奇怪的值.

以下是一些希望澄清的代码:

它正在解析时遇到问题的EstablishmentEntity类:

@JsonIgnoreProperties(ignoreUnknown = true)
public class EstablishmentEntity {
    private long id;

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    private String establishmentName;

    public String getEstablishmentName() {
        return establishmentName;
    }

    public void setEstablishmentName(String establishmentName) {
        this.establishmentName = establishmentName;
    }

    private String address;

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    private String city;

    public String getCity() {
        return city;
    } …
Run Code Online (Sandbox Code Playgroud)

java rest jackson jersey-client

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

类中的Java字段和访问器方法

是直接使用Java字段还是使用访问器方法更好?在同一个班级内.

例:

private ArrayList<String> list;

list.get(0);
Run Code Online (Sandbox Code Playgroud)

要么

getList().get(0);
Run Code Online (Sandbox Code Playgroud)

java field accessor

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

chrome可执行文件如何自动运行?

因此,在http://google.com/chrome/上,您可以下载chrome.您选择了chrome频道并接受EULA.Web安装程序开始下载,几秒钟后自动启动并立即开始安装chrome(!)没有Windows弹出窗口"你确定要启动可执行文件吗?".刚开始.

怎么做的?它也写在GWT上,这有关系吗?或者也许是因为谷歌签名的可执行文件?但是以这种方式它不能自动运行,只需通过点击即可下载和启动.

html javascript windows security

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

中断或循环GWT回调响应

我想在GWT回调的执行方法响应中打破for循环.

例如,

for (int idx = 0; idx < recordList.getLength(); idx++) {  //Starting ABC FOR LOOP
    ABCDMI.addData(recordList.get(idx), 
                   new DSCallback() {       
                       public void execute(DSResponse response, Object rawData, DSRequest request) {      
                            if(response.getAttribute("UnSuccess") != null && !response.getAttribute("UnSuccess").equalsIgnoreCase("")) {    
                                 break;  //I want to break ABC FOR LOOP here.   
                            }
                   }
}
Run Code Online (Sandbox Code Playgroud)

有人可以帮助我吗?

gwt smartgwt

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

Eclipse:java.lang.OutOfMemoryError:PermGen空间

我的eclipse配置.

Eclipse:最新版本(开普勒)

我的eclipse config.ini

-startup
plugins/org.eclipse.equinox.launcher_1.3.0.v20130327-1440.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.200.v20130521-0416
-product
org.eclipse.epp.package.standard.product
--launcher.defaultAction
openFile
-showsplash
org.eclipse.platform
--launcher.defaultAction
openFile
--launcher.appendVmargs
-vmargs
-Dosgi.requiredJavaVersion=1.6
-Xms40M
-Xmx512M
Run Code Online (Sandbox Code Playgroud)

更新后从Juno到Kepler.But和configuration我没有遇到任何问题.

我面临的例外是

Caused by: java.lang.OutOfMemoryError: PermGen space
    at sun.misc.Unsafe.defineClass(Native Method)
    at sun.reflect.ClassDefiner.defineClass(ClassDefiner.java:45)
    at sun.reflect.MethodAccessorGenerator$1.run(MethodAccessorGenerator.java:381)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.reflect.MethodAccessorGenerator.generate(MethodAccessorGenerator.java:377)
    at sun.reflect.MethodAccessorGenerator.generateMethod(MethodAccessorGenerator.java:59)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:28)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at net.sf.beanlib.provider.BeanPopulator.invokeMethodAsPrivileged(BeanPopulator.java:221)
    at net.sf.beanlib.provider.BeanPopulator.doit(BeanPopulator.java:194)
    at net.sf.beanlib.provider.BeanPopulator.processSetterMethod(BeanPopulator.java:172)
    at net.sf.beanlib.provider.BeanPopulator.populate(BeanPopulator.java:270)
    at net.sf.beanlib.provider.replicator.ReplicatorTemplate.populateBean(ReplicatorTemplate.java:174)
    at net.sf.beanlib.provider.replicator.BeanReplicator.replicateBean(BeanReplicator.java:173)
    at net.sf.beanlib.hibernate3.Hibernate3JavaBeanReplicator.replicateBean(Hibernate3JavaBeanReplicator.java:71)
    at net.sf.beanlib.provider.replicator.ReplicatorTemplate.replicateByBeanReplicatable(ReplicatorTemplate.java:125)
    at net.sf.beanlib.provider.replicator.ReplicatorTemplate.replicate(ReplicatorTemplate.java:120)
    at net.sf.beanlib.provider.replicator.ReplicatorTemplate.replicate(ReplicatorTemplate.java:67)
    at net.sf.beanlib.hibernate3.Hibernate3CollectionReplicator.replicate(Hibernate3CollectionReplicator.java:143)
    at net.sf.beanlib.provider.replicator.CollectionReplicator.replicateCollection(CollectionReplicator.java:88)
    at net.sf.beanlib.hibernate3.Hibernate3CollectionReplicator.replicateCollection(Hibernate3CollectionReplicator.java:79)
    at net.sf.beanlib.provider.replicator.ReplicatorTemplate.replicate(ReplicatorTemplate.java:101)
    at …
Run Code Online (Sandbox Code Playgroud)

java eclipse eclipse-kepler

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

Google搜索在c#windows应用程序中

对不起,我的英语不好.
我需要在我的c#windows应用程序中添加谷歌搜索,因此当用户点击按钮应用程序将搜索查询发送到谷歌时,我在表单中添加了一个文本框和一个按钮.正如你所看到的,谷歌的搜索文本框有很好的自动完成功能.有没有办法将自动完成添加到我的应用程序?

c# google-webmaster-tools

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

GWT Java电子邮件 - java.io.UnsupportedEncodingException:text/html

我发送一封包含HTML文本和附件的电子邮件并收到错误消息:

java.io.UnsupportedEncodingException: text/html
Run Code Online (Sandbox Code Playgroud)

代码是:

public void emailMessage(String emailSubject, String message, String emailaddress, String imagePath) {  
    //Send an email
    try {

        //Send an email
        SimpleEmail email = new SimpleEmail();
        email.setHostName("mail.org");
        email.setSmtpPort(25); //No authentication required
        email.setFrom("address.org");
        email.addTo(emailaddress);
        email.setSubject(emailSubject);
        email.setCharset("utf-8");

        // Set the email message text.
        MimeBodyPart messagePart = new MimeBodyPart();
        messagePart.setText(message, "text/html");

        // Set the email attachment file
        FileDataSource fileDataSource = new FileDataSource(imagePath);

        MimeBodyPart attachmentPart = new MimeBodyPart();
        attachmentPart.setDataHandler(new DataHandler(fileDataSource));
        attachmentPart.setFileName(fileDataSource.getName());

        // Create Multipart E-Mail.
        MimeMultipart multipart = new MimeMultipart();
        multipart.addBodyPart(messagePart);
        multipart.addBodyPart(attachmentPart); …
Run Code Online (Sandbox Code Playgroud)

java email html-email

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