Package dijjer.io.xfer.http

Examples of dijjer.io.xfer.http.HTTPResponse


          return dumpError(uc.getResponseCode(), uc.getResponseMessage(), "This error (code "
              + uc.getResponseCode() + ") was returned to Dijjer by " + uc.getURL().getHost() + ".");
        }
      }
      // Respect caching headers
      HTTPResponse resp = cachingNotAllowed(uc, reqUrl);
      if (resp != null) {
        return resp;
      }
      byte[] initialSniffBytes = new byte[INITIAL_SNIFF_BYTES];
      uc.getInputStream().read(initialSniffBytes);
View Full Code Here


        Logger.error(e);
        return dumpError(HttpURLConnection.HTTP_OK, "Could not update",
            "Dijjer could not update or no newer build found.");
      }
     
      return new HTTPResponse(HttpURLConnection.HTTP_OK, "OK", "Reload Successful") {

        String output =
            "<html><head><title>Reload Successful</title>"
            + "<style type=\"text/css\">"
            + "body { background: #FAFAFA; font-family: Verdana, Arial, sans-serif; font-size: 11px;}"
View Full Code Here

  public HTTPResponse handleRequest(String method, String url, Map params, Map headers, Reader in)
  {
    if ("yes".equals(getParam(params, "confirm"))) {
      Logger.info("Shutting down due to request on web interface");
      return new HTTPResponse(HttpURLConnection.HTTP_OK, "Shutting Down", "text/plain") {

        String _output = "Dijjer will now shutdown";

        protected long getContentLength()
        {
          return _output.length();
        }

        protected void writeTo(OutputStream out) throws IOException
        {
          out.write(_output.getBytes());
          out.close();
          System.exit(0); // Temporary until Mason can take a look
          /*
          new Thread(new Runnable() {
            public void run() {
              try {
                                new Thread(){
                                    public void run()
                                    {
                                        try {
                                            Thread.sleep(2000);
                                        } catch (InterruptedException e) {
                                            e.printStackTrace();
                                        }
                                        System.exit(945);
                                    }
                                }.start();
                Loader.stopLoader();
              } catch (Exception e) {
                Logger.error(e);
                System.exit(195);
              }
            }
          }).start(); */
        }
      };
    } else {
      return new HTTPResponse(HttpURLConnection.HTTP_BAD_REQUEST, "NOT Shutting Down", "text/plain") {

        String _output = "You must check the Confirm box";

        protected long getContentLength()
        {
View Full Code Here

TOP

Related Classes of dijjer.io.xfer.http.HTTPResponse

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.