All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.caucho.v5.http.protocol.RequestFacade Maven / Gradle / Ivy

There is a newer version: 1.0.1
Show newest version
/*
 * Copyright (c) 1998-2015 Caucho Technology -- all rights reserved
 *
 * This file is part of Baratine(TM)
 *
 * Each copy or derived work must preserve the copyright notice and this
 * notice unmodified.
 *
 * Baratine is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * Baratine is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty
 * of NON-INFRINGEMENT.  See the GNU General Public License for more
 * details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Baratine; if not, write to the
 *
 *   Free Software Foundation, Inc.
 *   59 Temple Place, Suite 330
 *   Boston, MA 02111-1307  USA
 *
 * @author Scott Ferguson
 */

package com.caucho.v5.http.protocol;

import java.io.IOException;
import java.security.cert.X509Certificate;

import com.caucho.v5.http.dispatch.Invocation;
import com.caucho.v5.http.protocol2.OutHeader;
import com.caucho.v5.io.TempBuffer;
import com.caucho.v5.io.WriteBuffer;
import com.caucho.v5.network.port.ConnectionProtocol;
import com.caucho.v5.network.port.StateConnection;

import io.baratine.web.HttpStatus;

/**
 * User facade for http requests.
 */
public interface RequestFacade extends ConnectionProtocol
{
  // ResponseFacade getResponse();
  
  void invocation(Invocation invocation);

  boolean isAsyncStarted();

  boolean isAsyncComplete();

  void setCipherSuite(String cipher);
  
  void setCipherKeySize(int keySize);

  void setCipherCertificate(X509Certificate[] certs);

  StateConnection resume() throws Exception;

  void cleanup();

  String getHeader(String string);

  String getRequestURI();

  String getQueryString();

  String getMethod();

  void killKeepalive(String string);

  String getRemoteAddr();

  void finishRequest() throws IOException;

  StateConnection service();

  default boolean isMultipartFormEnabled()
  {
    return false;
  }

  default void bodyComplete()
  {
  }

  default void bodyChunk(TempBuffer tBuf)
  {
  }

  
  //
  // output
  //
  
  void setStatus(HttpStatus status);
  
  int getStatus();

  String getStatusMessage();
  
  String getContentType();
  
  void setContentType(String value);
  
  String getContentTypeImpl();
  
  void fillHeaders();

  String getCharacterEncodingImpl();
  
  void sendError(HttpStatus status)
    throws IOException;
  
  //
  // caching
  //
  
  void killCache();

  boolean isCaching();

  boolean isNoCache();

  boolean isPrivateCache();

  void setCacheControl(boolean isCacheControl);
  
  boolean isCacheControl();

  boolean isNoCacheUnlessVary();

  default boolean handleNotModified() throws IOException
  {
    return false;
  }
  

  default boolean isDisableCache()
  {
    return true;
  }
  
  //
  // http header writing
  //

  void writeCookies(WriteBuffer os) throws IOException;

  void fillCookies(OutHeader out) throws IOException;

  default boolean isPrevCloseWrite()
  {
    return true;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy