src/HeadRequest.java
@Override
	public void ReturnResponse() throws IOException {
		File fileToReturn;
		fileToReturn = openFileAccordingToUrl(m_Url);

		if (!fileToReturn.exists()) {
			ReturnNotFoundResponse();
		} else {
			OutputStream outputStream = m_Socket.getOutputStream();
			m_Content = Tools.ReadFile(fileToReturn);	
			m_Headers = Tools.SetupResponseHeaders(m_Content, m_Type);
			String headersToReturn = createHeaders();
			headersToReturn += "\r\n";
			System.out.println(headersToReturn);

			try {
				outputStream.write(headersToReturn.getBytes());
				outputStream.flush();
				outputStream.close();
			} catch (IOException e) {
				System.out.println("No socket to write the respone to.");
			}
		}
	}
/*
	 * Return the response for HEAD request
	 */
Return the response for HEAD request
Return the response for HEAD request
@Override
	public void ReturnResponse() throws IOException {
		File fileToReturn;
		fileToReturn = openFileAccordingToUrl(m_Url);
		if (!fileToReturn.exists()) {
			ReturnNotFoundResponse();
		} else {
			OutputStream outputStream = m_Socket.getOutputStream();
			m_Content = Tools.ReadFile(fileToReturn);	
			m_Headers = Tools.SetupResponseHeaders(m_Content, m_Type);
			String headersToReturn = createHeaders();
			headersToReturn += "\r\n";
			System.out.println(headersToReturn);
			try {
				outputStream.write(headersToReturn.getBytes());
				outputStream.flush();
				outputStream.close();
			} catch (IOException e) {
				System.out.println("No socket to write the respone to.");
			}
		}
	}
@ Override public void ReturnResponse ( ) throws IOException { File fileToReturn ; fileToReturn = openFileAccordingToUrl ( m_Url ) ; if ( ! fileToReturn . exists ( ) ) { ReturnNotFoundResponse ( ) ; } else { OutputStream outputStream = m_Socket . getOutputStream ( ) ; m_Content = Tools . ReadFile ( fileToReturn ) ; m_Headers = Tools . SetupResponseHeaders ( m_Content , m_Type ) ; String headersToReturn = createHeaders ( ) ; headersToReturn += "\r\n" ; System . out . println ( headersToReturn ) ; try { outputStream . write ( headersToReturn . getBytes ( ) ) ; outputStream . flush ( ) ; outputStream . close ( ) ; } catch ( IOException e ) { System . out . println ( "No socket to write the respone to." ) ; } } }
Return the response for HEAD request
Return the response for HEAD request