Package org.apache.commons.httpclient

Examples of org.apache.commons.httpclient.URI


  // Not used - all abstract using Generic method but GET cannot be used.
  public HttpMethod createRequestMethodNew(HttpRequestHeader header, HttpBody body) throws URIException {
    HttpMethod httpMethod = null;
   
    String method = header.getMethod();
    URI uri  = header.getURI();
    String version = header.getVersion();
   
    httpMethod = new GenericMethod(method);

    httpMethod.setURI(uri);
View Full Code Here


  // may be replaced by the New method - however the New method is not yet fully tested so this is stil used.
  public HttpMethod createRequestMethod(HttpRequestHeader header, HttpBody body) throws URIException {
    HttpMethod httpMethod = null;
   
    String method = header.getMethod();
    URI uri  = header.getURI();
    String version = header.getVersion();
   
    if (method.equalsIgnoreCase(GET)) {
      httpMethod = new GetMethod();
    } else if (method.equalsIgnoreCase(POST)) {
      httpMethod = new PostMethod();
    } else if (method.equalsIgnoreCase(DELETE)) {
      httpMethod = new DeleteMethod();
    } else if (method.equalsIgnoreCase(PUT)) {
      httpMethod = new PutMethod();
    } else if (method.equalsIgnoreCase(HEAD)) {
      httpMethod = new HeadMethod();
    } else if (method.equalsIgnoreCase(OPTIONS)) {
      httpMethod = new OptionsMethod();
    } else if (method.equalsIgnoreCase(TRACE)) {
      httpMethod = new TraceMethod(uri.toString());
    } else {
      httpMethod = new GenericMethod(method);
    }

    httpMethod.setURI(uri);
View Full Code Here

       
        if (header != null ) {
            String cookie = header.getHeader("Cookie");
            synchronized (cookieList){
                if (cookie != null && cookieList.indexOf(cookie)==-1){              
                    URI uri = (URI) header.getURI().clone();
                    try {
                        uri.setQuery(null);
                        String sUri = uri.toString();
                        cookieList.add(cookie);
                        getView().getOutputPanel().append(sUri + DELIM + cookie + "\n");

                    } catch (URIException e) {
                        e.printStackTrace();
View Full Code Here

            Vector v = arguments[ARG_URL_IDX].getArguments();
            for (int i=0; i<v.size(); i++) {
                uri = (String) v.get(i);
                try {
                    System.out.println("Adding seed " + uri);
                    spider.addSeed(new URI(uri, true));
                } catch (URIException e) {
                    e.printStackTrace();
                }
            }
        }
View Full Code Here

       
        if (reqHeader != null && reqHeader.isText() && !reqHeader.isImage()){
            if (reqHeader.getMethod().equalsIgnoreCase(HttpRequestHeader.POST)){
                try{
                   
                    URI uri = reqHeader.getURI();
                   
                    int pos;
                   
                    String firstline;
                   
                    URI newURI = (URI) uri.clone();
                    String query = httpMessage.getRequestBody().toString();
                    if (query != null) {
                        newURI.setQuery(null);
                        firstline = newURI.toString();
                        Hashtable param = parseParameter(query);
                        writeLogFile(firstline,param);
                    } else {
                        firstline = uri.toString();
                        writeLogFile(firstline,null);       
View Full Code Here

          public void actionPerformed(java.awt.event.ActionEvent e) {
              ManualRequestEditorDialog dialog = getManualRequestEditorDialog();
              if (dialog.getRequestPanel().getTxtHeader().getText().equals("")) {
                  HttpMessage msg = new HttpMessage();
                  try {
                      URI uri = new URI("http://www.any_domain_name.org/path", true);
                            msg.setRequestHeader(new HttpRequestHeader(HttpRequestHeader.GET, uri, HttpHeader.HTTP10));
                            dialog.getRequestPanel().setMessage(msg, true);
                        } catch (Exception e1) {}
                       
              }
View Full Code Here

       
        if (reqHeader != null && reqHeader.isText() && !reqHeader.isImage()){
            if (reqHeader.getMethod().equalsIgnoreCase(HttpRequestHeader.GET)){
                try{
                   
                    URI uri = reqHeader.getURI();
                   
                    int pos;
                   
                    String firstline;
                   
                    URI newURI = (URI) uri.clone();
                    String query = newURI.getQuery();
                    if (query != null) {
                        newURI.setQuery(null);
                        firstline = newURI.toString();
                        Hashtable param = parseParameter(query);
                        writeLogFile(firstline,param);
                    } else {
                        firstline = uri.toString();
                        writeLogFile(firstline,null);       
View Full Code Here

        String newVersionName = null;
        HttpMessage msg = null;
        String resBody = null;
       
        try {
            msg = new HttpMessage(new URI(SF_PAROS_FILES, true));
            getHttpSender().sendAndReceive(msg,true);
            if (msg.getResponseHeader().getStatusCode() != HttpStatusCode.OK) {
                throw new IOException();
            }
            resBody = msg.getResponseBody().toString();
View Full Code Here

     * @param msg
     * @return  null = not found
     */
    public synchronized HttpMessage pollPath(HttpMessage msg) {
        SiteNode resultNode = null;
        URI uri = msg.getRequestHeader().getURI();
       
        String scheme = null;
        String host = null;
        String path = null;
        int port = 80;
        SiteNode parent = (SiteNode) getRoot();
        StringTokenizer tokenizer = null;
        String folder = "";
       
        try {
           
            scheme = uri.getScheme();
            host = scheme + "://" + uri.getHost();
            port = uri.getPort();
            if (port != -1) {
                host = host + ":" + port;
            }
           
            // no host yet
            parent = findChild(parent, host);
            if (parent == null) {
                return null;
          }
           
            path = uri.getPath();
            if (path == null) {
                path = "";
            }
                       
            tokenizer = new StringTokenizer(path, "/");
View Full Code Here

     * @return
     */
    public synchronized void addPath(HistoryReference ref, HttpMessage msg) {
       
       
        URI uri = msg.getRequestHeader().getURI();
       
        String scheme = null;
        String host = null;
        String path = null;
        int port = 80;
        SiteNode parent = (SiteNode) getRoot();
        StringTokenizer tokenizer = null;
        String folder = "";
       
        try {
           
            scheme = uri.getScheme();
            host = scheme + "://" + uri.getHost();
            port = uri.getPort();
            if (port != -1) {
                host = host + ":" + port;
            }
           
            // add host
            parent = findAndAddChild(parent, host, ref, msg);
            path = uri.getPath();
           
            if (path == null) {
                path = "";
            }
                       
View Full Code Here

TOP

Related Classes of org.apache.commons.httpclient.URI

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.