How to configure the application URL with RAP/RWT - eclipse

We can get an application URL with the code:
RWT.getRequest().getRequestURL();
Do we have any way to configure this URL (host, port) in VM arguments or properties or any other ways (not in Java code)?

Both hostname and port aren't part of a RAP application's configuration.
The hostname is determined by the network configuration of the machine running the application and other factors like proxy servers in between client and server.
The servlet container (Tomcat, Jetty, and the like) that a RAP application runs on controls which port it uses. Hence the servlet container's configuration needs to be changed in order to change the port.

Related

How to make Apache HTTP client use system settings by default

I have a machine running third party code that uses Apache HttpClient. This machine can only access the external world via https proxy. I know HttpClient allows using system properties like this
HttpClientBuilder.create().useSystemProperties().build();
But I don't have access to the source code to do this. I want to set the proxy host and port as environment variables to make the program pick it up, like it does with "-Dhttp.proxyPort" for Java HttpClient. What are my options?

Domain Name Instead of Localhost In Eclipse

I've got a tomcat server instance running inside of eclipse. By default it uses a hostname similar to http://localhost:8080/MyApp/ is there some way to proxy this so I can use a domain name like http://example.com/ instead?
On the production server I use apache to proxy the request to point to the tomcat instance, but within eclipse I don't have that luxury.
I'm using Ubuntu. I thought maybe I could map the domain to point to the localhost version in /etc/hosts but that seems to only be the first step. From there I can't figure out how to point the domain to the tomcat url.
Add this to your hosts file, to access via domain name : localhost example.com
Now, You have couple of options :
Host file doesn't know about ports. You have to access your app like http://example.com:8080/MyApp
You can change your tomcat port 8080 to 80 so that you dont have to access it via port like this http://example.com/MyApp
To access your web application via http://example.com, you have to deploy your application in tomcat root. For that refer Deploying my application at the root in Tomcat

Eclipse TCP/IP Monitor has two ports

I was trying to monitor request using TCP/IP Monitor.
But, I see there are two ports which are in use. One is the application port[8080] and other monitoring port[9833].
Can anybody tell , why there are two different ports?
When I launch the application it launches at 9833 instead of 8080. Why this change?
Eclipse monitoring is done by capturing all the requests sent to an application (a host and a port), dumping it on the Monitor console for you, then forwarding the original request to the application.
The monitored application itself will return its responses to eclipse (where it is the client from its prospective) where eclipse dumps it on the monitoring console too.
Now, how does eclipse captures the requests sent to the monitored application at the first place? it simply runs a service that accepts these requests (on behalf of the application) and forward it, this service also returns the application responses to the original requester.
Based on the above, in eclipse TCP/IP Monitor screen, the Local monitoring port is the port of the eclipse service (which you can use any available port number for), and the other Port is the monitored application port number.
So, in your case, the application you are monitoring is running on port 8080 and eclipse service is using the port 9833 (which is just a random port that you can change).
Your application port have not been changed, it still runs on 8080 and you can try that, but no data will be captured by eclipse TCP/IP monitor unless you use the port 9833.

GWT dev mode not accepting requests forwarded through router

Our application uses the PayPal api, in order to test it PayPal needs to be able to post data to a serlvet on our servers. This is no problem in production however when running in GWT-Dev mode I cannot seem to get GWT to work through my home router. GWT is running on port 8888 and I have added the needed firewall rules to get this to work.
Does GWT somehow stop requests from working from outside the local area network? I tried -bindAddress 192.167.x.x but it did not work.
For security reasons the jetty server used in gwt dev mode only binds to localhost.
If you want to bind it to all intefaces use the parameter -bindAddress 0.0.0.0
To make sure the servlets are reachable try to connect from a different host on your network (e.g. with Telnet).

Run jsp in eclipse on specific port and ssl

I have used Eclipse 3.4 to create a Dynamic Web Project. I have also configured my server to use port 8443 with ssl. If I start my server I can access my test.jsp by going to it's address
https://localhost:8443/TestContext/test.jsp
In eclipse, I have installed this server and added my project to the server. If I Run test.jsp it always launches as
http://localhost:8080/TestContext/test.jsp
My question is: How can I set up eclipse to run this on https://localhost:8443/ rather than the default 8080? Thanks in advance.
You should have a project called "Servers". There your tomcat should have its folder - for example "Tomcat 6.0.20 at localhost-config". There is server.xml there, in which you can enable SSL.
When you enable the SSL, the server accepts requests on port 8443 as well as on 8080. The server is not run on a port - it accepts connections on multiple ports. So just type https://localhost:8443/