Package javax.servlet.http

Examples of javax.servlet.http.HttpServlet$NoBodyResponse


            _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


        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

    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

   * @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

    @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

          "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

    }
    // 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

    }
  }

  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

        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

        // create a servlet config
        final MockServletConfig config = new MockServletConfig();
        config.setServletContext(context);

        // create a servlet
        Servlet servlet = new HttpServlet()
        {
            /**
             * Serial version UID.
             */
            private static final long serialVersionUID = 1L;
View Full Code Here

TOP

Related Classes of javax.servlet.http.HttpServlet$NoBodyResponse

Copyright © 2018 www.massapicom. 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.