1/*2 * Copyright 2001-2009 The Apache Software Foundation.3 * 4 * Licensed under the Apache License, Version 2.0 (the "License");5 * you may not use this file except in compliance with the License.6 * You may obtain a copy of the License at7 * 8 * http://www.apache.org/licenses/LICENSE-2.09 * 10 * Unless required by applicable law or agreed to in writing, software11 * distributed under the License is distributed on an "AS IS" BASIS,12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.13 * See the License for the specific language governing permissions and14 * limitations under the License.15 */16package org.apache.juddi.servlets;
1718import java.io.IOException;
19import java.io.PrintWriter;
20import java.util.Iterator;
2122import javax.servlet.ServletException;
23import javax.servlet.http.HttpServlet;
24import javax.servlet.http.HttpServletRequest;
25import javax.servlet.http.HttpServletResponse;
2627import org.apache.commons.collections.Buffer;
28import org.apache.juddi.subscription.NotificationList;
293031/**32 * This servlet is used print out notifications received33 * from subscriptions in the subscription portal. This servlet is34 * used for this demo only and has no other purpose.35 * 36 * @author <a href="mailto:tcunning@apache.org">Tom Cunningham</a>37 */38publicclassNotifyServletextends HttpServlet
39 {
40privatestaticfinallong serialVersionUID = 4862936257096400737L;
4142 @SuppressWarnings("unchecked")
43publicvoid doGet(HttpServletRequest request,
44 HttpServletResponse response) throws45 ServletException, IOException {
46 StringBuffer sb = new StringBuffer();
4748 Buffer nl = NotificationList.getInstance().getNotifications();
49 Iterator<String> it = nl.iterator();
50while (it.hasNext()) {
51 String notification = (String) it.next();
52 sb.append(notification);
53 }
54 nl.clear();
55 PrintWriter out = response.getWriter();
56 out.println(sb.toString());
57 }
58 }