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

org.webpieces.frontend2.api.FrontendSocket Maven / Gradle / Ivy

Go to download

Create a webserver with this library in just 3 lines of code. just register your HttpRequestListener and it feeds you a FrontendSocket that you write HttpResponses to

There is a newer version: 2.1.1
Show newest version
package org.webpieces.frontend2.api;

import java.net.InetSocketAddress;

import org.webpieces.frontend2.impl.ProtocolType;
import org.webpieces.nio.api.channels.ChannelSession;

public interface FrontendSocket {

	/**
	 * If http/2, reason will be sent to client, otherwise in http1.1, the socket is simply closed with no info
	 */
	void close(String reason);

	ChannelSession getSession();
	
	public ProtocolType getProtocol();
	
	/**
	 * True when we terminate the SSL on this server.  It is false when the firewall terminates the
	 * SSL and then does http to this server!!!  This means you need to have your firewall put in 
	 * headers indicating from ssl channel or not.
	 */
	public boolean isForServingHttpsPages(); 

	/**
	 * Some companies will create a backend website on the same serve served over an internal network port
	 * so they can go and manage the server.  Plugins generally add backend routes which will show up at
	 * http://host/@backend OR will show up on the backend port (depending on your mode)
	 * 
	 * @return
	 */
	boolean isBackendSocket();

	/**
	 * Gets the bound server socket address of the server socket that this socket was opened from.  
	 * This MAY NOT match the HOST header which is the address it is being 
	 * sent to(ie. the firewall).  This can help you determine
	 * if it is SSL if isHttps does not work for you
	 */
	public InetSocketAddress getServerLocalBoundAddress();

	/**
	 * Gets the local address/port of this socket that was opened which is usually not that interesting
	 */
	public InetSocketAddress getLocalAddress();
	
	/**
	 * Gets the remote address of this socket (which could be your firewall)
	 */
	public InetSocketAddress getRemoteAddress();
	
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy