For my Java project I need to embed a web server to provide various web pages to the user. Until now we used the "official" com.sun.net.httpserver.HttpServer class, which basically works fine.
However, now we want to extend our application in order to not only serve static HTML pages via the embeded HTTP server, but also dynamic content (PHP if possible).
Any recommendations?
EDIT: Nevermind, I found it quite easy to integrate Jython within my Java application :)
Related
I am working on a personal project/website for classifieds from scratch using AngularJS/HTML5 for the frontend and a Java REST Api that will communicate with a database.
My main question is what are some good options to host such a site without costing me a fortune as it is after all just for personal experience and fun.
I have some java background and therefore i would want to focus on a Java based REST service. I am also learning Angular for the frontend.
What would be an ideal hosting solution for my purposes?
Any thoughts are welcome.
Thanks
Any service that supports Java applications (i.e. Tomcat) and databases should be suffice. AngularJS is client side JavaScript executed on the browser - so hosting plans shouldn't be impacted by this.
You do not need different hosting plan for angular . You can host angular website in tomcat also along with java rest api. Heroku provides free plan along with limitations.
If i want to make a web application in java i mean JSP should I create an Applet and put it into a browser or create "Java web project"?
In other words the big companies system like Oracal and others have there own system by creating java web application or using applet and putting it into browsers.
Thanks
I would create a "Java web project".
Using an applet is considered a bad practice due to all of the security issues, the need for the user to install the correct version of java, and enable it in the browser.
Go with a solid java web framework like spring / spring-mvc. See this guide on how to start: https://spring.io/guides/gs/serving-web-content/
Java Applet runs on client side (in the brouser, like javascript), but JSP is part of Java Servlet API and runs on server side (you need to install servlet container like Tomcat to run them). It's not equivalent technologies with different abilities and application area.
Applets are old fashioned now, Applets were used to create interactive web applications in the early days of http development when developing a interactive website was not possible using any browser based technologies like html, css and java script.
But now the things have changed with the evolution of web-2.0. Now you can develop the interactive web application by using only browser based technologies and you don't have to install any third party tools or plugins like in the case of applet, JRE should be installed on client machine.
I've been browsing through the web but haven't been able to find any concrete topics on the integration of Saiku with Drupal. The main challenge seems to be that Saiku is java-based while Drupal runs off PHP.
I am wondering if anyone has implemented, or can provide thoughts on this union.
Is there anything similar to Saiku that would work with Drupal?
A developer of Saiku could answer you better than me but what I can say is that communication between Saiku-ui and Saiku is REST, so it is pure utilization of HTTP protocol. An integration could be an independent SAIKU server, Drupal relaying requests from the embedded UI inside your content.
Saiku is based on Mondrian, which is also a java library, but it can be deployed as an independent XMLA server. So you could recode Saiku REST services in PHP, which would call the XMLA services.
Well then a developer of Saiku shall answer:
Saiku UI is completely separated from the server and plain JavaScript and HTML, so it would be easy to integrate that somehow into drupal. basically you just need to drop the UI folder into drupal and configure where the server lives (to avoid cross domain issues it would be good if saiku server was connected via mod_jk or mod_proxy on the same apache as drupal runs)
if you want to leverage saiku as olap backend with custom PHP code, there is a framework developed by inovia called PHPAnalytics, that is using saiku server as a backend: http://labs.inovia.fr/phpanalytics/
Although Saiku UI use jquery and html at client side, it still need a restful service sit on top of OLAP engine at back end. The restful server provided by saiku package is java based, just like jpivot and pentatho analyzer. So if you want to integrate it with drupal, either you need to write your own PHP restful service, or you need proxy to another java based service in drupal server.
There is a pure javascript solution at webpivottable.com which provide excel pivot table-like UI to pivot all kinds of OLAP cubes. It's totally at client side and connect to XMLA service directly, so no back end dependencies. You can give it a try and it can easily to be integrated to any web site and web application. Here is a demo
How do I connect my Java Desktop application with a PHP Web Application. Any example codes and technologies I should know of? I just want a simple implementation (its a school project and I don't have much time to perfect it)
On the web side, perhaps I can have a REST-ful API. But what about the Java Desktop side (I'm more of a web developer). How can I pull & pull data from my Java app?
You can create an http-endpoint in the desktop app as well. For instance you can embed a simple servlet container like jetty.
Once you have a servlet container, you can use something like Jersey to write a REST API (or you can just use the Servlet API).
Another option is to create a ServerSocket in the java app, and connect to it from the php app.
There is also a php-java bridge, if you want to get really fancy ;)
I have already generated the files using wsdl2Java and created the proxy client in JAVA.I am using Apache CXF framework and using Maven as Build Management tool. I can run the JAVA application and consume the service using JAVA. There is no problem with JAVA implementation.
The need is I need to invoke and request the same web service from PHP or JSP file and display the result in PHP or JSP file. I would like to use the present JAVA code. I don't know how to invoke the JAVA code from PHP or JSP page.
Please help me with the solutions.
You have created a web service, so your design should be centered around that. For Java programs (including JSP's) you can use the generated client classes to access the web service. For PHP I would recommend using one of the many SOAP client libraries to process and consume your WSDL. You might want to take a look at wsdl2php, NuSoap, or SoapClient.