I have a server which access DB and uses Apache MINA for managing connections.
I would like to expand this server and allow it to handle REST requests and I would like that every REST resource will have access to my server's context.
I have started implementing a Dynamic Web Application using Jersey 1.18 using Tomcat as container.
But I cannot figure out how to combine my server with the web service...
Is there a way to initialize the Jersey stack inside my custom service and avoid the Tomcat ??
I hope my question makes sense...
Thank you,
Oren
Related
I have developed a Spring MVC app that can detect Ajax requests sent into my local environment 'localhost:8000/examplePath' with a json body being received as a mapped parameter. So, until here, all is fine.
My question is: Do i still need to deploy my application on a container 'Apache Tomcat/ HTTP Server for example' for my application to be accessible externally on a possible production environment, and if so why?
I want to better understand the necessity of such, if my backend 'Spring MVC app' can already receive and respond to ajax requests
Spring MVC creates a Web application that must be deployed to a Web Application Server to run. The server handles the low level stuff such as raw sockets and the HTTP protocol.
This is because you can't access from internet to your local environment, you need a public adress to access your application from everywhere only if you want to access it over internet otherwise can do it with a local network connection to access it.
If you want any container, you can do it easy with Pivotal. This a container platform for Spring apps.
I've got a simple SPA Sprint Boot application - executable jar with embedded tomcat and looking to plug it into siteminder with preauthenticatedauthenticationprovider. Application is http://someserver:1234
Documentation states that a WebAgent is installed on a web server and that 'intercepts' requests. Would the WebAgent be deployed in a separate container? If so, how does it intercept requests? All documentation refers to this intercept, but doesn't state the mechanism.
Does it need to be deployed inside the same container to intercept requests? The only way I can think any http headers are intercepted is through proxies.
There are 2 ways to configure Web Agent.
1. Local Configuration
- Setup Agent in the sever where Applciaiton is hosted.
2. Centralized Configuration
- Setup Agent in the a web server like Apache and add proxy entries to the backend applications. this configuration intercepts each and every request going from the webagent server. I recommend this. if you have still questions drop here.
- Thanks,
Chiranjeevi
I have had lots of trobule trying to get my head around how to solve this scenario:
We have an integration application that uses Camel for integration. This application also has a REST Api that exposes some services providing information about the application, for instance listing the active routes etc.
I have created a user interface for this using AngularJS that connects to these rest services. My main problem is how can I package this application as a self contained jar-file that provides the user interface and all the camel integration.
My working theory: Use a separate Jetty server to serve the Angular JS files and let Camel expose the REST services. The problem with this is CORS since the REST services reside on another port than the jetty server serving the Web UI.
Some requirements for the solution:
Must be a single self contained jar-file.
The camel integration is the main purpose, the Web UI is secondary
and only used for trouble shooting. No need for a high performance
web container since the Web ui is used by only a handful of users.
I have been struggling with this for a couple of days now and it feels like I am over complicating the solution. Help on how to solve this is greatly appreciated.
You could take a look at hawtio
http://hawt.io/
as that is how we do that, hawtio is a web console for java, and has plugins for Camel. Its built using angularjs, and uses REST to communicate with the local or remote Java JVMs. To make the REST calls easier we use Jolokia.
Jolokia requires an agent to be embedded in the JVM, eg where Camel runs. Then that helps with CORS et all. http://jolokia.org/reference/html/security.html#d0e2490
I want to run a standalone java application on a remote server. It would not be accessible to clients, but would do background calculations and interact with a database and Secure Socket connection to a third party site. It would also interact with a php site.
Do I have to deploy this with JSP, or can I write a standalone application? If so, how would I deploy a standalone java application (jar file) on a remote server? I understand that I must have them install a jvm on the server (not a problem) but then how would I deploy it (if possible). Would I start it with a command line?
I know I have much to learn, but I am not sure how I would access the command line on a remote server. Through the cPanel?
Thanks.
First of all, you'll want to set up some firewall rules to allow access to that server. I'm hoping that you don't expose that server naked to the Internet.
If all you need is database access exposed on the Internet, I don't see why it can't be a secured web app deployed on a servlet/JSP engine and accessed via a web server. You can leverage basic auth for security, JDBC access to the database from the server, and servlets as controllers to accept requests in a nice REST API.
It'll save you the complications of sockets and inventing your own protocol (use HTTP), starting and stopping the application (now it's just a web server/servlet engine), and deployment (send a WAR file).
Does it really must be a 'standalone' application? I think that in your case the best match would be to use Spring container to load your application within some server (tomcat?) and expose services via standard controllers - with Spring you only have to add some annotations on services methods actually.
Then, your php site can interact with these controllers using for example ajax requests.
If your application is written already, you can easily transform it to run within Spring container. It's very non-invasive and promotes usage of POJOs.
I am looking to use Jersey without the need of installing an application server such as Tomcat or Glassfish. Ideally I would like to create a lightweight program that listens on a port and allows connections. I believe you can do this with Grizzly + Jersey but I am not sure how easy this is, because from my understanding Grizzly is used to write new http servers from scratch?
Restlet looked good in this regard because it included an internal http server but the documentation provided is extremely meager.
You can use a light-weight servlet container like jetty. you can bundle and ship this with your application. Also building and shipping jetty with your application is very easy.
I've deployed an app recently that uses embedded Jetty in Spring to launch Jersey, so this is 100% possible. Jersey, in fact, has a SpringServlet for easy delegating to a Spring context based REST implementation. If you have additional questions down this route, let me know. It wasn't the most straight forward, but I can talk you through some of it with the appropriate links.