Detecting what &gwt.codesvr should be set to in non-gwt pages in a GWT/servlet app? - gwt

We have an application that is built exclusively in dev mode using the embedded jetty server that comes with GWT. We also host on jetty.
There are a number of pages we use for development only to do things like simulate SSO requests, view emails that were sent through the system, and check what files are uploaded.
When we try to link from these pages into a GWT page the problem becomes that &gwt.codesvr=192.168.0.101:9997 is not included in the URL and we get the error message "GWT module 'YourApp' may need to be (re)compiled". Obviously I can paste in "&gwt.codesvr=192.168.0.101:9997" manually but is very annoying. Does anybody know of a way to detect you are in the embedded Jetty dev mode server and auto generate links to have the correct "&gwt.codesvr=192.168.0.101:9997" added on?

Try this solution: https://stackoverflow.com/a/9122167/970308
I've updated this bookmarklet. It isn't perfect, but makes it quick while developing.

I suggest you create a Filter which will simply redirect you to an address with &gwt.codesvr=192.168.0.101:9997 as soon as you navigate to the one of the "development pages". If codesvr parameter is specific for each developer, each developer will have to set it in some cookie and filter will simply take this value from cookie.

Related

How can I auto-reload my Mojolicious website?

What is the best way to get auto-reloading to work when developing my website (my website runs on Mojolicious)?
There exists a development server called morbo, and it does update what is served automatically whenever I save changes to a source file, but the website itself does not reload automatically. I must manually refresh the page to see the changes.
What is a sane way to get this behavior? I am okay with using an additional tool if necessary.
My understanding is that Mojolicious::Plugin::AutoReload can do what you want by defining a auto_reload endpoint and having the UI poll your web app to check if the UI should reload.
The module was featured on the Mojolicious blog in 2018.

deleting page version numbers in form action URLs in wicket for stress testing purposes

I want to stress test a system based on Apache Wicket, using grinder.
So what I did was that I used grinder's TCP Proxy tool to record a test session in my Application and then fed the generated test script to grinder to stress test the system; but we found out the tests aren't carried out successfully.
After a lot of tweaking and debugging, we found out that the problem was within the wicket's URL generation system, where it mixes the page version number into its URLs.
So I searched and found solutions for removing that page version number from the URLs (Like this), and used them and they worked and removed those version numbers from the URLs used in the browser. But then again, the tests didn't work.
So I inspected more and found out that even though the URLs are clean now, the action attribute of forms still use URLs mixed with page version number like this one : ./?4-1.[wicket-path of the form]
So is there anyway to remove these version numbers from form URLs as well? If not, is there any other way to overcome this problem and be able to stress test a wicket web application?
Thanks in advance
I have not used grinder, but I have successfully load-tested my wicket application using JMeter Proxy; without changing Wicket's default version mechanism.
Here is the JMeter step-by-step link for your reference:
https://jmeter.apache.org/usermanual/jmeter_proxy_step_by_step.pdf
Basically, all I did was running proxy server to accept web requests from the browser to capture the test scenarios. Once done collecting the samples, then change the target host url to whichever server you want to point to (other than your localhost).
Alternatively, there is another load testing tool BlazeMeter (compatible with JMeter). You could add the chrome browser plugin for quick understanding.
Also, you might want to consider mounting your packages to individual urls for 'cleaner' urls. That way, you have set of known urls generated for pages within same package (for example, /reports for all the reports pages within reports package).
Hope this helps!
-Mihir.
You should not ignore/remove the pageId from the urls. If you remove them then you will request a completely new instance of the page, i.e. you will lose any state from the original page.
Instead of using the href when recording you need to use the attribute set (by you!) with org.apache.wicket.settings.DebugSettings#setComponentPathAttributeName(String).
So Grinder/JMeter/Gatling/... should keep track of this special attribute instead of 'href' and later find the link to click by using CSS/XSLT selector.
P.S. If you are not afraid of writing some Scala code then you can take a look at https://github.com/vanillasource/wicket-gatling.

SilverStripe CMS times-out when changing pages in the CMS

I have installed SilverStripe on several servers successfully in the past (but I'm not a SilverStripe expert). This time my SS install fails to work and I'm at a loss how to fix it.
The Problem
SilverStripe 2.4.6 installed correctly on the server (AFAIK).
The front-end works as expected. (Show default theme. Pages all load correctly.)
I am able to log into the CMS admin section succesfully. The CMS loads but when changing site pages in the CMS using the browser pane on the left, the CMS shows the circular loading symbol. The new page load never completes.
Using the console of Firebug in Firefox - When attempting to change pages in the CMS (by clicking on the page browser pane) the CMS tries to load two pages. The second page request 404s.
The first GET request is from the initial page loads.
The following POST+GET requests fire when clicking on the page tree to change pages.
Attempting to Find the Solution
I've tried deleting and re-installing silverstripe twice. (2.4.7 and 2.4.6) Both times the problem recurs.
A strange thing is that this server is already running two other silverstripe sites (both of which I installed without a hitch). All three websites are accessed via different domains. I tried accessing this install via another domain thinking there might be something wrong with how this third domain is configured but that didn't help either.
What should I try now? I'm stumped.
Thanks in advance.
Responses to Comments
Check your root .htaccess file. Make sure RewriteBase is set to /
Checked. Full .htaccess on PasteBin
Indeed the javascrip URL is strange. Check if there is anything unusual about what's being returned from the previous POST request. Is the site running in dev, test or live mode?
I can't see anything unusual in the POST request.
Clue Found: The site is running in DEV mode. Switching to LIVE mode and the problem disappears. Also the second GET request only shows up in DEV mode.
Example Post request with response.
Example Get request with respones.
This is a work around more than a fix but if you'd rather be coding than bug hunting it might be worth a go! (remember to log out of SS before doing this fix)
In your mysite/_config.php file change
Director::set_environment_type("dev");
to
if(!isset($_GET['isDev']))
Director::set_environment_type("dev");
else
Director::set_environment_type("live");
Then you can develop the website in dev mode normally and to use the admin in live mode and avoid the bug you just go to: http://{your_domain}/admin?isDev=0
N.B. might find a proper answer when pastebin.com isn't overloaded and I can see your responses!

iphone html app - cross site xmlhttprequest?

On an iphone, you can add a favourite when on a webpage and if that webpage has the correct meta tags for iphone, it gets an icon and can even 'hide' the browsers chrome and display just like an App. With html5 http headers you can even have the phone completely cache the 'app' so that it never has to contact the server again.
The problem I have is that I want to write apps that make xmlhttprequests to a server that is not the server they were originally from. I heard its possible to do this if you somehow export your favourites and HTML5 chache then manually edit the export file to change the URL for the favourite, then import them again, so that the phone doesn't think the javascript is trying a cross site xmlhttprequest.
However I have not found anything like that (maybe it was a jailbreak thing?). At the moment I have to have a proxy on the server where the 'app' originally came from, which is obviously very annoying.
I also heard that there was a special meta tag that allowed you to specify one other domain for xmlhttprequest, it had something to do with specifying that the page was actually a mirror and should be treated as if it came from another domain. Does anyone know what meta tag this is? I tried searching all over apple and found nothing.
I believe it might also be possible if you can get webkit to treat the cache as a file:// protocal, because then cross site security will not apply.
The answer is this is not possible and is not meant to be possible.

Web Browser Plugin that Allows user to view Message Traffic

What is the name of the IE plug in that someone can download (I think from Microsoft) that lets a developer (well, anyone who gets the plug-in, actually) to view the message traffic that goes on behind the scenes from the browser to the server? I saw this one in action but I forget its name. And I think, for the FireFox broswer, you can simply turn it on somehow without getting a plug in.
It cuts the browser window in half horizonally and the bottom half is also divided vertically and you can see the GET and POST messages as well as the complete header information that is sent to the server from the browser across the internet.
HttpWatch is a great plugin for IE, but it's not free. Microsoft also released a free tool called VRTA which works for all browsers, but isn't a plugin.
For firefox it's called Live HTTP Headers. Another option of course is WireShark.
Fiddler is from Microsoft.
http://fiddler2.com/fiddler2/