Proxy for Tomcat outgoing HTTP requests - java

I have a JavaEE web application deployed in an Apache Tomcat 7.0.6 under Windows 7 which comunicates with a remote web service to request some data. I would like to intercept the comunication between them with an HTTP proxy, like BurpSuite (http://www.portswigger.net/burp/), so I can see the HTTP messages sent and received by the JavaEE application deployed in Tomcat. Already tried to set my BurpSuite (listening on port 8090/TCP) as a proxy system in Windows 7 and specifying some options for JVM when runs Tomcat (-Dhttp.proxyHost=10.0.2.16 -Dhttp.proxyPort=8091 -Dhttps.proxyHost=10.0.2.16 -Dhttps.proxyPort=8091).
I've been looking for a way to do this but I didn't find anything usefull. Could you please give me hand?
Greetings and thanks in advance.

Related

How to configure Tomcat 8 as a go-between proxy?

A Tomcat server on my server is running on port 8080.
We are in need to use the Tomcat server to get user requests and forward those to corresponding proxy server running on another server (111.111.111.111:9090, user: XXX, pw: YYY).
So: We need to configure Tomcat to transfer requests to another server.
You can't do this out of the box with Tomcat. It does not include HTTP reverse proxy functionality. You'd either need to find a 3rd-party module to do this (I'm not aware of any) or code up something yourself - e.g. using Apache HttpClient.

Running Tomcat service on same port as IIS Service

I'm trying to set up three services to run on the same port (port 80). Two of the services are hosted on IIS thus enabling bindings to use the same port. One of the three services is however hosted on a Tomcat server as it is a Java Servlet. How can i set this up so that all can be accessed through port 80?
I've tried using URL Rewrite in the IIS to forward the request to port 8080 where the Tomcat service is active but it doesn't work with other services being active on port 80.
Any other ideas?
EDIT
I have no support for URL Rewrite not working for this purpose other than my own attempts. If anyone have used it and knows it should work, please shout out as it would be an optimal solution with minimal complexity to the system!

Running a Java Application to run on a tomcat sever

I have created a Socket Server application that will accept Client connections from other computers on the local network. This is application is run from a public static void main method. and is a very standard java application.
I have also created a web service that runs on tomcat, it also uses java. The web service will http post accept request from any internet connected device.
Once the web service receives a request I would like it to send instructions through the socket server and send some data to the client connected.
I would like to run the socket server applicaiton within the web service so that the web service has access to the socket server without having to connect as a client.
What is the best way to run a standard java app so that the tomcat server will start the application when it starts up? should i run it as a servlet or is there a better way to have the web service access the socket
An application opening its own server socket within a proper application server is pointless and possibly counter productive IMO.
Think about it: Tomcat is probably running on port 8080. Your application is hypothetically going to be running on port 9080. What port do you think clients will need to connect to, to consume your service? And if you answered that correctly, what service/benefit are you then expecting Tomcat to provide you, if your clients are in fact, not going to interact with tomcat at all?
You don't need a (full) application server to run your own personal server. You have the option of:
a Java web service without a web application server, which lets you deploy a full JAX-WS webservice within the vanilla JSE, no application server required
Using the jdk's embedded HTTP server to process your requests
Deploying your standalone application as a windows (or other OS) service

Websocket on Tomcat 7.0.39 on openshift

I've just successfully installed Apache Tomcat 7.0.39 on my openshift account (tomcat-ngoanhtuanthesis.rhcloud.com/). I know that tomcat 7.0.39 has supported Websocket. In my local computer, I can run my web socket aplication properly, but I cannot run it in the openshift server. However, my web service application can run very well. I've searched over the Internet for the whole week but I couldn't find any solution. Can anyone help me? Thank you in advance!
Note: here is my Web service:
tomcat-ngoanhtuanthesis.rhcloud.com/TrueTrafficServerAlpha2/
And here are some websocket examples integrated in Tomcat 7.0.39. These examples cannot run even though they are very simple.
http://tomcat-ngoanhtuanthesis.rhcloud.com/examples/websocket/
Did you read this? https://www.openshift.com/blogs/paas-websockets
WebSockects are currently under staging on openshift, and are available on alternative ports.
How to access Preview WebSockets Support?
You will need to connect to
specific ports, as the main routing layer is still Apache based and
does not support WebSockets.
So, for plain WebSockets ws:// you will use port 8000 and for secured
connections wss:// port 8443. Here's an example:
http://app-lovingwebsockets.rhcloud.com/ <= your current HTTP URL
http://app-lovingwebsockets.rhcloud.com:8000/ <= WebSockets enables HTTP URL
https://app-lovingwebsockets.rhcloud.com/ <= your current HTTPs URL
https://app-lovingwebsockets.rhcloud.com:8443/ <= WebSockets enables HTTPs URL
So, just open your samples here, and they will just work (hopefully):
https://tomcat-ngoanhtuanthesis.rhcloud.com:8443/examples/websocket/

URL Rewrite IIS and Glassfish from port 8080 to 80

I'm running a glassfish server that handles all jsp and servlets.
Now there is a way to get it working so that you can run IIS on port 80 and glassfish on port 8080, now the problem is:
When i request http://localhost/myWebApplication it should rewrite the url and use http://localhost:8080/myWebApplication
Basically I make a request to IIS, but the response I get back must be from Glassfish.
When I request the url with port 8080 it works, because its getting it from Glassfish, but i need to go through IIS to Glassfish.
Here is a website that explains it all: http://jstoup.wordpress.com/2012/04/25/how-to-integrate-glassfish-with-iis/
but I still can't get it working.
I have got no idea how my url rewrite rules must be set up.
This is James from the blog you referenced. If you haven't gotten this working you may have to enable your server farm as a proxy. If you select your web farm there should be a proxy config in the center console. All you should have to do is turn that on and you should be good to go. Let me know if you've got any problems

Categories