kamalasv / struts2gwtplugin

Automatically exported from code.google.com/p/struts2gwtplugin
Apache License 2.0
0 stars 0 forks source link

RFE: Patch to enable struts2gwt plugin and java.io.Serializable interface #8

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Use struts2gwtplugin with GWT from svn's trunk. (Not tried with other
versions)
2. Send a DTO over the wire that implements Serializable instead of
IsSerializable, the call should be routed to a struts2 action.

What is the expected output? What do you see instead?
An error occurs: Exception while dispatching incoming RPC call: Type  'xxx' was
not assignable to 'com.google.gwt.user.client.rpc.IsSerializable' and did
not have a custom field serializer.  For security purposes, this type will
not be serialized.

The expected result is that the plugin delegates the (de)serialization
policy to gwt. The problem occurs because struts2gwt plugin does not handle
serialization policies.

There is a patch attached, that solved the problem.

Original issue reported on code.google.com by miguel.p...@gmail.com on 20 Nov 2007 at 4:41

Attachments:

GoogleCodeExporter commented 9 years ago
Thx 

Original comment by gauthier...@gmail.com on 3 Apr 2008 at 1:34

GoogleCodeExporter commented 9 years ago
in case that the gwt module is not deployed together with the rpc server 
module, you
will have to additionally override doGetSerializationPolicy in GWTServlet to 
load the
policy file.

in my case,
protected SerializationPolicy doGetSerializationPolicy(HttpServletRequest 
request,
String moduleBaseURL, String strongName) {
        String modulePath = null;
        if (moduleBaseURL != null) {
            try {
                modulePath = new URL(moduleBaseURL).getPath();
            } catch (MalformedURLException ex) {
                // log the information, we will default
                getServletContext().log("Malformed moduleBaseURL: " + moduleBaseURL, ex);
            }
        }

        //as usual, the rpc file is deployed with gwt compiled html/js
        String policyPath = request.getScheme() + "://" + request.getServerName() + ":" +
request.getServerPort() + "" + modulePath;
        String policyURL =
SerializationPolicyLoader.getSerializationPolicyFileName(policyPath + 
strongName);

        SerializationPolicy serializationPolicy = null;
        InputStream is = null;
        try {
            is = new URL(policyURL).openStream();
            serializationPolicy = SerializationPolicyLoader.loadFromStream(is, null);
        } catch (Exception e) {
            getServletContext().log("ERROR: Could not read the policy file '" + policyURL +
"'", e);
        } finally {
            if (is != null) {
                try {
                    is.close();
                } catch (IOException e) {
                    // Ignore this error
                }
            }
        }

        return serializationPolicy;
    }

Original comment by m123...@gmail.com on 13 May 2008 at 4:05

GoogleCodeExporter commented 9 years ago
It would be awesome to see this implemented in the next version.  I see that 
this 
project has stagnated for a while.  Hopefully you'll bring it back to life - 
it's 
very useful!!!

Original comment by greensu...@gmail.com on 14 Oct 2008 at 4:40

GoogleCodeExporter commented 9 years ago
This is really a great feature. But the patch doesn't work for the 1.0 version. 
Hope 
there will be a fix soon.

Original comment by jackie.s...@gmail.com on 15 Dec 2009 at 11:40