Package org.w3c.jigsaw.http

Examples of org.w3c.jigsaw.http.HTTPException


        sb.append (")") ;
    }
      } catch (MalformedURLException e) {
    Reply error = request.makeReply(HTTP.BAD_REQUEST) ;
    error.setContent ("You are requesting an invalid URL.") ;
    throw new HTTPException (error) ;
      }

  }
  sb.append (")") ;
  return makePICSReply (request, sb) ;
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) ;
  }
  return handle (request, d) ;
    }
View Full Code Here

    dec.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 ex) {
    Reply error = request.makeReply(HTTP.BAD_REQUEST) ;
    error.setContent("Invalid request: unable to read form data.");
    throw new ClientException(request.getClient(), ex) ;
      }
View Full Code Here

      return acknowledgeExtension(request, reply);
  }

  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

  String      method       = mmethod.substring(2);

  if ((extl == null) && (cextl == null)) {
      Reply error   = request.makeReply(HTTP.NOT_EXTENDED) ;
      error.setContent("Mandatory extension expected.");
      throw new HTTPException(error);
  }

  int nb_extensions = 0;

  if (extl != null) {
      exts          = extl.getHttpExts();
      int len       = exts.length;
      nb_extensions += len;
      for (int i=0 ; i < len ; i++) {
    if (! supportedExtension(exts[i].getName(), method, this))
        notsupported.addElement(exts[i].getName());
      }
  }

  if (cextl != null) {
      cexts         = cextl.getHttpExts();
      int len       = cexts.length;
      nb_extensions += len;
      for (int i=0 ; i < cexts.length ; i++) {
    if (! supportedExtension(cexts[i].getName(), method, this))
        notsupported.addElement(cexts[i].getName());
      }
  }
 
  if (nb_extensions == 0) {
      Reply error   = request.makeReply(HTTP.NOT_EXTENDED) ;
      error.setContent("Mandatory extension expected.");
      throw new HTTPException(error);
  }
   
  int len = -1;
  if ((len = notsupported.size()) > 0) {
      Reply error   = request.makeReply(HTTP.NOT_EXTENDED) ;
      HtmlGenerator content = new HtmlGenerator("Error");
      content.append("<h1>Mandatory extension(s) not supported:",
         "</h1><p>\n");
      content.append("<ul>\n");
      for (int i = 0; i < len; i++)
    content.append("<li> "+(String)notsupported.elementAt(i)+"\n");
      content.append("</ul>\n");
      error.setStream(content);
      throw new HTTPException(error);
  }
    }
View Full Code Here

  } else if ( params.hasItem ("signed") ) {
      format = LabelBureauInterface.FMT_SIGNED ;
  } else {
      Reply error = request.makeReply(HTTP.BAD_REQUEST) ;
      error.setContent ("Invalid label format: "+format) ;
      throw new HTTPException (error) ;
  }
  // Get labels for each service, building out the ret hashtable
  StringBuffer sb = new StringBuffer(128) ;
  Enumeration  e  = services.keys() ;
  sb.append ("("+PICS.PICS_PROTOCOL_ID) ;
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

  if ( location == null ) {
      Reply error = request.makeReply(HTTP.INTERNAL_SERVER_ERROR) ;
      error.setContent("The target RelocateResource doesn't define the"
           + " relocation location. The server is "
           + " misconfigured.") ;
      throw new HTTPException(error) ;
  } else {
      Reply  reply = null;
      URL    loc      = null;
      if (checkUse302()) {
    reply = request.makeReply(HTTP.FOUND) ;
View Full Code Here

      error.setContent("<html><head><title>Server Error</title>"+
           "</head><body><h1>Server misconfigured</h1>"+
           "<p>The resource <b>"+getIdentifier()+"</b>"+
           "has an invalid target attribute : <p><b>"+
           getTarget()+"</b></body></html>");     
      throw new HTTPException (error);
  }
  return server.perform(request);
    }
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.