Debug Dart Application with running rest server - rest

I need some help on bootstrapping a dart web application.
How can I customize the host and the port against which my dart application is running?
My scenario
Running Tomcat with Restful Interface on localhost:8080 (Eg get on localhost/8080/something/entity delivers my a bunch of entities as json)
DartEditor which should fire httprequests against the tomcat.
My workaround
Using absolute paths in the urls. Eg http://localhost/8080/something/entity - which is stupid - I would like to have relative paths like /something/entity in my dart application.
Is there a way to start Dartium with the context properly set? Like system params which have to be passed to the debug config.
BR Hubert

You can specify the host/port you are running using the pub serve command. See here: https://www.dartlang.org/tools/pub/cmd/pub-serve.html

Thanks for your answers. In the meantime I got more wisdom and my question got obsolete :)
My Client application holds customizable properties (host:port/app) which will be used on firing against my REST interface. I like the flexibility of this approach.
BW Hubert

Related

Java Servlets + JDBC + Postgres: How does it all interact?

I'm having trouble wrapping my head around how to use servlets properly
I've set up a postgres database, and downloaded a JDBC driver for it.
What I want to have is my webpages post to the servlet, and the servlet get info from the database. I understand how to code everything (eg add library for driver, open connections, execute queries), but I think I'm lacking knowledge in how to set up the file structure.
I have the postgresql database running on pgAdmin. Do I also need to have a server running to make the servlets work as well? Can't I just make a web.xml file that maps to the servlets, and open the webpages to use the website? If I run the project through an IDE with a server running (glassfish) everything works. If I close the IDE and go to open the webpages on my browser again, I get 404's whenever I submit to a servlet.
Can someone give me a bit of guidance on the big picture of how everything is supposed to interact (with details on servers please). I've been searching the web and I havent found anything that explains the big picture very well.
Thanks
A Java web application is a set of files obeying a well-defined structure, and which can be packaged in a war file.
This web application is deployed into a server (also called container), which understands the file structure, listens to HTTP requests, and calls the appropriate servlet of the appropriate deployed web application when it receives one.
And of course, if you shut down the server, nothing listens to the HTTP requests anymore, so you won't get any response.
You could read the Java EE tutorial for more explanations.

Will it be possible to create a Chrome extension that uses a PPAPI plugin without a web server?

In the tutorial Google provided, they mentioned that you had to use a web server. I want my application to run without an Internet connection. Is this possible?
Yes. You have to set up a web server on your machine though. There are free ones on the Internet:
http://www.google.com/search?rlz=1C1CHKZ_enUS437US437&sourceid=chrome&ie=UTF-8&q=free+web+server&qscrl=1
See this SO question:
stumped on jquery call inside chrome extension
...and here is more information from Google:
http://code.google.com/chrome/extensions/experimental.proxy.html
...and some problems you might run into:
http://osdir.com/ml/chromium-extensions/2011-05/msg00261.html

Conditional proxy re-direction in Eclipse?

I am testing out an environment where I have multiple proxies set up depending on what URL I access. I have my browsers working by configuring my wpad.dat file properly according to the examples I found here. However, I am using Eclipse 3.6 and cannot seem to find a way to access different proxies based on any conditional information.
Any Eclipse veterans have an idea? Is there a plugin that I could use?
Thanks!
As it turns out, folks, there is no way to do this. I ended running an instance of Apache on my local machine, and using it as a proxy to do the conditional redirection based on the domain using the ProxyRemote configuration. Read more about it here:
http://httpd.apache.org/docs/2.0/mod/mod_proxy.html#proxyremote

Debugging a GWT app which needs access to an external resource (Same Origin Policy)

We have a GWT application which draws some resources from a separate servlet via async javascript. In production this poses no problems as both the producer servlet and the consumer GWT app will reside on the same server, however for development I can't find a way to make this happen as we are head to head with the Same Origin Policy.
As a temporary solution I have the servlet running on Tomcat, and I compile and deploy the GWT app to that same Tomcat instance - this of course works, and it does allow me to attach Eclipse for debugging. However there is the slight problem of the 40 second or so build time for each modification.
We would like to be able to debug via GWT's hosted mode w/ OOPHM - can anybody see a way for us to do this?
Thanks all!
you could use the -noserver option of gwt dev mode, which lets you run your server code with any servlet container.
Maybe you can deploy the producer servlet to Jetty.
http://www.enavigo.com/2008/08/29/deploying-a-web-application-to-jetty/
I think the Jetty home most reside somewhere in the Eclipse directories. A simple file search might help.
Good luck!
If you need just a servlet, why not define it in web.xml and start dev mode as usual?

Where does GWT's Hosted Mode Jetty Run From?

I'm trying to call a web service in my back end java code when it's
running in hosted mode. Everything loads fine, the GWT RPC call works
and I can see it on the server, then as soon as it tries to call an
external web service (using jax-ws) the jetty falls over with a
Internal Server Error (500).
I have cranked the log all the way up to
ALL but I still don't see any stack traces or cause for this error. I just get one line about the 500 Error with the request header and response.
Does anyone know if the internal jetty keeps a log file somewhere, or
how I can go about debugging what's wrong?
I'm running GWT 1.7 on OS X 10.6.1
Edit: I know that I can use the -noserver option, but I'm genuinely interested in finding out where this thing lives!
From the documentation:
You can also use a real production
server while debugging in hosted mode.
This can be useful if you are adding
GWT to an existing application, or if
your server-side requirements have
become more than the embedded web
server can handle. See this article on
how to use an external server in
hosted mode.
So the simplest solution would be to use the -noserver option and use your own Java server - much less limitations that way, without any drawbacks (that I know of).
If you are using the Google Plugin for Eclipse, it's easily set up in the properties of the project. Detailed information on configuration can be found on the official site.
Edit: you could try bypassing the Hosted Mode TreeLogger, as described here: http://blog.kornr.net/index.php/2009/01/27/gently-asking-the-gwt-hosted-mode-to-not):
Just create a file called
"commons-logging.properties" at the
root of your classpath, and add the
following line:
[to use the Log4j backend]
org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger
[to use the JDK14 backend]
org.apache.commons.logging.Log=org.apache.commons.logging.impl.Jdk14Logger
[to use the SimpleLog backend]
org.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog
Edit2: the trunk of GWT now also supports the -logfile parameter to enable file logging, but it probably won't help in this case, since the problem lies in the way the Hosted Mode treats the exceptions, not the way it presents them.