Java – web services using Google App Engine
•
Java
I see that Google App Engine can host web applications that will return HTML and so on But what about web services that communicate through HTTP and accept / return XML?
Who knows how to do this in the goggle App Engine Using python, or how to do it in Java (jas-wx is not supported)? Any link o samples or articles are highly appreciated
Thank you / /:)
Solution
Google App Engine allows you to write web services that return any type of HTTP response content This includes XML, JSON, text, etc
For example, take a look at the guestbook sample project provided by Google, which shows that the HTTP response is returned in the form of text / plain:
public class GuestbookServlet extends HttpServlet { public void doGet(HttpServletRequest req,HttpServletResponse resp) throws IOException { UserService userService = UserServiceFactory.getUserService(); User user = userService.getCurrentUser(); if (user != null) { resp.setContentType("text/plain"); resp.getWriter().println("Hello," + user.getNickname()); } else { resp.sendRedirect(userService.createLoginURL(req.getRequestURI())); } } }
In addition, App Engine Google Group is a good place to learn more, ask questions and view sample code
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码