CGI 的標準入出力


  Java



AN HTTP Server で、.class を java_wrap.exe で登録

java_wrap.cpp
  
#include <stdio.h>
#include <process.h>
#include <string.h>

int main(int argc, char* argv[])
{
	char *ptr;
	char buff[128];
	char command[128];

	ptr = argv[1];
	strcpy( buff, argv[1] );

	int i,len;
	len = strlen( buff );
	for( i = len-1; i >=0 ; i-- ) {
		if ( buff[i] == '.' ) {
			buff[i] = 0x00;
		}
		if ( buff[i] == '\\' ) {
			ptr = buff+i+1;
			break;
		}
	}

	strcpy( command, "java -cp . " );
	strcat( command, ptr );

	system( command );

	return 0;
}
  

  
import java.io.*;

public class lang {
	public static void main(String[] args) {

		try {
			doFunction();
		}
		catch ( Exception e ) {
		}

	}

	public static void doFunction() throws IOException {

		String strMethod = System.getenv("REQUEST_METHOD");

		System.out.println( "Content-Type: text/html; Charset=shift_jis" );
		System.out.println( "" );

		System.out.println( strMethod + "<br>" );

		if ( strMethod.equals( "GET" ) ) {
			String strQueryString = 
				System.getenv( "QUERY_STRING" );
			System.out.println( strQueryString );
		}

		if ( strMethod.equals( "POST" ) ) {
			BufferedReader read =
			   new BufferedReader(new InputStreamReader(System.in));

			String line = null;
			while( (line = read.readLine()) != null ) {
				System.out.println( line );
			}
		}

	}
}
  










  infoboard   管理者用   





フリーフォントWEBサービス
SQLの窓WEBサービス

SQLの窓フリーソフト

素材

一般WEBツールリンク

SQLの窓

フリーソフト

JSライブラリ