How to know strong name of GWT serialization policy at the time of host page generation?
Date : March 29 2020, 07:55 AM
it should still fix some issue I have integrated GWT with spring with a custom SerializationPolicyProvider where I always had to rename .gwt.rpc file and hard code the name in my custom SerializationPolicyProvider class. I got work around by looking at GWT docs. Strong Name is MD5 hash with length of 32. Each time RPC call is made to Spring based Controller's method: public String processCall(String payload), I parse the payload using following code to get strong name:String strongName = null;
if(payload!=null){
StringTokenizer tokens = new StringTokenizer(payload,String.valueOf(AbstractSerializationStream.RPC_SEPARATOR_CHAR));
while(tokens.hasMoreTokens()){
String s = tokens.nextToken();
if(s.length() == 32){
strongName = s;
break;
}
}
}
return SerializationPolicyLoader.loadFromStream(servletContext.getResourceAsStream(moduleBaseURL+"/"+strongName+"gwt.rpc");
|
Java REST Client still connects to old host after the dynamic address of the host was moved to another host
Date : March 29 2020, 07:55 AM
help you fix your problem I managed to find more time to dig into this issue. I made more searches on the references made by some about a socket pool being used by the HttpUrlConnection instances. System.setProperty("http.keepAlive", "false");
|
Web page works fine in local host but not when i host it in google drive
Tag : ajax , By : Lathentar
Date : March 29 2020, 07:55 AM
it should still fix some issue You can't send AJAX request to another domain/IP per default in all browsers. Those restrictions are turned off when browsing in the localhost/127.0.0.1 context. If you want to sent a request to another domain/IP you have to enable cross-origin resource sharing or you have to use JSONP.
|
Create an embedded JavaScript in a Cross Domain Host Page which is not affected by the Host Page CSS?
Date : March 29 2020, 07:55 AM
I hope this helps you . I don't know GWT, but you can easily achieve this in plain JavaScript. Let's assume you're creating an online-count widget. At first, create an iframe: <script id="your-widget">
// Select the script tag used to load the widget.
var scriptElement = document.querySelector("your-widget");
// Create an iframe.
var iframe = document.createElement("iframe");
// Insert iframe before script's next sibling, i.e. after the script.
scriptElement.parentNode.insertBefore(iframe, scriptElement.nextSibling);
// rest of the code
</script>
// The URL of your API, without JSONP callback parameter.
var url = "your-api-url";
// Callback function used for JSONP.
// Executed as soon as server response is received.
function callback(count) {
// rest of code
}
// Create a script.
var script = document.createElement("script");
// Set script's src attribute to API URL + JSONP callback parameter.
// It makes browser send HTTP request to the API.
script.src = url + "?callback=callback";
// Create a div element
var div = document.createElement("div");
// Insert online count to this element.
// I assume that server response is plain-text number, for example 5.
div.innerHTML = count;
// Append div to iframe's body.
iframe.contentWindow.document.body.appendChild(div);
<script type="text/javascript">
(function(d){
var f = d.getElementsByTagName('SCRIPT')[0], p = d.createElement('SCRIPT');
window.WidgetId = "1234";
p.type = 'text/javascript';
p.setAttribute('charset','utf-8');
p.async = true;
p.id = "your-widget";
p.src = "//www.example.com/assets/clientwidget/chatwidget.nocache.js";
f.parentNode.insertBefore(p, f);
}(document));
</script>
// Select the script tag used to load the widget.
var scriptElement = document.querySelector("#your-widget");
// Create an iframe.
var iframe = document.createElement("iframe");
// Insert iframe before script's next sibling, i.e. after the script.
scriptElement.parentNode.insertBefore(iframe, scriptElement.nextSibling);
// The URL of your API, without JSONP callback parameter.
var url = "your-api-url";
// Callback function used for JSONP.
// Executed as soon as server response is received.
function callback(count) {
// Create a div element
var div = document.createElement("div");
// Insert online count to this element.
// I assume that server response is plain-text number, for example 5.
div.innerHTML = count;
// Append div to iframe's body.
iframe.contentWindow.document.body.appendChild(div);
}
// Create a script.
var script = document.createElement("script");
// Set script's src attribute to API URL + JSONP callback parameter.
// It makes browser send HTTP request to the API.
script.src = url + "?callback=callback";
|
Apache dynamic wildcard host rewrite with dynamic subdomains
Date : March 29 2020, 07:55 AM
|