Examples of HttpServlet


Examples of javax.servlet.http.HttpServlet

        }

        // Just to be safe (the above doesn't seem to return the webapp
        // classpath in all cases), manually do this:

        HttpServlet servlet = (HttpServlet)msgContext.getProperty(
                                         HTTPConstants.MC_HTTP_SERVLET);
        if (servlet != null) {
            String webBase = servlet.getServletContext().
                                                  getRealPath("/WEB-INF");
            classpath.append(webBase + File.separatorChar + "classes" +
                             File.pathSeparatorChar);
            try {
                String libBase = webBase + File.separatorChar + "lib";
View Full Code Here

Examples of javax.servlet.http.HttpServlet

            _connector.setPort(_PORT);
        }

        _server.addConnector(_connector);
        Context context = new Context(_server,"",Context.NO_SECURITY | Context.NO_SESSIONS);
        ServletHolder h = new ServletHolder(new HttpServlet()
        {
            private static final long serialVersionUID = 1L;

            @Override
            protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException
View Full Code Here

Examples of javax.servlet.http.HttpServlet

        server = new Server( 0 );

        Context root = new Context( server, "/", Context.SESSIONS );
        root.setResourceBase( new File( getBasedir(), "/target" ).getAbsolutePath() );
        ServletHolder servletHolder = new ServletHolder( new HttpServlet()
        {
            @Override
            protected void doGet( HttpServletRequest req, HttpServletResponse resp )
                throws ServletException, IOException
            {
View Full Code Here

Examples of javax.servlet.http.HttpServlet

    while (i.hasNext()) {

      String key = (String) i.next();
      String servletName = (String) servlets.get(key);
      HttpServlet servletObject;
      Class servletClass;
      try {
        servletClass = loader.loadClass(servletName);
        servletObject = (HttpServlet) servletClass.newInstance();
        servletObject.init(servletConfig);
        servletObjects.put(key, servletObject);
      } catch (ClassNotFoundException e) {
        e.printStackTrace();
      } catch (InstantiationException e) {
        e.printStackTrace();
View Full Code Here

Examples of javax.servlet.http.HttpServlet

   * @param response
   */
  public void dispatch(String relPath, HttpServletRequest request,
      HttpServletResponse response) {

    HttpServlet servletObject;
    if (servletObjects.containsKey(relPath)) {
      servletObject = (HttpServlet) servletObjects.get(relPath);
    } else {
      // servlet not found??
      return;
    }
    try {
      servletObject.service(request, response);
    } catch (ServletException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (IOException e) {
      // TODO Auto-generated catch block
View Full Code Here

Examples of javax.servlet.http.HttpServlet

    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        LOG.info("BasicAuthFilter initialization started");
        super.init(filterConfig);

        optionsServlet = new HttpServlet() {};
        optionsServlet.init();

        initializeBlackListedUsers();
    }
View Full Code Here

Examples of javax.servlet.http.HttpServlet

          "org.apache.olingo.odata2.core.rest.app.ODataApplication");
      odataServletHolder.setInitParameter(ODataServiceFactory.FACTORY_LABEL, factoryClass.getCanonicalName());
      break;
    case ODATA_SERVLET:
      String odataServlet = "org.apache.olingo.odata2.core.servlet.ODataServlet";
      final HttpServlet httpServlet = (HttpServlet) Class.forName(odataServlet).newInstance();
      odataServletHolder = new ServletHolder(httpServlet);
      odataServletHolder.setInitParameter(ODataServiceFactory.FACTORY_LABEL, factoryClass.getCanonicalName());
      break;
    default:
    }
View Full Code Here

Examples of javax.servlet.http.HttpServlet

    }
    // END BACKWARD COMPATIBILITY

    // Load/get the servlet if we found one.
    if (servletClassName != null) {
      HttpServlet delegatee = tryGetOrLoadServlet(logger, servletClassName);
      if (delegatee == null) {
        logger.log(TreeLogger.ERROR, "Unable to dispatch request", null);
        sendErrorResponse(response,
            HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
            "Unable to find/load mapped servlet class '" + servletClassName
                + "'");
        return;
      }

      // Delegate everything to the downstream servlet and we're done.
      delegatee.service(request, response);
    } else {
      // Use normal default processing on this request, since we couldn't
      // recognize it as anything special.
      super.service(request, response);
    }
View Full Code Here

Examples of javax.servlet.http.HttpServlet

    }
  }

  private HttpServlet tryGetOrLoadServlet(TreeLogger logger, String className) {
    synchronized (loadedServletsByClassName) {
      HttpServlet servlet = (HttpServlet) loadedServletsByClassName.get(className);
      if (servlet != null) {
        // Found it.
        //
        return servlet;
      }

      // Try to load and instantiate it.
      //
      Throwable caught = null;
      try {
        Class servletClass = Class.forName(className);
        Object newInstance = servletClass.newInstance();
        if (!(newInstance instanceof HttpServlet)) {
          logger.log(TreeLogger.ERROR,
              "Not compatible with HttpServlet: " + className
                  + " (does your service extend RemoteServiceServlet?)", null);
          return null;
        }

        // Success. Hang onto the instance so we can reuse it.
        //
        servlet = (HttpServlet) newInstance;

        servlet.init(getServletConfig());

        loadedServletsByClassName.put(className, servlet);
        return servlet;
      } catch (ClassNotFoundException e) {
        caught = e;
View Full Code Here

Examples of javax.servlet.http.HttpServlet

        config.setInitParameter("key1", "value1");
        config.setInitParameter("key2", "value2");
        config.setInitParameter("list", "value1, value2");
        config.setInitParameter("listesc", "value1\\,value2");

        Servlet servlet = new HttpServlet() {
            /**
             * Serial version UID.
             */
            private static final long serialVersionUID = 1L;

View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.