I read about Eclipse RAP and understood what a "servlet container" is: some kind of a java applet on a server instead of a client.
I don't understand how RAP applications are rendered on browsers... are they pure Javascript, HTML5, Java applets, or what?
From the Eclipse RAP wiki:
The RAP project aims to enable developers to build rich, Ajax-enabled
Web applications by using the Eclipse development model, plug-ins and
a Java-only API.
So you write your code in Java, and the client UI is rendered using AJAX (read: Javascript.)
This implies XMLHttpRequest is used to update the client interface. Some research indicates that RAP uses a legacy version of the Qooxdoo js library, and they don't plan on upgrading because they want to maintain a lightweight client.
The developer has control over HTML / CSS content.
Also, the servlet container is a dispatcher that handles URL requests and interacts with your servlets. It's responsible for "managing the life-cycle of servlets, mapping a URL to a particular servlet, and ensuring that the URL requester has the correct access rights." [ 1, 2 ]
Related
I am trying to understand application deployment on Google App Engine using java. Looks like if java is used it is more like deployment of a web application which extends java servlet ( HttpServlet ). Let me know if java application can be deployed without using servlet or jsp.
I agree in addition to standard web application deployment it will require GAE specific configuration i.e. appengine-web.xml. But my question is mainly on requirement of servlet for java based deployment.
Sorry for very basic question, but all code samples pointed me to servlet but in document there is no mention about servlet.
As I understand you want to communicate with the server via HTTP. Servlets are most common way to support this protocol in JVM, unless you want to implement protocol in something low level, like in Netty.
Servlet is a set of java interfaces, but it is not required to implement them by yourself. Most Java web frameworks provide some implementation for you. I mean someone should write this servlet once, but most likely it was written by frameworks authors many years ago, you don't even need to think about its implementation.
For example I don't remember writing any Servlet since 2003, but I have plenty of working web apps on GAE. Most of them are Spring based, it have Spring Dispatcher Servlet which does all processing HTTP request/response for you.
So the answer is: yes App Engine is Servlet based app container and you need one, but it's very unlikely you'll write any servlet by yourself
Depending on which tools (frameworks) you are using in App Engine you may OR NOT write Servlets and JSPs. For example if you use Google Endpoints (https://cloud.google.com/endpoints/docs/frameworks/java/about-cloud-endpoints-frameworks), you will not write any servlet yourself: they will be automatically generated by the framework itself.
On the other hand it is totally possible to deploy your own servlets and JSPs, and adapt the web.xml file accordingly.
we got existing JAVA web application which contains: GWT module (Administration panel), java servlets with some other services in src path and war folder with JSP's and other static files like: images, css, js.
Web server: Tomcat 7
To build this project we use ant build script. It compiles the project, GWT module and packs it into war file.
Now, I need to separate front-side (JSPs and other static files) from backend (Java servlets and other code on Java) into different git repositories, to allow front-end developers editing it.
The main problem is how to make deployment system on test server. They need to see their changes in real time.
It's impossible to install tomcat and java on each front-developer's machine also they don't know what is Java and how to compile the project, that's why we have test stage with tomcat.
It is really hard to answer this question without knowing the exact architecture and organization matters of the project.
But the fact is, the JSP files are translated and compiled into Servlet during translation stage (back-end side). Therefore, it would be quite hard to isolate JSP files from rest of Java WebApp.
I would consider including part of front-end HTML's into JSP, i.e.:
<c:import url="http://example.com/frontend/somepart.html" />
Though, you can divide the architecture into:
BackEnd side: served by Tomcat7 (Java, Servlets, JSP)
FrontEnd side: served by HTTP WebServer (Apache, nginx, IIS or other) - HTML, CSS, JS
Dynamic parts of the application could be proxied by some url pattern using mod_jk (in Apache) to be handled by Tomcat. It may be accomplished by using GWT in such way (example):
Develop Front-End side
Include empty DIV with an ID.
Attach GWT module in <script> tag.
GWT modules attached to ID.
After module load, every service operation must be proxied to dynamic part. Lets say you backend is under http://example.com/backend so you need to configure the Apache server to serve the content under /backend pattern from Tomcat server.
Let the FrontEnd developers code the front-end (html, css, js files) and make deployments on HTTP server without interferring with Back-End development. BackEnd developers could easily deliver their work into Tomcat servers.
Hope it helped.
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 am new in JSF and I am starting an application with se following architecture:
JSF Server
Android Client
Some functionalities will be common in Android and JSF (web pages), only the interface will change.
I know how to communicate an Android client with a servlet, but I don't know how to do it with a JSF server. I have searched a lot in web, but nothing was found.
Can someone help me?
JSF is a framework that deals with UI generation (HTML). It is not a "server", but a tool that you can use in a server and that many server offer with its default instalation. In fact, it works on top of servlets.
Given that is HTML, its use would make sense only when you are using an HTML client (web browser). If you are using an android app, you will be better off using messaging frameworks (v.g., SOAP and WS, or directly servlets. You can use bare servlets together with JSF just by mapping the servlets to URLs that do not collide with the JSF ones (if you recall JSF configuration, what you tell the webserver is which URLs will be served by the JSF servlet).
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 :)