Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>What Im looking how do it default gwtRpc, gwtRpc save info about rpc serialization policy, what Im saving to class <code>com.xxx.TestObject__ArgsGenerated</code>, to plain text file to web directory. So I must go this way. in my generator I must create resource file, and put serialization policy there.</p> <pre><code>public class WsRpcServerGenerator extends Generator{ @Override public String generate(TreeLogger logger, GeneratorContext context, String typeName) throws UnableToCompleteException { JClassType classType; try { classType = context.getTypeOracle().getType(typeName); SourceWriter src; try { // generating first file xxxAsync for client src = generateMethod( classType, context, logger); // generating file to war directorz ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStreamWriter osw = new OutputStreamWriter(baos, SerializationPolicyLoader.SERIALIZATION_POLICY_FILE_ENCODING); TypeOracle oracle = context.getTypeOracle(); PrintWriter pw = new PrintWriter(osw); // generate content here pw.close(); byte[] serializationPolicyFileContents = baos.toByteArray(); String serializationPolicyName = Util.computeStrongName(serializationPolicyFileContents); String serializationPolicyFileName = SerializationPolicyLoader.getSerializationPolicyFileName(serializationPolicyName); OutputStream os = context.tryCreateResource(logger, serializationPolicyFileName); if (os != null) { os.write(serializationPolicyFileContents); GeneratedResource resource = ctx.commitResource(logger, os); } // returning first class for client if (src == null)return typeName + "__AsyncWsRpcGenerated"; src.commit(logger); return typeName + "__AsyncWsRpcGenerated"; } catch (NotFoundException e | IOException e) {} } } </code></pre> <p>reading policy on server side</p> <pre><code>HttpServlet servlet; String modulename; // sended from client GWT.getModuleBaseURL() reolacing host Sending serialiyationpolicyid; // from generated xxxAsync // Open the RPC resource file and read its contents. InputStream is=servlet.getServletContext().getResourceAsStream(modulename+"/"+serialiyationpolicyid+".rpc"); // read policy </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload