Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2003, 2007 s IT Solutions AT Spardat GmbH . All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html Contributors: s IT Solutions AT Spardat GmbH - initial API and implementation /
/*
 * Created on 02.09.2003
 */
package at.spardat.xma.boot.servlet;
import  javax.servlet.ServletException;
import  javax.servlet.http.HttpServlet;
import  javax.servlet.http.HttpServletRequest;
import  javax.servlet.http.HttpServletResponse;

Author(s):
S2267 To change the template for this generated type comment go to Window>Preferences>Java>Code Generation>Code and Comments
public class XmaLauncherServlet extends HttpServlet {
    static final private String CONTENT_TYPE = "application/x-xmalauncher; charset=UTF-8";
     //static final private String CONTENT_TYPE = "application/x-xmalauncher";
    public void doGet(HttpServletRequest req, HttpServletResponse response)
        throws ServletException, IOException {
  // Set content type and create a new PrintWriter to write the data in UTF-8*/
         response.setContentType();
        //PrintWriter out = response.getWriter();
          PrintWriter out = new PrintWriter(new OutputStreamWriter(response.getOutputStream(), "UTF8"), true);
          out.println("[Component]");
          out.print("name=");
          String url=req.getRequestURL().toString();
          int index = url.lastIndexOf(".");
          if (index >=0){
             out.print(url.substring(0, index));
          }
         out.println();
         if (req.getQueryString()!=null){
          out.println();
          out.println("[Params]");
          Enumeration params = req.getParameterNames();
          while (params.hasMoreElements()) {
            String name = (Stringparams.nextElement();
            String values[] = req.getParameterValues(name);
            if (values != null) {
              for (int i = 0; i < values.lengthi++) {
                 out.print(name);
                 out.print("=");
                 out.print(values[i]);
                 out.println();
              }
            }
          }
         }
         out.close();
     }
New to GrepCode? Check out our FAQ X