Communicating Android Client and JSF server - java

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).

Related

Google App Engine Java Deployment and Servlet/jsp relationship

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.

Embedable Java-based HTTP server with (PHP) scripting support

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 :)

How is client-side rendering done in Eclipse RAP?

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 ]

How to identify whether a web server supports Web Services or not?

I am not much aware about the details as to which web servers support Web services written in Java.
Would Like to know the following three things:
1) What is required to have support for Web Services : Only Servlet Container or An Application Server + Web container?
2) Would like to know that do all Web Server supporting web development in Java support Web Services?
3) How to identify whether a particular server supports Web Services or not?
Thanking you in advance.
Your question is somewhat unclear. The term web service is applied to anything from a REST style API to SOAP based services to JSON based, etc etc. Wikipedia says an equivalent is a Web API, and an API can be pretty much anything.
So to answer your question. A servlet container is enough to support most common types of web services, it doesn't require an application server. Take a look at Apache CXF, which is a framework catering for a lot of web services styles (notably SOAP and REST).
Apache CXF is a rather large framework, and can take some time to get your head around. If you need something simpler, you may be better off looking at some object serialization frameworks and implement the servlets yourself (this is what I do mostly). To serialize to XML, use out-of-the box Java JAXB annotations. To serialize to JSON, use Jackson.
Assuming you're talking about SOAP WS-* web services via JAX-WS.
Java EE 5+ stipulates support for JAX-WS compatible web services within the container, both at the Web App level, and at the EJB level. So, any full boat, modern, App Server will have JAX-WS support built in.
Servlet 2.x and 3.0 do not have a requirement to support JAX-WS at the container level, but all of the major implementation of JAX-WS can be deployed within a WAR in a modern Servlet container (like Tomcat).
Java EE 6 offers a Web Profile, but the Web Profile does not include JAX-WS. Java EE 6 Full Profile includes both JAX-WS (SOAP, WS-* web services), and JAX-RS (for HTTP and more RESTful web services).
So.
If you bundle your own implementation, all of the containers should accommodate you. If you want it built it to the container, you'll need a full Java EE 5 or Java EE 6 App Server.

Java Web Service for .NET 2.0 Client on Linux (Fedora)

I'm tasked with creating a Java Web Service for a .NET 2.0 client to consume.
What would your suggestions for the implementation be?
The solution doesn't need to be very heavyweight (don't need a full Java EE container I believe) but what do you think is the best solution for this? I have thought about using Glassfish v2 with JAX-WS annotations (#WebService), and JAXB XML Bindings(e.g. #XmlElement), which I assume the .NET client would be able to consume?
Has anyone tried this scenario?
Would Glassfish be overkill though, since I'm merely using the Web Service as a mechanism for .NET on Windows to communicate to the Linux box, the underlying application is extremely small.
Any suggestions are more than welcome :)
Thanks,
James
P.S. Other notes - would you use Axis/CXF instead of Glassfish? Would you use a servlet container such as Tomcat? etc.
I have used Axis2 and it works.
I had the same problem of making Data Exposing API (Web Service in my case) in Java.
I made the web service using Axis2 and Spring (to access database) and the WSDL created via Axis2 was easily consumed via ASP.NET Application via its Add Web Service Dialog Box and the corresponding Proxy Classes were created easily.

Categories