Package org.w3c.jigsaw.http

Examples of org.w3c.jigsaw.http.HTTPException


      throws ProtocolException, ResourceException
    {
  String method = request.getMethod() ;
  Reply error   = request.makeReply(HTTP.NOT_IMPLEMENTED) ;
  error.setContent("Method "+method+" not implemented.") ;
  throw new HTTPException (error) ;
    }
View Full Code Here


    {
  if (dresource == null) {
      Reply error = request.makeReply(HTTP.NOT_IMPLEMENTED) ;
      error.setContent("Method "+request.getMethod()+
           " not implemented.") ;
      throw new HTTPException (error) ;
  }

  Enumeration  e         = dresource.enumerateResourceIdentifiers() ;
  Vector       resources = Sorter.sortStringEnumeration(e) ;
  int          rsize     = ((resources == null) ? 0 : resources.size()) ;
View Full Code Here

    " is not associated with a FILE. Try again later.";
      Reply error = error( request,
         HTTP.FORBIDDEN,
         "Error",
         msg );
      throw new HTTPException(error);
  }
  //Get the user name
  String u = (String)request.getState(AuthFilter.STATE_AUTHUSER);
  String env[] = {"USER="+u , "LOGNAME="+u };
  //delete the file
  fresource.getFile().delete();
  //cvs remove
  String names[] = new String[1];
 
  names[0] = fresource.getFilename();
  if (names[0] == null)
      names[0] = fresource.getIdentifier();
  try {
      if (getCvsManager().status(names[0]) != CVS.FILE_Q) {
    getCvsManager().remove(names,
               "Deleted via HTTP delete method.",
               env);
      }
  } catch (CvsException cvs_ex) {
      String msg="Cvs remove failed : "+cvs_ex.getMessage();
      getServer().errlog(this, msg);
  }
  try {
      //delete the FileResource
      fresource.delete();
  } catch (MultipleLockException ex) {
      String msg = "Can't delete resource: "+resource.getIdentifier()+
    " is locked. Try again later.";
      Reply error = error( request,
         HTTP.FORBIDDEN,
         "Error",
         msg );
      throw new HTTPException(error);
  }
  //well done
  return request.makeReply(HTTP.NO_CONTENT) ;
    }
View Full Code Here

  if (putlist == null) {
      Request request = (Request) req;
      Reply error = request.makeReply(HTTP.INTERNAL_SERVER_ERROR) ;
      error.setContent("The PutListFrame must be associated "+
           "with a PutListResource only!!");
      throw new HTTPException(error);
  }
  return super.perform(req);
    }
View Full Code Here

    gerr.append ("<H1>Warning</H1> The file on publish space has "+
           "been modified directly and attempting to merge"+
           " has failed.<p>"+
           "Ask your system administrator.");
    error.setStream(gerr);
    throw new HTTPException(error);
      }
  } else if ( action.equals("delete") ) {
      DeletedEntry de = (DeletedEntry) putlist.getDelEntry(key);
      if (de == null) {
    // We're in troubles !
View Full Code Here

  updateCachedHeaders();
  // Is this resource writable ?
  if ( ! getPutableFlag() ) {
      Reply error = request.makeReply(HTTP.NOT_ALLOWED) ;
      error.setContent("Method PUT not allowed.") ;
      throw new HTTPException (error) ;
  }
  HttpEntityTag etag = getXMPETag();
  // no IfMatch, or no matching ETag, maybe a PUT on the image
  int cim = checkIfMatch(request, etag);
  if ((request.getIfMatch() == null) ||
      (cim == COND_FAILED) || (cim == COND_WEAK)) {
      return super.putFileResource(request);
  }
  // check all the others validator

  // Check remaining validators (checking if-none-match is lame
  // as we already require the If-Match
  if ((checkIfNoneMatch(request, etag) == COND_FAILED)
      || (checkIfModifiedSince(request) == COND_FAILED)
      || (checkIfUnmodifiedSince(request) == COND_FAILED)) {
      Reply r = request.makeReply(HTTP.PRECONDITION_FAILED);
      r.setContent("Pre-condition failed.");
      return r;
  }
  // Check the request:
  InputStream in = null;
  try {
      in = request.getInputStream();
      if ( in == null ) {
    Reply error = request.makeReply(HTTP.BAD_REQUEST) ;
    error.setContent ("<p>Request doesn't have a valid content.");
    throw new HTTPException (error) ;
      }
  } catch (IOException ex) {
      throw new ClientException(request.getClient(), ex);
  }
  // We do not support (for the time being) put with ranges:
  if ( request.hasContentRange() ) {
      Reply error = request.makeReply(HTTP.BAD_REQUEST);
      error.setContent("partial PUT not supported.");
      throw new HTTPException(error);
  }
  // Check that if some type is provided it doesn't conflict:
  if ( request.hasContentType() ) {
      MimeType rtype = request.getContentType() ;
      MimeType type  = xmptype ;
      if ( type == null ) {
    setValue (ATTR_CONTENT_TYPE, rtype) ;
      } else if ( rtype.match (type) < 0 ) {
    if (debug) {
        System.out.println("No match between: ["+
               rtype.toString()+"] and ["+
               type.toString()+"]");
    }
    Reply error = request.makeReply(HTTP.UNSUPPORTED_MEDIA_TYPE) ;
    error.setContent ("<p>Invalid content type: "+type.toString());
    throw new HTTPException (error) ;
      }
  }
  ImageFileResource ifresource = (ImageFileResource) fresource;
  // Write the body back to the file:
  try {
View Full Code Here

      }
      return null;
  } catch (Exception ex) {
      Reply error = request.makeReply(HTTP.BAD_REQUEST) ;
      error.setContent("Invalid request: "+ex.getMessage());
      throw new HTTPException (error);
  }
    }
View Full Code Here

      return reply;
  }
  String method = request.getMethod() ;
  Reply error   = request.makeReply(HTTP.NOT_IMPLEMENTED) ;
  error.setContent("Method "+method+" not implemented.") ;
  throw new HTTPException (error) ;
    }
View Full Code Here

      throws ProtocolException, ResourceException
    {
  String method = request.getMethod() ;
  Reply error   = request.makeReply(HTTP.NOT_IMPLEMENTED) ;
  error.setContent("Method "+method+" not implemented.") ;
  throw new HTTPException (error) ;
    }
View Full Code Here

  try {
      return DAVParser.decodeURL(encoded);
  } catch (HttpInvalidValueException ex) {
      Reply error = request.makeReply(HTTP.BAD_REQUEST) ;
      error.setContent("Invalid request: "+ex.getMessage());
      throw new HTTPException (error);
  }
    }
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.