小编Ras*_*sen的帖子

从GWT调用servlet,使用servlet生成的post数据和下载文件

我有我的ExportServlet,它生成XLSX文件(Excel),我的用户将通过单击导出按钮从我的GWT应用程序请求.

如果我使用GET方法,则提示用户下载文件.代码如下所示:

@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
        throws ServletException, IOException
{
    try
    {
        byte[] xlsx = createTest("");
        sendXLSX(resp, xlsx, "test.xlsx");
    }
    catch (Exception e)
    {
        e.printStackTrace();
    }
 }

void sendXLSX(HttpServletResponse response, byte[] bytes, String name)
        throws IOException
{
    ServletOutputStream stream = null;

    stream = response.getOutputStream();
    response.setContentType(CONTENT_TYPE_XLSX);
    response.addHeader("Content-Type", CONTENT_TYPE_XLSX);
    response.addHeader("Content-Disposition", "inline; filename=" + name);
    response.setContentLength((int) bytes.length);
    stream.write(bytes);
    stream.close();
}
Run Code Online (Sandbox Code Playgroud)

这由GWT客户端以下列方式调用:

String url = GWT.getModuleBaseURL() + "ExportServlet";
Window.open(url, "", "");
Run Code Online (Sandbox Code Playgroud)

并提示用户下载文件.好,那就是我想要的:)

但我想在请求中附加大量数据,而afaik,你可以在URL参数("ExportServlet?data = ...")中放入多少数据是有限制的,所以我想换行而是在POST请求中.

我从GWT尝试了以下内容:

String url = GWT.getModuleBaseURL() + …
Run Code Online (Sandbox Code Playgroud)

gwt post servlets download

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

Vaadin 19 中的 VaadinWebSecurityConfigurerAdapter 发生了什么?

我们正在使用 Vaadin 19 Fusion 构建一个网络应用程序,我正在学习本教程:https : //vaadin.com/docs/latest/fusion/security/spring-login (我选择了 V19+ Docs,然后是 Fusion)

在教程中有一个参考,VaadinWebSecurityConfigurerAdapter用于设置 Spring 的安全性,但是这个类在类路径上不可用。我曾尝试从 start.vaadin.com 下载一个普通的入门项目 (v19),但在这里我也无法使用VaadinWebSecurityConfigurerAdapter.

v19 中是否有替代方案,或者我是否缺少依赖项?我有与启动项目相同的依赖树,所以我假设 pom 是正确的。

vaadin vaadin-spring-boot vaadin-fusion

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

与css显示和表格单元格的不需要的间距

在css中使用时,我很难理解表格和表格单元格的本质.

请考虑以下内容:http://jsfiddle.net/dd7h7/3/.

HTML

<div class="widget">
  <div class="button">
    <div class="content">
      <div class="icon">A</div>
      <div class="label">ABC</div>            
    </div>
  </div>
  <div class="button">
    <div class="content">
      <div class="icon">B</div>
      <div class="label">ABCDEF</div>            
    </div>
  </div>
  <div class="button">
    <div class="content">
      <div class="icon">C</div>
      <div class="label">ABCDEFGHI</div>            
   </div>
  </div>
</div>
Run Code Online (Sandbox Code Playgroud)

CSS

.widget {
    display:block;
    margin:0px;
    padding:0px;
}

.button {
    display:inline-block;
    border:1px solid red;
    margin:0px;
    padding:0px;
}

.content {
    display:table;
    width:100%;
    height:100%;
    margin:0px;
    padding:0px;
    border-spacing:0;
    border-collapse:collapse;    
}

.icon {
    display:table-cell;
    width:15px;
    height:15px;
    margin:0px;
    padding:0px;
    vertical-align:middle;
    text-align:center;
}

.label {
    display:table-cell;
    margin:0px; …
Run Code Online (Sandbox Code Playgroud)

html css

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

使用特殊字符时 Wildfly 表单身份验证失败

我们正在将我们的 GWT 应用程序部署到 Wildly 8.1.0 服务器并使用表单身份验证以确保安全。我们的问题是,每次我们的客户的用户名或密码中包含特殊字符(æøåäëö 等)时,他们都无法登录。

我见过其他人有同样的问题:

https://developer.jboss.org/thread/42859?tstart=0

UTF-8 编码的 j_security_check 用户名在 Tomcat 领域中被错误地解码为 Latin-1

Spring security:表单登录特殊字符

但是他们使用的是 Tomcat/Apache/Spring 等,所以我很难找到适合我们设置的解决方案。

Wildly/Undertow 是否有任何配置参数,以便我们在用户登录时确保使用 UTF-8 编码?

我们的 web.xml:

<login-config>
    <auth-method>FORM</auth-method>
    <realm-name>project-security-policy</realm-name>
    <form-login-config>
        <form-login-page>/login.html</form-login-page>
        <form-error-page>/error.html</form-error-page>
    </form-login-config>
</login-config>
Run Code Online (Sandbox Code Playgroud)

登录表格:

<form name="loginform" method="post" autocomplete="on" action="j_security_check" accept-charset="UTF-8 ISO-8859-1" onsubmit="return validate_login_form();">
    <input id="usernameInput" name="j_username" class="form-input" type="text" placeholder="Username" autofocus="">
    <input id="passwordInput" name="j_password" class="form-input" type="password" placeholder="Password">
    <input id="submitButton" type="submit" value="Login">
</form>
Run Code Online (Sandbox Code Playgroud)

ejb form-authentication wildfly wildfly-8 jakarta-ee

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