Package org.w3c.jigsaw.http

Examples of org.w3c.jigsaw.http.HTTPException


  try {
      gen_enum = getCvsManager().listFiles() ;
      names = Sorter.sortStringEnumeration(gen_enum);
      nofile = (names.size() == 0);
  } catch (CvsException ex) {
      throw new HTTPException(error(this, request,
            "unable to list files",ex));
  }

  // get a vector of directory entries
  try {
      gen_enum = getCvsManager().listDirectories();
      dirnames = Sorter.sortStringEnumeration(gen_enum);
      nodir  = (dirnames.size() == 0);
  } catch (CvsException ex) {
      throw new HTTPException(error(this, request
            , "unable to list directories"
            , ex));
  }

  String head = " [ <a href=\"./\">Up to directory</A> ]";
View Full Code Here


  try {
      d.parse () ;
  } catch (URLDecoderException e) {
      Reply error = request.makeReply(HTTP.BAD_REQUEST) ;
      error.setContent("Invalid request:unable to decode form data.");
      throw new HTTPException (error) ;
  } catch (IOException e) {
      Reply error = request.makeReply(HTTP.BAD_REQUEST) ;
      error.setContent("Invalid request: unable to read form data.");
      throw new HTTPException (error) ;
  }

  String action = d.getValue("action") ;
  return (action == null ? "unknown" : action);
    }
View Full Code Here

  // no action, is a bug in the generated form (see get)
  if ( action == null ) {
      Reply error = request.makeReply(HTTP.INTERNAL_SERVER_ERROR) ;
      error.setContent("No action selected !");
      throw new HTTPException (error) ;
  }

  // Check action's scope:
  Enumeration gen_enum = null;
  Vector      targets  = new Vector() ;

  if ( scope.equals("directory") ) {
      // Apply action to the whole directory:
      return performDirectoryAction(action, request, data);
  } else if ( scope.equals("subdir") ) {
      // Apply action to the subdirectories
      // Get the list of targets to act on:
      try {
    gen_enum = getCvsManager().listDirectories() ;
      } catch (CvsException ex) {
    error(this, request, "unable to list directories", ex);
      }
  } else {
      // Apply action to the files
      // Get the list of targets to act on:
      try {
    gen_enum = getCvsManager().listFiles() ;
      } catch (CvsException ex) {
    error(this, request, "unable to list files", ex);
      }
  }

  if ( scope.equals("regexp") ) {
      // direct perform
      String regval = (String) data.getValue("regval") ;
      String comment = (String) data.getValue("comment") ;
      if (action.equals("remove") || action.equals("revert")) {
    throw new HTTPException(error(this, request,
                "Can't perform "+action+
                " with regular expression.",
                "<center><b>"+regval+
                "</b></center>"));
      }
View Full Code Here

    {
  Reply error = request.makeReply(HTTP.UNAUTHORIZED) ;
  error.setContent ("<p>Invalid server configuration</p>"
        + "<p>The server defines an authentication filter "
        + " with no <strong>authenticate</strong> method.");
  throw new HTTPException (error) ;
    }
View Full Code Here

      HtmlGenerator g = new HtmlGenerator("Unauthorized");
      g.append ("<h1>Unauthorized access</h1>"+
          "<p>You are denied access to this resource.");
      e.setStream(g);
      request.skipBody();
      throw new HTTPException (e);
  } else {
      security.updateRequestStates(request, princ);
  }
    }
View Full Code Here

      if (out.size() > 0) {
    Reply error = request.makeReply(HTTP.INTERNAL_SERVER_ERROR);
    error.setStream(out.getInputStream());
    error.setContentLength(out.size());
    error.setContentType(MimeType.TEXT_PLAIN);
    throw new HTTPException(error);
      }
  }
  //load class now
  try {
      GeneratedClassLoader loader = getClassLoader();
View Full Code Here

  } catch(SSIException ex) {
      reply = createDefaultReply(request,HTTP.INTERNAL_SERVER_ERROR) ;
      reply.setContent("SSIFrame is misconfigured: "+
           ex.getMessage());
      throw new HTTPException(reply) ;
  } catch(Exception ex) {
      ex.printStackTrace() ;
      if(SSIFrame.debug) {
    if(SSIFrame.debug)
        System.out.println("@@@@ Fallback to FileResource") ;
View Full Code Here

  }
  HtmlGenerator g = new HtmlGenerator("Unauthorized");
  g.append ("<h1>Unauthorized access</h1>"
      + "<p>You are denied access to this resource.");
  e.setStream(g);
  throw new HTTPException (e);
    }
View Full Code Here

        + " on " + name
        + " with the following error message: "
        + "<em>" + cvs_ex.getMessage() + "</em>"
        + "<hr> from class: " + this.getClass().getName()) ;
    error.setStream (g) ;
    throw new HTTPException (error) ;
      } catch (InvalidResourceException ex) {
    Reply error = request.makeReply(HTTP.INTERNAL_SERVER_ERROR) ;
    HtmlGenerator g = getHtmlGenerator("CVS log command failed") ;
    g.append ("<p>The CVS <strong>log</strong> command failed "
        + " on " + name
        + " with the following error message: "
        + "<em>" + ex.getMessage() + "</em>"
        + "<hr> from class: " + this.getClass().getName()) ;
    error.setStream (g) ;
    throw new HTTPException (error) ;
      } finally {
    rr_cvsframe.unlock();
      }
      Reply reply = request.makeReply(HTTP.OK) ;
      reply.setContentType (MimeType.TEXT_HTML) ;
View Full Code Here

        + " on " + name
        + " with the following error message: "
        + "<em>" + cvs_ex.getMessage() + "</em>"
        + "<hr> from class: " + this.getClass().getName()) ;
    error.setStream (g) ;
    throw new HTTPException (error) ;
      } catch (InvalidResourceException ex) {
    Reply error = request.makeReply(HTTP.INTERNAL_SERVER_ERROR) ;
    HtmlGenerator g = getHtmlGenerator("CVS diff command failed") ;
    g.append ("<p>The CVS <strong>diff</strong> command failed "
        + " on " + name
        + " with the following error message: "
        + "<em>" + ex.getMessage() + "</em>"
        + "<hr> from class: " + this.getClass().getName()) ;
    error.setStream (g) ;
    throw new HTTPException (error) ;
      } finally {
    rr_cvsframe.unlock();
      }
      // if there are no differences, generate a dummy report
      Reply         reply = request.makeReply(HTTP.OK) ;
View Full Code Here

TOP

Related Classes of org.w3c.jigsaw.http.HTTPException

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.