Package net.sf.sahi.request

Examples of net.sf.sahi.request.HttpRequest


        }
    }

    @SuppressWarnings("unchecked")
  public HttpResponse appendFiles(final HttpRequest request) {
        HttpRequest rebuiltRequest = request;
        if (request.isMultipart()) {
            Session session = request.session();
            MultiPartRequest multiPartRequest;
            try {
                multiPartRequest = new MultiPartRequest(request);
View Full Code Here


    }

    public void run() {
      if (client.isClosed()) return;
      ThreadLocalMap.clearAll();
      HttpRequest requestFromBrowser = null;
        try {
            requestFromBrowser = getRequestFromBrowser();
            String uri = requestFromBrowser.uri();
            logger.finest(uri);
            if (uri != null) {
                int _s_ = uri.indexOf("/_s_/");
                int q = uri.indexOf("?");
                if (_s_ != -1 && (q == -1 || (q > _s_))) {
                    processLocally(uri, requestFromBrowser);
                } else {
                    if (isHostTheProxy(requestFromBrowser.host()) && requestFromBrowser.port() == Configuration.getPort()) {
                        processLocally(uri, requestFromBrowser);
                    } else if (uri.indexOf("favicon.ico") != -1) {
                        sendResponseToBrowser(new HttpFileResponse(Configuration.getHtdocsRoot() + "spr/favicon.ico"));
                    } else {
                        processAsProxy(requestFromBrowser);
View Full Code Here

    }


    private HttpRequest getRequestFromBrowser() throws IOException {
        InputStream in = client.getInputStream();
        return new HttpRequest(in, isSSLSocket);
    }
View Full Code Here

  }

  public void run() {
    String uri = null;
    try {
      HttpRequest requestFromBrowser = getRequestFromBrowser();
      uri = requestFromBrowser.uri();
      if (uri.indexOf("/dyn/stopserver") != -1) {
        sendResponseToBrowser(new NoCacheHttpResponse(200, "OK", "Killing Server"));
        System.exit(1);
      }
      String fileName = fileNamefromURI(uri);
View Full Code Here

    return sb.toString();
  }

  private HttpRequest getRequestFromBrowser() throws IOException {
    InputStream in = client.getInputStream();
    return new HttpRequest(in);
  }
View Full Code Here

public class CommandExecuterTest extends TestCase {
  private static final long serialVersionUID = -918331594375717865L;
  static boolean called = false;

  public void testMethodCalled() throws Exception {
    final HttpRequest httpRequest = null;
    new CommandExecuter("net.sf.sahi.command.TestClass_act", httpRequest, false).execute();
    assertTrue(called);
  }
View Full Code Here

    new CommandExecuter("net.sf.sahi.command.TestClass_act", httpRequest, false).execute();
    assertTrue(called);
  }

  public void testMethodCalledWithoutClassFQN() throws Exception {
    final HttpRequest httpRequest = null;
    new CommandExecuter("TestClass_act", httpRequest, false).execute();
    assertTrue(called);
  }
View Full Code Here

  public void tearDown() {
    called = false;
  }

  public void testCommandClass() throws Exception {
    final HttpRequest httpRequest = null;
    assertEquals("com.domain.TestClass", new CommandExecuter("com.domain.TestClass_act", httpRequest, false).getCommandClass());
    assertEquals("act", new CommandExecuter("com.domain.TestClass_act", httpRequest, false).getCommandMethod());
    assertEquals("net.sf.sahi.command.TestClass", new CommandExecuter("TestClass_act", httpRequest, false).getCommandClass());
    assertEquals("act", new CommandExecuter("TestClass_act", httpRequest, false).getCommandMethod());
  }
View Full Code Here

TOP

Related Classes of net.sf.sahi.request.HttpRequest

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.