I am trying to use Spring Security with GWT and I stumble over problems after problems because nothing seems to work like it actually should. At the moment I am trying to connect everything to my custom login page. For this I have a `FormPanel` which gets initialized like this:

```
public LoginViewImpl() {
    initWidget(uiBinder.createAndBindUi(this));

    this.frmLogin.setMethod(FormPanel.METHOD_POST);
    this.frmLogin.setAction("/app/login");
    this.frmLogin.setEncoding("text/x-gwt-rpc");

    this.txtUserID.setName("username");
    this.txtPassword.setName("password");
}

```

but as I click on the login button I am getting:

```
javax.servlet.ServletException: Content-Type was 'application/x-www-form-urlencoded'. Expected 'text/x-gwt-rpc'.
    at com.google.gwt.user.server.rpc.RPCServletUtils.checkContentTypeIgnoreCase(RPCServletUtils.java:477)
    at com.google.gwt.user.server.rpc.RPCServletUtils.readContent(RPCServletUtils.java:209)
    at com.google.gwt.user.server.rpc.RPCServletUtils.readContentAsGwtRpc(RPCServletUtils.java:252)
    at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.readContent(AbstractRemoteServiceServlet.java:182)
    at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:364)
    at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    ...

```

I don't know how to avoid this. Any help is appreciated. 

I also noticed that the `Content-Type` header of the request was `application/x-www-form-urlencoded` instead of `text/x-gwt-rpc` like I've set it.

The HTML of this part says:

```
<form target="FormPanel_app_2" method="post" action="/app/login" enctype="text/x-gwt-rpc">
    <!-- ... -->
</form>

```