Package com.caucho.server.dispatch

Examples of com.caucho.server.dispatch.Invocation


    if (url == null)
      throw new IllegalArgumentException(L.l("request dispatcher url can't be null."));
    else if (! url.startsWith("/"))
      throw new IllegalArgumentException(L.l("request dispatcher url '{0}' must be absolute", url));

    Invocation loginInvocation = new Invocation();
    Invocation errorInvocation = new Invocation();
    InvocationDecoder decoder = new InvocationDecoder();

    String rawURI = getContextPath() + url;

    try {
View Full Code Here


   * Returns a dispatcher for the named servlet.
   */
  public RequestDispatcher getNamedDispatcher(String servletName)
  {
    try {
      Invocation invocation = null;

      FilterChain chain
        = _servletManager.createServletChain(servletName, null, invocation);

      FilterChain includeChain
View Full Code Here

   * @since Servlet 3.0
   */
  @Override
  public ServletContext getServletContext()
  {
    Invocation invocation = _invocation;

    if (invocation != null)
      return invocation.getWebApp();
    else
      return null;
  }
View Full Code Here

   * @since Servlet 3.0
   */
  @Override
  public boolean isAsyncSupported()
  {
    Invocation invocation = _invocation;

    if (invocation != null)
      return invocation.isAsyncSupported();
    else
      return false;
  }
View Full Code Here

      _invocationKey.init(_isSecure,
                          host, conn.getLocalPort(),
                          _uri, _uriLength);

      Invocation invocation = getInvocation(host);

      if (invocation == null)
        return false;

      getRequestFacade().setInvocation(invocation);

      startInvocation();

      invocation.service(getRequestFacade(), getResponseFacade());
    } catch (ClientDisconnectException e) {
      // XXX: _response.killCache();

      throw e;
    } catch (Throwable e) {
View Full Code Here

  private Invocation getInvocation(CharSequence host)
    throws Throwable
  {
    InvocationServer server = getServer().getInvocationServer();
    Invocation invocation = server.getInvocation(_invocationKey);

    if (invocation == null) {
      invocation = server.createInvocation();
      invocation.setSecure(_isSecure);

      if (host != null) {
        String hostName = host.toString().toLowerCase(Locale.ENGLISH);

        invocation.setHost(hostName);
        invocation.setPort(getConnection().getLocalPort());

        // Default host name if the host doesn't have a canonical
        // name
        int p = hostName.indexOf(':');
        if (p > 0)
          invocation.setHostName(hostName.substring(0, p));
        else
          invocation.setHostName(hostName);
      }

      InvocationDecoder decoder = server.getInvocationDecoder();

      decoder.splitQueryAndUnescape(invocation, _uri, _uriLength);

      /* XXX: common to AbstractHttpRequest
      if (_server.isModified()) {
        _server.logModified(log);

        _invocation = invocation;
        if (_server instanceof Server)
          _invocation.setWebApp(((Server) _server).getDefaultWebApp());

        restartServer();

        return null;
      }
      */

      invocation = server.buildInvocation(_invocationKey.clone(),
                                           invocation);
    }

    invocation = invocation.getRequestInvocation(getRequestFacade());

    return invocation;
  }
View Full Code Here

   */
  public void include(ServletRequest topRequest, ServletResponse topResponse,
                      String method)
    throws ServletException, IOException
  {
    Invocation invocation = _includeInvocation;

    HttpServletRequest parentReq;
    ServletRequestWrapper reqWrapper = null;

    if (topRequest instanceof ServletRequestWrapper) {
      ServletRequest request = topRequest;
     
      while (request instanceof ServletRequestWrapper) {
        reqWrapper = (ServletRequestWrapper) request;
       
        request = ((ServletRequestWrapper) request).getRequest();
      }

      parentReq = (HttpServletRequest) request;
    } else if (topRequest instanceof HttpServletRequest) {
      parentReq = (HttpServletRequest) topRequest;
    } else {
      throw new IllegalStateException(L.l(
        "expected instance of ServletRequestWrapper at `{0}'", topResponse));
    }

    HttpServletResponse parentRes;
    ServletResponseWrapper resWrapper = null;

    if (topResponse instanceof ServletResponseWrapper) {
      ServletResponse response = topResponse;
     
      while (response instanceof ServletResponseWrapper) {
        resWrapper = (ServletResponseWrapper) response;
       
        response = ((ServletResponseWrapper) response).getResponse();
      }

      parentRes = (HttpServletResponse) response;
    } else if (topResponse instanceof HttpServletResponse) {
      parentRes = (HttpServletResponse) topResponse;
    } else {
      throw new IllegalStateException(L.l(
        "expected instance of ServletResponse at `{0}'", topResponse));
    }

    IncludeRequest subRequest
      = new IncludeRequest(parentReq, parentRes, invocation);
   
    // server/10yf, jsp/15di
    if (subRequest.getRequestDepth(0) > MAX_DEPTH)
      throw new ServletException(L.l("too many servlet includes `{0}'", parentReq.getServletPath()));

    IncludeResponse subResponse = subRequest.getResponse();

    if (reqWrapper != null) {
      reqWrapper.setRequest(subRequest);
    }
    else {
      topRequest = subRequest;
    }

    if (resWrapper != null) {
      resWrapper.setResponse(subResponse);
    }
    else {
      topResponse = subResponse;
    }
   
    // jsp/15lf, jsp/17eg - XXX: integrated with ResponseStream?
    // res.flushBuffer();

    subRequest.startRequest();

    try {
      invocation.service(topRequest, topResponse);
    } finally {
      if (reqWrapper != null)
        reqWrapper.setRequest(parentReq);
     
      if (resWrapper != null)
View Full Code Here

      return null;

    HashMap<String,CacheItem> itemMap = new HashMap<String,CacheItem>();

    for (int i = 0; i < invocationList.size(); i++) {
      Invocation inv = (Invocation) invocationList.get(i);

      String uri = inv.getURI();
      int p = uri.indexOf('?');
      if (p >= 0)
        uri = uri.substring(0, p);

      CacheItem item = itemMap.get(uri);
View Full Code Here

      _invocationKey.init(_isSecure,
                          host, conn.getLocalPort(),
                          _uri, _uriLength);

      Invocation invocation = getInvocation(host);

      if (invocation == null)
        return false;

      getRequestFacade().setInvocation(invocation);

      startInvocation();

      invocation.service(getRequestFacade(), getResponseFacade());
    } catch (ClientDisconnectException e) {
      // XXX: _response.killCache();

      throw e;
    } catch (Throwable e) {
View Full Code Here

  private Invocation getInvocation(CharSequence host)
    throws Throwable
  {
    Server server = getServer();
    Invocation invocation = server.getInvocation(_invocationKey);

    if (invocation == null) {
      invocation = server.createInvocation();
      invocation.setSecure(_isSecure);

      if (host != null) {
        String hostName = host.toString().toLowerCase();

        invocation.setHost(hostName);
        invocation.setPort(getConnection().getLocalPort());

        // Default host name if the host doesn't have a canonical
        // name
        int p = hostName.indexOf(':');
        if (p > 0)
          invocation.setHostName(hostName.substring(0, p));
        else
          invocation.setHostName(hostName);
      }

      InvocationDecoder decoder = server.getInvocationDecoder();

      decoder.splitQueryAndUnescape(invocation, _uri, _uriLength);

      /* XXX: common to AbstractHttpRequest
      if (_server.isModified()) {
        _server.logModified(log);

        _invocation = invocation;
        if (_server instanceof Server)
          _invocation.setWebApp(((Server) _server).getDefaultWebApp());

        restartServer();

        return null;
      }
      */

      invocation = server.buildInvocation(_invocationKey.clone(),
                                           invocation);
    }

    invocation = invocation.getRequestInvocation(getRequestFacade());

    return invocation;
  }
View Full Code Here

TOP

Related Classes of com.caucho.server.dispatch.Invocation

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.