use of org.apache.cxf.ws.eventing.eventsource.EventSourceEndpoint in project cxf by apache.
the class CreateSubscriptionServlet method doGet.
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
try {
resp.getWriter().append("<html><body>");
JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
factory.setServiceClass(EventSourceEndpoint.class);
factory.setAddress("http://localhost:8080/ws_eventing/services/EventSource");
EventSourceEndpoint requestorClient = (EventSourceEndpoint) factory.create();
String expires = null;
if (req.getParameter("expires-set") == null) {
expires = req.getParameter("expires");
} else {
if (!req.getParameter("expires-set").equals("false")) {
expires = req.getParameter("expires");
}
}
Subscribe sub = createSubscribeMessage(req.getParameter("targeturl"), req.getParameter("filter-set") == null ? req.getParameter("filter") : null, expires);
resp.getWriter().append("<h3>Subscription request</h3>");
resp.getWriter().append(convertJAXBElementToStringAndEscapeHTML(sub));
SubscribeResponse subscribeResponse = requestorClient.subscribeOp(sub);
resp.getWriter().append("<h3>Response from Event Source</h3>");
resp.getWriter().append(convertJAXBElementToStringAndEscapeHTML(subscribeResponse));
resp.getWriter().append("<br/><a href=\"index.jsp\">Back to main page</a>");
resp.getWriter().append("</body></html>");
} catch (Exception e) {
throw new ServletException(e);
}
}
Aggregations