package myservlets; import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import java.util.*; import app.myapps.util.*; public class MyServlet extends HttpServlet { /** * Parameterless constructor , that invokes the super class constructor */ public MyServlet() { super(); } public void service(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { init(req,res); String xml = req.getParameter("xml"); String value = Parser.getResourceTag(xml); System.our.println(" resource is == " +value); } public void init(HttpServletRequest req, HttpServletResponse res) { addServerInfo(req); } private void addServerInfo(HttpServletRequest req) { String prot = req.getProtocol(); path = req.getServletPath(); if (prot.indexOf("/")>0) { prot = prot.substring(0,prot.indexOf("/")); } path = path.substring(0,path.lastIndexOf("/")); path = "/app"+path; System.out.println("PATH = " +path); //sinfo=prot+"://"+req.getServerName()+":"+req.getServerPort()+path; sinfo=prot+"://"+req.getServerName()+":"+req.getServerPort()+path; svrInfo= prot+"://"+req.getServerName()+":"+req.getServerPort(); System.out.println("SINFO == "+sinfo); System.out.println("SVRINFO --"+svrInfo); } }