1 6 7 package org.netbeans.modules.exceptions; 8 9 import java.io.IOException ; 10 import java.io.ObjectOutputStream ; 11 import java.io.OutputStream ; 12 import java.io.PrintWriter ; 13 import java.sql.SQLException ; 14 import javax.servlet.ServletException ; 15 import javax.servlet.http.HttpServlet ; 16 import javax.servlet.http.HttpServletRequest ; 17 import javax.servlet.http.HttpServletResponse ; 18 23 public class ComponentsServlet extends HttpServlet { 24 25 29 protected void processRequest(HttpServletRequest request, HttpServletResponse response) 30 throws ServletException , IOException { 31 response.setContentType("text/html;charset=UTF-8"); 32 PrintWriter out = response.getWriter(); 33 43 out.close(); 44 } 45 46 protected void doPut(HttpServletRequest request, HttpServletResponse response) 47 throws ServletException , IOException { 48 try { 49 java.util.logging.Logger.getLogger(ComponentsServlet.class.getName()).log(java.util.logging.Level.INFO, "SENDING COMPONENTS"); 50 OutputStream stream = response.getOutputStream(); 51 ObjectOutputStream oStream = new ObjectOutputStream (stream); 52 oStream.writeObject(Utils.getComponents()); 53 oStream.close(); 54 stream.close(); 55 } catch (SQLException ex) { 56 java.util.logging.Logger.getLogger(ComponentsServlet.class.getName()).log(java.util.logging.Level.SEVERE, 57 ex.getMessage(), ex); 58 }; 59 60 } 61 62 67 protected void doGet(HttpServletRequest request, HttpServletResponse response) 68 throws ServletException , IOException { 69 processRequest(request, response); 70 } 71 72 76 protected void doPost(HttpServletRequest request, HttpServletResponse response) 77 throws ServletException , IOException { 78 processRequest(request, response); 79 } 80 81 83 public String getServletInfo() { 84 return "Short description"; 85 } 86 } 88 | Popular Tags |