This is my first question, for which I didn't find any answers in the web. The problem is, when using errai in portal environment, you'll get Exceptions on server side like this:
/out.50694-4048.erraiBus generates exception: null
and on client side like this:
GET http://myserver:8080/user/admin/in.20679-27603.erraiBus?z=1 404 (Not Found)
GET http://myserver:8080/user/admin/in.20679-27603.erraiBus?z=2 404 (Not Found)
GET http://myserver:8080/user/admin/in.20679-27603.erraiBus?z=3 404 (Not Found)
The reason for this is, that errai calls urls which are relative to the gwt module and not the web context name. Solution follows.
Same problems on other forums:
http://www.liferay.com/de/community/forums/-/message_boards/message/12383627?_19_threadView=flat
https://community.jboss.org/thread/177590?start=0&tstart=0
You need to add a script in the html host page, like described in Client Configuration in the errai docu.
<script type="text/javascript">
erraiBusApplicationRoot = "/MyWebContextName";
</script>
This will solve all errai communication problems.
Related
I'm doing work on an application running on an old CQ5.5 server. I've set up a servlet to do captcha verification. It has a doGet that provides the captcha image and a doPost that verifies the captcha - each method uses a different selector. The servlet is using the same resourceType as the jsp that draws the captcha form.
#SlingServlet(
resourceTypes="myApp/components/myForm",
selectors={"verify","captcha"},
extensions={"json","png"},
methods={"GET","POST"}
The servlet extends SlingAllMethodsServlet and I'm logged in as admin.
The GET works just fine, so the resourceType is resolving to my servlet. But the POST resolves to the default Sling servlet. Also using the "json" extension for the GET seems to result in the default GET servlet resolving.
Does version 5.5 explain this? Should I blame the old server, or is there a problem in my code?
It seems to be associated to the specifics of the resource type. I had attempted to hook the servlet to my page component. When I instead used the resourceType of another node under the page's jcr:content node, it works as expected. I haven't tried this on another version yet, but I suspect I have never tried to use the page component node before.
I'm using urls to navigate to different screens inside my GWT app. For example:
http://127.0.0.1/home
http://127.0.0.1/info/contact-us
http://127.0.0.1/app/index.html
I have a servlet that serves the html containing the required script element for GWT (my GWT module name is "app"):
<script type="text/javascript" language="javascript" src="/app/app.nocache.html">
</script>
This is working great with GWT 2.6.1. In the browser dev tools it's possible to see that RPC calls are made to my RemoteService at http://127.0.0.1/app/rpc
The problem is when I upgraded to GWT 2.8, my app's RPC call endpoint is now different and wrong, depending on the URL used. For example:
http://127.0.0.1/home -> http://127.0.0.1/rpc
http://127.0.0.1/info/contact-us -> http://127.0.0.1/info/rpc
http://127.0.0.1/app/index.html -> http://127.0.0.1/app/rpc
For the above URLs the module is always correctly loaded and executed, however RPCs fail in the first two cases. only the last URL allows my app to make RPC calls.
The RPC endpoint can be set by casting the client-side service proxy to ServiceDefTarget and using setServiceEntryPoint(). As follows:
ourInstance = (MyRemoteServiceAsync)GWT.create(MyRemoteService.class);
ServiceDefTarget serviceDefTarget = (ServiceDefTarget) ourInstance;
serviceDefTarget.setServiceEntryPoint("/app/rpc");
However, the request payload still contains a reference to the incorrect module base. The http headers sent on the RPC request have incorrect values also:
X-GWT-Module-Base:http://127.0.0.1/foo/bar/
Is there a way to force the client's RPC mechanism to use the correct RPC URL /app/rpc? Or perhaps a way to set the module-base correctly?
UPDATE 1
Seeing the same behaviour in GWT 2.7.
Also, when deployed in a WAR the <module-hash>.cache.js file doesn't load because it is also requested relative to the url. This is very bad because it means that the module code won't be cached, since this url is different every time. The fix needs to be made in the selector <module>.nocache.js. Is anyone actually using GWT with url linking in the real world?
By specifying a <meta> element in the <head> element of the html document, the bootstrap nocache.js selector javascript will choose the correct module baseUrl. The baseUrl must be a fully-specified absolute url, and end with a /.
For my example, the exact element was:
<head>
...
<meta name="gwt:property" content="baseUrl=http://127.0.0.1/app/" />
...
</head>
I have just set up a custom tab on my page for the first time. I have thoroughly followed the setup guide and seem to have everything on the Facebook side setup correctly.
However when I view my page it throws the following error:
Method Not Allowed The requested method GET is not allowed for the
URL /Facebook/index.html. Additionally, a 404 Not Found error was
encountered while trying to use an ErrorDocument to handle the
request. Apache/1.3.41 Server at feebnaturals.com.au Port 80
I believe it may be some kind of Apache server config issue, however I'm not that Apache savvy, so not sure where to start.
I had the same problem, but instead of GET, it was POST method which was not allowed. This is a setting on your server. Not server savvy myself, but it seems that my provider didn't allow this method on html-page, but makes no problem on doing the same for php-pages. So all I did was rename my page from .html to .php, updated the app settings in facebook and all works fine now.
This is definitely an error on your side, check your server logs and see what they say - it looks like you've configured the page to only work via a POST request and it's being requested in a GET request
I need to include some secure (BASIC authentication) application.
when I open the application URL in the browser, the browser asks me to enter your credentials ...
what I know is that:
The browser ask the server to get
some URL -- the url of the app
The server checks the request header
for the Authentication header and
didn't find it
The server sends 401 to the
browser back
The browser interpret this response
code into a message dialog that
shows to me asking me to enter the
username/password to send back to
the server in the Authentication
request header
So far... so good, I can write some page (in JSP) that send this required http request header to the request that is calling this page..
So I'll call this application through my page..
The problem here is, this application (in fact a GWT application) contains a reference to some Javascript and CSS files that is coming from the server that hosts this application. the application page that I import looks like:
<html>
<link href="http://application_host/cssfile.css" />
<link href="http://application_host/javascriptfile.js" />
.....
</html>
So, again I found the application asks me for the authentication crenditals for the css and js files!
I am thinking of many solutions but don't know the applicability of each
One solution is to ask the browser
(via Javascript) to send the request
header (Authentication) when he
asks the server for the js and css
files
please give me your opinions about that... and any other suggestions will be very welcomed.
Thanks.
I think you're running into some weirdness with how your server is configured. Authentication happens in context of a authentication realm. Your assets should either be in the same authentication realm as your page, or (more likely) should not require authentication at all. The browser should be caching credentials for the given realm, and not prompt for them again.
See the protocol example on http://en.wikipedia.org/wiki/Basic_access_authentication
Judging from your story, something tells me your problem is with the authentication method itsef. Not how to implement it. Why do you want to bother with the request header so much?
As far as i know, you can configure your container (ie Tomcat) to force http authentication for certain urls. Your container will make sure that authentication has taken place. No need to set http headers yourself whatsoever.
Perhaps you can explain a bit better what you are trying to achieve, instead of telling implementation details?
Why css & js files are kept in protected area of server? You need to place files into public area of your server. If you don't have public area, so you nead to prpvide for it. how to do it depends from serverside software architecture & configuration.
i'm developing an application for blackbery, i'm displaying a webpage using Eclipse and net.rim.device.api.browser.field.* api when i click a submit buttom in a form i get this error "Unknown host http:80", can anyone helpme?
Don't know anything about Blackberries, but it looks like you're entering a URL where your program is only expecting a host name.
It sounds like form on the web page is not properly set up, causing the post action to post to an invalid URL. It would help if you included the app code and the form HTML.
In this 2005 forum thread people complain about getting that kind of error on their Blackberries.
I'm on the server side and I can see some Proxy servers trying to access my server with either HTTP/1.0 and no HTTP_HOST (which my app requires) or using the wrong HTTP_HOST.
For example, I am getting requests for widgets.twimg.com , www.google-analytics.com , servedby.jumpdisplay.com . My server doesn't host those domains so the response is obviously not any of the sites on the server, and instead I'm giving back an error.
So, it might be that your Blackberry is not providing the right HTTP_HOST to the server (or none at all) and the server doesn't know what to do with it.
To me, that's Blackberry (or whatever proxy that might exist between you and the server) 's fault.