зеркало из https://github.com/mozilla/gecko-dev.git
directory_name_change
This commit is contained in:
Родитель
2d604d14d9
Коммит
302d516139
|
@ -1,30 +0,0 @@
|
|||
#
|
||||
# The contents of this file are subject to the Mozilla Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is The Waterfall Java Plugin Module
|
||||
#
|
||||
# The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
# Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# $Id: Defs.gmk,v 1.1 2001/05/09 17:29:48 edburns%acm.org Exp $
|
||||
#
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
# Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
|
||||
MAKEFLAGS += --no-print-directory
|
||||
|
||||
RM = rm -f
|
||||
JAVAC_CMD = $(WFJDKHOME)/bin/javac
|
||||
JAR_CMD = $(WFJDKHOME)/bin/jar
|
||||
MV = mv
|
|
@ -1,48 +0,0 @@
|
|||
#
|
||||
# The contents of this file are subject to the Mozilla Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is The Waterfall Java Plugin Module
|
||||
#
|
||||
# The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
# Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# $Id: FileListCommon.mk,v 1.1 2001/05/09 17:29:49 edburns%acm.org Exp $
|
||||
#
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
# Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
|
||||
FILES_java = \
|
||||
sun/jvmp/HostObjectPeer.java \
|
||||
sun/jvmp/PluggableJVM.java \
|
||||
sun/jvmp/ObjectFactory.java \
|
||||
sun/jvmp/BrowserSupport.java \
|
||||
sun/jvmp/IDObject.java \
|
||||
sun/jvmp/IDList.java \
|
||||
sun/jvmp/NativeFrame.java \
|
||||
sun/jvmp/NativeThread.java \
|
||||
sun/jvmp/SynchroObject.java \
|
||||
sun/jvmp/WaterfallExtension.java \
|
||||
sun/jvmp/MultipleHashtable.java \
|
||||
sun/jvmp/ComponentException.java \
|
||||
sun/jvmp/HostObjectPeerFactory.java \
|
||||
sun/jvmp/ComponentLoader.java \
|
||||
sun/jvmp/test/MyDialog.java \
|
||||
sun/jvmp/test/MyActionListener.java \
|
||||
sun/jvmp/test/TestPeerFactory.java \
|
||||
sun/jvmp/security/SecurityCaps.java \
|
||||
sun/jvmp/security/ExtSecurityManager.java \
|
||||
sun/jvmp/security/AccessControlDecider.java \
|
||||
sun/jvmp/security/CallingContext.java \
|
||||
sun/jvmp/security/WFPolicy.java \
|
||||
sun/jvmp/generic/GenericSynchroObject.java
|
|
@ -1,27 +0,0 @@
|
|||
#
|
||||
# The contents of this file are subject to the Mozilla Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is The Waterfall Java Plugin Module
|
||||
#
|
||||
# The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
# Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# $Id: FileListUnix.mk,v 1.1 2001/05/09 17:29:49 edburns%acm.org Exp $
|
||||
#
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
# Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
|
||||
FILES_java += \
|
||||
sun/jvmp/generic/motif/Plugin.java \
|
||||
sun/jvmp/generic/motif/PthreadSynchroObject.java
|
|
@ -1,26 +0,0 @@
|
|||
#
|
||||
# The contents of this file are subject to the Mozilla Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is The Waterfall Java Plugin Module
|
||||
#
|
||||
# The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
# Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# $Id: FileListWin.mk,v 1.1 2001/05/09 17:29:49 edburns%acm.org Exp $
|
||||
#
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
# Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
|
||||
FILES_java=$(FILES_java)\
|
||||
sun/jvmp/generic/win32/Plugin.java
|
|
@ -1,64 +0,0 @@
|
|||
#
|
||||
# The contents of this file are subject to the Mozilla Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is The Waterfall Java Plugin Module
|
||||
#
|
||||
# The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
# Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# $Id: GNUmakefile,v 1.1 2001/05/09 17:29:50 edburns%acm.org Exp $
|
||||
#
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
# Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
|
||||
ifndef WFJDKHOME
|
||||
all classes:
|
||||
@echo
|
||||
@echo "Set your WFJDKHOME to path to JDK!"
|
||||
@echo
|
||||
else
|
||||
|
||||
BUILDDIR = .
|
||||
JAVASRCDIR = ../../java
|
||||
CLASSDESTDIR = ../unix/classes
|
||||
ADDCLASSPATH = ../unix/classes
|
||||
PATH_SEP=:
|
||||
SUBDIRS = ext
|
||||
|
||||
default: all
|
||||
|
||||
include FileListCommon.mk
|
||||
include FileListUnix.mk
|
||||
|
||||
include $(BUILDDIR)/Defs.gmk
|
||||
include $(BUILDDIR)/Rules.gmk
|
||||
endif
|
||||
|
||||
all: classes exts
|
||||
|
||||
release: all wf.jar
|
||||
|
||||
wf.jar:
|
||||
@echo -n "Making JAR file....."; \
|
||||
cd $(CLASSDESTDIR); \
|
||||
$(JAR_CMD) cf wf.jar sun netscape ; \
|
||||
$(MV) wf.jar ..; \
|
||||
echo " done."
|
||||
|
||||
exts:
|
||||
@echo "Making Waterfall extension components"
|
||||
@cd ext; \
|
||||
$(MAKE) all
|
||||
|
||||
.PHONY : all classes clean exts
|
|
@ -1,66 +0,0 @@
|
|||
#
|
||||
# The contents of this file are subject to the Mozilla Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is The Waterfall Java Plugin Module
|
||||
#
|
||||
# The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
# Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# $Id: Rules.gmk,v 1.1 2001/05/09 17:29:50 edburns%acm.org Exp $
|
||||
#
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
# Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
|
||||
$(CLASSDESTDIR):
|
||||
@mkdir -p $@
|
||||
|
||||
.delete.classlist:
|
||||
@$(RM) .classes.list
|
||||
|
||||
.compile.classlist:
|
||||
@if [ -s .classes.list ] ; \
|
||||
then echo "Compiling Java files"; cat .classes.list; \
|
||||
$(JAVAC_CMD) -d $(CLASSDESTDIR) -classpath $(CLASSDESTDIR)$(PATH_SEP)$(ADDCLASSPATH)$(PATH_SEP)$(CLASSPATH)\
|
||||
$(shell if [ -s .classes.list ] ; then cat .classes.list; fi ) ; \
|
||||
fi
|
||||
|
||||
FILES_class = $(FILES_java:%.java=$(CLASSDESTDIR)/%.class)
|
||||
|
||||
ifdef SUBDIRS
|
||||
LOOP_OVER_DIRS = @for d in $(SUBDIRS); do \
|
||||
oldDir=`pwd`; \
|
||||
set -e; \
|
||||
cd $$d; $(MAKE) $@; cd $$oldDir; \
|
||||
set +e; \
|
||||
done
|
||||
endif
|
||||
|
||||
|
||||
$(CLASSDESTDIR)/%.class: $(JAVASRCDIR)/%.java
|
||||
@echo $? >>.classes.list
|
||||
|
||||
classes: $(CLASSES_INIT) $(CLASSDESTDIR) .delete.classlist $(FILES_class) .compile.classlist
|
||||
|
||||
clean:
|
||||
@echo "Removing compiled classfiles from $(CLASSDESTDIR)"
|
||||
@$(RM) -r $(CLASSDESTDIR) .classes.list
|
||||
$(LOOP_OVER_DIRS)
|
||||
|
||||
.PHONY: .delete.classlist .compile.classlist
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
#
|
||||
# The contents of this file are subject to the Mozilla Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is The Waterfall Java Plugin Module
|
||||
#
|
||||
# The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
# Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# $Id: defs.mk,v 1.1 2001/05/09 17:29:48 edburns%acm.org Exp $
|
||||
#
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
# Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
|
||||
DEL=del/f/q
|
||||
DELTREE=rmdir/s/q
|
||||
MV=move
|
||||
JAVAC_CMD=$(WFJDKHOME)\bin\javac.exe
|
||||
JAR_CMD = $(WFJDKHOME)\bin\jar.exe
|
|
@ -1,33 +0,0 @@
|
|||
#
|
||||
# The contents of this file are subject to the Mozilla Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is The Waterfall Java Plugin Module
|
||||
#
|
||||
# The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
# Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# $Id: GNUmakefile,v 1.1 2001/05/09 17:29:51 edburns%acm.org Exp $
|
||||
#
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
# Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
|
||||
SUBDIRS = jpav moz6
|
||||
|
||||
all clean:
|
||||
@for i in $(SUBDIRS) ; do \
|
||||
echo ">>>Recursively making "$$i" "$@"..."; \
|
||||
cd $$i; $(MAKE) $@ \
|
||||
|| exit 1; cd ..; \
|
||||
echo "<<<Finished Recursively making "$$i" "$@"." ; \
|
||||
done
|
|
@ -1,46 +0,0 @@
|
|||
#
|
||||
# The contents of this file are subject to the Mozilla Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is The Waterfall Java Plugin Module
|
||||
#
|
||||
# The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
# Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# $Id: FileListExt.mk,v 1.1 2001/05/09 17:29:52 edburns%acm.org Exp $
|
||||
#
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
# Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
|
||||
FILES_java = \
|
||||
sun/jvmp/jpav/ActivatorAppletContext.java \
|
||||
sun/jvmp/jpav/ActivatorAppletPanel.java \
|
||||
sun/jvmp/jpav/AppletMessageHandler.java \
|
||||
sun/jvmp/jpav/ActivatorClassLoader.java \
|
||||
sun/jvmp/jpav/ClassLoaderInfo.java \
|
||||
sun/jvmp/jpav/ActivatorProxyHandler.java \
|
||||
sun/jvmp/jpav/CookieHandler.java \
|
||||
sun/jvmp/jpav/ProxyHandler.java \
|
||||
sun/jvmp/jpav/JavaPluginAVFactory.java \
|
||||
sun/jvmp/jpav/RMIActivatorSocketFactory.java \
|
||||
sun/jvmp/jpav/protocol/jdk12/http/HttpClient.java \
|
||||
sun/jvmp/jpav/protocol/jdk12/http/HttpURLConnection.java \
|
||||
sun/jvmp/jpav/protocol/jdk12/http/Handler.java \
|
||||
sun/jvmp/jpav/protocol/jdk12/http/SocksSocket.java \
|
||||
sun/jvmp/jpav/protocol/jdk12/https/BrowserHttpsInputStream.java \
|
||||
sun/jvmp/jpav/protocol/jdk12/https/BrowserHttpsOutputStream.java \
|
||||
sun/jvmp/jpav/protocol/jdk12/https/BrowserHttpsURLConnection.java \
|
||||
sun/jvmp/jpav/protocol/jdk12/https/Handler.java \
|
||||
sun/jvmp/jpav/protocol/jdk12/ftp/Handler.java \
|
||||
sun/jvmp/jpav/protocol/jdk12/gopher/Handler.java \
|
||||
sun/jvmp/jpav/protocol/jdk12/jar/Handler.java
|
|
@ -1,49 +0,0 @@
|
|||
#
|
||||
# The contents of this file are subject to the Mozilla Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is The Waterfall Java Plugin Module
|
||||
#
|
||||
# The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
# Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# $Id: GNUmakefile,v 1.1 2001/05/09 17:29:52 edburns%acm.org Exp $
|
||||
#
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
# Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
|
||||
BUILDDIR = ../..
|
||||
JAVASRCDIR = ../../../../java
|
||||
CLASSDESTDIR = ../../../unix/ext/jpav
|
||||
ADDCLASSPATH=../../../unix/classes:../../../unix/ext/jpav
|
||||
PATH_SEP=:
|
||||
|
||||
include FileListExt.mk
|
||||
|
||||
include $(BUILDDIR)/Defs.gmk
|
||||
include $(BUILDDIR)/Rules.gmk
|
||||
|
||||
all: jpav.jar
|
||||
|
||||
jpav.jar: classes
|
||||
@if [ -s .classes.list ]; then \
|
||||
echo -n "Creating jpav.jar..."; \
|
||||
cd $(CLASSDESTDIR); \
|
||||
$(RM) manifest.tmp; \
|
||||
echo "Factory-Class: sun.jvmp.jpav.JavaPluginAVFactory" >> manifest.tmp ; \
|
||||
echo "Protocol-Handlers: sun.jvmp.jpav.protocol.jdk12" >> manifest.tmp ; \
|
||||
$(JAR_CMD) cfm jpav.jar manifest.tmp sun ; \
|
||||
$(MV) jpav.jar .. ;\
|
||||
echo " done."; fi
|
||||
|
||||
|
|
@ -1,61 +0,0 @@
|
|||
#
|
||||
# The contents of this file are subject to the Mozilla Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is The Waterfall Java Plugin Module
|
||||
#
|
||||
# The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
# Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# $Id: makefile.win,v 1.1 2001/05/09 17:29:52 edburns%acm.org Exp $
|
||||
#
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
# Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
|
||||
BUILDDIR = ..\..
|
||||
JAVASRCDIR = ..\..\..\..\java
|
||||
CLASSDESTDIR = ..\..\..\win32\ext\jpav
|
||||
ADDCLASSPATH=..\..\..\win32\classes;..\..\..\win32\ext\jpav
|
||||
EDBURNS=edburns
|
||||
PATH_SEP=;
|
||||
|
||||
PKG3=sun.jvmp.jpav
|
||||
PKG4=sun.jvmp.jpav.protocol.jdk12.http
|
||||
PKG15=sun.jvmp.jpav.protocol.jdk12.https
|
||||
PKG16=sun.jvmp.jpav.protocol.jdk12.ftp
|
||||
PKG17=sun.jvmp.jpav.protocol.jdk12.gopher
|
||||
PKG18=sun.jvmp.jpav.protocol.jdk12.jar
|
||||
|
||||
!include FileListExt.mk
|
||||
|
||||
# ugly, but nmake is pretty stupid in substitutions
|
||||
CLASSDESTDIR=..\..\..\win32\ext\jpav
|
||||
FILES_class = $(FILES_java:sun/jvmp=../../../win32/ext/jpav/sun/jvmp)
|
||||
|
||||
!include $(BUILDDIR)\defs.mk
|
||||
!include $(BUILDDIR)\rules.mk
|
||||
|
||||
all: jpav.jar
|
||||
|
||||
jpav.jar: classes
|
||||
@IF EXIST manifest.tmp $(DEL) manifest.tmp
|
||||
@ echo Creating jpav.jar...
|
||||
@ cd $(CLASSDESTDIR)
|
||||
@$(JAR_CMD) cfm jpav.jar <<manifest.tmp sun
|
||||
Factory-Class: sun.jvmp.jpav.JavaPluginAVFactory
|
||||
Protocol-Handlers: sun.jvmp.jpav.protocol.jdk12
|
||||
<<
|
||||
-@$(DEL) ..\jpav.jar manifest.tmp
|
||||
@$(MV) jpav.jar ..
|
||||
@ echo Done
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
#
|
||||
# The contents of this file are subject to the Mozilla Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is The Waterfall Java Plugin Module
|
||||
#
|
||||
# The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
# Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# $Id: makefile.win,v 1.1 2001/05/09 17:29:52 edburns%acm.org Exp $
|
||||
#
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
# Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
|
||||
all clean:
|
||||
@ cd jpav
|
||||
@ $(MAKE) -fmakefile.win -nologo $@
|
||||
@ cd ..\moz6
|
||||
@ $(MAKE) -fmakefile.win -nologo $@
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
#
|
||||
# The contents of this file are subject to the Mozilla Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is The Waterfall Java Plugin Module
|
||||
#
|
||||
# The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
# Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# $Id: FileListExt.mk,v 1.1 2001/05/09 17:29:53 edburns%acm.org Exp $
|
||||
#
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
# Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
|
||||
FILES_java =\
|
||||
sun/jvmp/mozilla/MozillaAppletPeer.java \
|
||||
sun/jvmp/mozilla/MozillaHostObjectPeer.java \
|
||||
sun/jvmp/mozilla/MozillaPeerFactory.java \
|
||||
sun/jvmp/mozilla/MozillaSecurityManager.java
|
|
@ -1,46 +0,0 @@
|
|||
#
|
||||
# The contents of this file are subject to the Mozilla Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is The Waterfall Java Plugin Module
|
||||
#
|
||||
# The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
# Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# $Id: GNUmakefile,v 1.1 2001/05/09 17:29:53 edburns%acm.org Exp $
|
||||
#
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
# Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
|
||||
BUILDDIR = ../..
|
||||
JAVASRCDIR = ../../../../java
|
||||
CLASSDESTDIR = ../../../unix/ext/moz6
|
||||
ADDCLASSPATH=../../../unix/classes:../../../unix/ext/moz6
|
||||
PATH_SEP=:
|
||||
|
||||
include FileListExt.mk
|
||||
|
||||
include $(BUILDDIR)/Defs.gmk
|
||||
include $(BUILDDIR)/Rules.gmk
|
||||
|
||||
all: moz6.jar
|
||||
|
||||
moz6.jar: classes
|
||||
@if [ -s .classes.list ]; then \
|
||||
echo -n "Creating moz6.jar..." ;\
|
||||
cd $(CLASSDESTDIR) ;\
|
||||
$(JAR_CMD) cf moz6.jar sun ; \
|
||||
$(MV) moz6.jar .. ;\
|
||||
echo " done."; fi
|
||||
|
||||
|
|
@ -1,50 +0,0 @@
|
|||
#
|
||||
# The contents of this file are subject to the Mozilla Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is The Waterfall Java Plugin Module
|
||||
#
|
||||
# The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
# Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# $Id: makefile.win,v 1.1 2001/05/09 17:29:53 edburns%acm.org Exp $
|
||||
#
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
# Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
|
||||
BUILDDIR = ..\..
|
||||
JAVASRCDIR = ..\..\..\..\java
|
||||
CLASSDESTDIR = ..\..\..\win32\ext\moz6
|
||||
ADDCLASSPATH=..\..\..\win32\classes;..\..\..\win32\ext\moz6
|
||||
PATH_SEP=;
|
||||
|
||||
PKG3=sun.jvmp.mozilla
|
||||
|
||||
!include FileListExt.mk
|
||||
|
||||
# ugly, but nmake is pretty stupid in substitutions
|
||||
CLASSDESTDIR=..\..\..\win32\ext\moz6
|
||||
FILES_class = $(FILES_java:sun/jvmp=../../../win32/ext/moz6/sun/jvmp)
|
||||
|
||||
!include $(BUILDDIR)\defs.mk
|
||||
!include $(BUILDDIR)\rules.mk
|
||||
|
||||
all: moz6.jar
|
||||
|
||||
moz6.jar: classes
|
||||
@ echo Creating moz6.jar...
|
||||
@ cd $(CLASSDESTDIR)
|
||||
@$(JAR_CMD) cf moz6.jar sun
|
||||
-@$(DEL) ..\moz6.jar 2>NUL
|
||||
@$(MV) moz6.jar ..
|
||||
@ echo Done
|
|
@ -1,66 +0,0 @@
|
|||
#
|
||||
# The contents of this file are subject to the Mozilla Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is The Waterfall Java Plugin Module
|
||||
#
|
||||
# The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
# Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# $Id: makefile.win,v 1.1 2001/05/09 17:29:50 edburns%acm.org Exp $
|
||||
#
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
# Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
|
||||
PKG=sun.jvmp
|
||||
PKG6=sun.jvmp.mozilla
|
||||
PKG7=sun.jvmp.netscape4
|
||||
PKG8=sun.jvmp.security
|
||||
PKG11=sun.jvmp.generic.win32
|
||||
PKG12=sun.jvmp.test
|
||||
PKG13=sun.jvmp.generic
|
||||
|
||||
BUILDDIR=.
|
||||
JAVASRCDIR=..\..\java
|
||||
ADDCLASSPATH=..\win32\classes
|
||||
PATH_SEP=;
|
||||
SUBDIRS=ext
|
||||
|
||||
!include FileListCommon.mk
|
||||
!include FileListWin.mk
|
||||
|
||||
# ugly, but nmake is pretty stupid in substitutions
|
||||
CLASSDESTDIR=..\win32\classes
|
||||
FILES_class = $(FILES_java:sun/jvmp=../win32/classes/sun/jvmp)
|
||||
FILES_class = $(FILES_class:netscape/javascript=../win32/classes/netscape/javascript)
|
||||
!include defs.mk
|
||||
!include rules.mk
|
||||
|
||||
|
||||
all: classes exts
|
||||
|
||||
release: all wf.jar
|
||||
|
||||
exts:
|
||||
@ cd ext
|
||||
@ $(MAKE) -f makefile.win -nologo all
|
||||
|
||||
wf.jar:
|
||||
@ echo "Creating wf.jar file"
|
||||
@ cd $(CLASSDESTDIR)
|
||||
-@ $(JAR_CMD) cf wf.jar sun netscape
|
||||
-@$(DEL) ..\wf.jar
|
||||
-@$(MV) wf.jar ..
|
||||
|
||||
.PHONY : all classes clean release exts
|
||||
|
|
@ -1,107 +0,0 @@
|
|||
#
|
||||
# The contents of this file are subject to the Mozilla Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is The Waterfall Java Plugin Module
|
||||
#
|
||||
# The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
# Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# $Id: rules.mk,v 1.1 2001/05/09 17:29:51 edburns%acm.org Exp $
|
||||
#
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
# Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
|
||||
# nmake isn't the best make program I know about
|
||||
FILES_class = $(FILES_class:.java=.class)
|
||||
FILES_class=$(FILES_class:/=\)
|
||||
PKG1_DIR=$(PKG:.=\)
|
||||
PKG2_DIR=$(PKG2:.=\)
|
||||
PKG3_DIR=$(PKG3:.=\)
|
||||
PKG4_DIR=$(PKG4:.=\)
|
||||
PKG5_DIR=$(PKG5:.=\)
|
||||
PKG6_DIR=$(PKG6:.=\)
|
||||
PKG7_DIR=$(PKG7:.=\)
|
||||
PKG8_DIR=$(PKG8:.=\)
|
||||
PKG9_DIR=$(PKG9:.=\)
|
||||
PKG10_DIR=$(PKG10:.=\)
|
||||
PKG11_DIR=$(PKG11:.=\)
|
||||
PKG12_DIR=$(PKG12:.=\)
|
||||
PKG13_DIR=$(PKG13:.=\)
|
||||
PKG14_DIR=$(PKG14:.=\)
|
||||
PKG15_DIR=$(PKG15:.=\)
|
||||
PKG16_DIR=$(PKG16:.=\)
|
||||
PKG17_DIR=$(PKG17:.=\)
|
||||
PKG18_DIR=$(PKG18:.=\)
|
||||
|
||||
{$(JAVASRCDIR)\$(PKG1_DIR)\}.java{$(CLASSDESTDIR)\$(PKG1_DIR)\}.class:
|
||||
@echo $(?) >>.classes.list
|
||||
{$(JAVASRCDIR)\$(PKG2_DIR)\}.java{$(CLASSDESTDIR)\$(PKG2_DIR)\}.class:
|
||||
@echo $(?) >>.classes.list
|
||||
{$(JAVASRCDIR)\$(PKG3_DIR)\}.java{$(CLASSDESTDIR)\$(PKG3_DIR)\}.class:
|
||||
@echo $(?) >>.classes.list
|
||||
{$(JAVASRCDIR)\$(PKG4_DIR)\}.java{$(CLASSDESTDIR)\$(PKG4_DIR)\}.class:
|
||||
@echo $(?) >>.classes.list
|
||||
{$(JAVASRCDIR)\$(PKG5_DIR)\}.java{$(CLASSDESTDIR)\$(PKG5_DIR)\}.class:
|
||||
@echo $(?) >>.classes.list
|
||||
{$(JAVASRCDIR)\$(PKG6_DIR)\}.java{$(CLASSDESTDIR)\$(PKG6_DIR)\}.class:
|
||||
@echo $(?) >>.classes.list
|
||||
{$(JAVASRCDIR)\$(PKG7_DIR)\}.java{$(CLASSDESTDIR)\$(PKG7_DIR)\}.class:
|
||||
@echo $(?) >>.classes.list
|
||||
{$(JAVASRCDIR)\$(PKG8_DIR)\}.java{$(CLASSDESTDIR)\$(PKG8_DIR)\}.class:
|
||||
@echo $(?) >>.classes.list
|
||||
{$(JAVASRCDIR)\$(PKG9_DIR)\}.java{$(CLASSDESTDIR)\$(PKG9_DIR)\}.class:
|
||||
@echo $(?) >>.classes.list
|
||||
{$(JAVASRCDIR)\$(PKG10_DIR)\}.java{$(CLASSDESTDIR)\$(PKG10_DIR)\}.class:
|
||||
@echo $(?) >>.classes.list
|
||||
{$(JAVASRCDIR)\$(PKG11_DIR)\}.java{$(CLASSDESTDIR)\$(PKG11_DIR)\}.class:
|
||||
@echo $(?) >>.classes.list
|
||||
{$(JAVASRCDIR)\$(PKG12_DIR)\}.java{$(CLASSDESTDIR)\$(PKG12_DIR)\}.class:
|
||||
@echo $(?) >>.classes.list
|
||||
{$(JAVASRCDIR)\$(PKG13_DIR)\}.java{$(CLASSDESTDIR)\$(PKG13_DIR)\}.class:
|
||||
@echo $(?) >>.classes.list
|
||||
{$(JAVASRCDIR)\$(PKG14_DIR)\}.java{$(CLASSDESTDIR)\$(PKG14_DIR)\}.class:
|
||||
@echo $(?) >>.classes.list
|
||||
{$(JAVASRCDIR)\$(PKG15_DIR)\}.java{$(CLASSDESTDIR)\$(PKG15_DIR)\}.class:
|
||||
@echo $(?) >>.classes.list
|
||||
{$(JAVASRCDIR)\$(PKG16_DIR)\}.java{$(CLASSDESTDIR)\$(PKG16_DIR)\}.class:
|
||||
@echo $(?) >>.classes.list
|
||||
{$(JAVASRCDIR)\$(PKG17_DIR)\}.java{$(CLASSDESTDIR)\$(PKG17_DIR)\}.class:
|
||||
@echo $(?) >>.classes.list
|
||||
{$(JAVASRCDIR)\$(PKG18_DIR)\}.java{$(CLASSDESTDIR)\$(PKG18_DIR)\}.class:
|
||||
@echo $(?) >>.classes.list
|
||||
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .java .class
|
||||
|
||||
classes: $(CLASSES_INIT) $(CLASSDESTDIR) delete.classlist $(FILES_class) compile.classlist
|
||||
|
||||
$(CLASSDESTDIR):
|
||||
@mkdir $@
|
||||
|
||||
delete.classlist:
|
||||
@if exist .classes.list $(DEL) .classes.list
|
||||
|
||||
compile.classlist:
|
||||
@if exist .classes.list echo "Compiling Java classes"
|
||||
@if exist .classes.list type .classes.list
|
||||
@if exist .classes.list $(JAVAC_CMD) -d $(CLASSDESTDIR) -classpath $(CLASSDESTDIR)$(PATH_SEP)$(ADDCLASSPATH)$(PATH_SEP)$(CLASSPATH) \
|
||||
@.classes.list
|
||||
|
||||
clean:
|
||||
@ echo Remove classfiles from $(CLASSDESTDIR)
|
||||
@ IF EXIST $(CLASSDESTDIR) $(DELTREE) $(CLASSDESTDIR)
|
||||
@ IF EXIST .classes.list $(DEL) .classes.list
|
||||
|
||||
.PHONY: delete.classlist compile.classlist classes
|
|
@ -1,109 +0,0 @@
|
|||
#
|
||||
# The contents of this file are subject to the Mozilla Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is The Waterfall Java Plugin Module
|
||||
#
|
||||
# The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
# Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# $Id: Defs.gmk,v 1.1 2001/05/09 17:29:53 edburns%acm.org Exp $
|
||||
#
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
# Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
|
||||
BUILDDIR=.
|
||||
ROOTDIR=../..
|
||||
|
||||
MAKE = gmake
|
||||
CXX = g++ -Wall -Wno-long-long
|
||||
CC = gcc -pedantic -Wall -Wno-long-long
|
||||
LD = gcc
|
||||
CCOPT = -g
|
||||
CP = cp
|
||||
TAR = tar
|
||||
|
||||
# type of really used JVM
|
||||
# values: _JVMP_IBMJVM, _JVMP_SUNJVM
|
||||
#JVMTYPE = _JVMP_IBMJVM
|
||||
JVMTYPE = _JVMP_SUNJVM
|
||||
JVMKIND = hotspot
|
||||
#JVMKIND = classic
|
||||
# using pthreads, should be defined by smth like configure
|
||||
THREADTYPE = _JVMP_PTHREADS
|
||||
USE_SHM = 0
|
||||
|
||||
uname = $(shell uname)
|
||||
ifeq ($(uname), SunOS)
|
||||
PLATFORM = solaris
|
||||
endif
|
||||
ifeq ($(uname), Linux)
|
||||
PLATFORM = linux
|
||||
endif
|
||||
|
||||
archExpr = case "`uname -m`" in \
|
||||
i[3-6]86) \
|
||||
echo i386 \
|
||||
;; \
|
||||
i86pc) \
|
||||
echo i386 \
|
||||
;; \
|
||||
sparc*) \
|
||||
echo sparc \
|
||||
;; \
|
||||
sun4u) \
|
||||
echo sparc \
|
||||
;; \
|
||||
*) \
|
||||
uname -m \
|
||||
;; \
|
||||
esac
|
||||
ARCH = $(shell $(archExpr) )
|
||||
|
||||
CCDEBUG =
|
||||
PICFLAGS = -fPIC -DPIC
|
||||
INCLUDES = -I$(ROOTDIR)/include -I$(ROOTDIR)/include/$(PLATFORM) -I../../public -I../../public/$(PLATFORM) -I$(WFJDKHOME)/include -I$(WFJDKHOME)/include/$(PLATFORM)
|
||||
EXTRA_CFLAGS = $(CCOPT) $(CCDEBUG)
|
||||
|
||||
CFLAGS = -D_REENTRANT $(PICFLAGS) $(EXTRA_CFLAGS) $(INCLUDES) -D$(JVMTYPE) -D$(THREADTYPE) -DXP_UNIX -D_GNU_SOURCE -D_JVMP_IMPLEMENTATION
|
||||
LIBFLAGS = -shared $(CCDEBUG)
|
||||
|
||||
ifeq ($(PLATFORM),linux)
|
||||
CFLAGS += -rdynamic
|
||||
XLIBS= -L/usr/X11R6/lib -lXt
|
||||
PLUGINLIBS=-ldl
|
||||
HOSTLIBS= -ldl -lpthread $(GTKLIBS)
|
||||
INCLUDES += -I/usr/X11R6/include
|
||||
CXXFLAGS=
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),solaris)
|
||||
XLIBS= -L/usr/openwin/lib -lXt
|
||||
PLUGINLIBS=-ldl -lthread
|
||||
HOSTLIBS= -ldl -lthread $(GTKLIBS)
|
||||
INCLUDES += -I/usr/openwin/include
|
||||
CXXFLAGS= -fpermissive
|
||||
endif
|
||||
|
||||
GTKLIBS = $(shell gtk-config --libs)
|
||||
GTKCFLAGS = $(shell gtk-config --cflags)
|
||||
|
||||
|
||||
CFLAGS += -DARCH="\"$(ARCH)\"" -DJVMKIND="\"$(JVMKIND)\"" -DPLATFORM="\"$(PLATFORM)\""
|
||||
CXXFLAGS += $(GTKCFLAGS) $(INCLUDES) -DXP_UNIX
|
||||
|
||||
ifeq ($(USE_SHM), 1)
|
||||
CFLAGS += -DJVMP_USE_SHM
|
||||
else
|
||||
PLUGINLIBS+=-lpthread
|
||||
endif
|
|
@ -1,183 +0,0 @@
|
|||
#
|
||||
# The contents of this file are subject to the Mozilla Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is The Waterfall Java Plugin Module
|
||||
#
|
||||
# The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
# Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# $Id: GNUmakefile,v 1.1 2001/05/09 17:29:53 edburns%acm.org Exp $
|
||||
#
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
# Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
|
||||
include Defs.gmk
|
||||
#___________________________________________________________________
|
||||
# sources of Java Plugin DLL
|
||||
PLUGINCSRCDIR = ../../src/plugin
|
||||
ifeq ($(USE_SHM), 1)
|
||||
PLUGINCSRCS = shmtran.c java_plugin_shm.c
|
||||
PLUGIN_DLL = libjvmp_shm.so
|
||||
else
|
||||
PLUGINCSRCS = jpthreads.c java_plugin.c
|
||||
PLUGIN_DLL = libjvmp.so
|
||||
endif
|
||||
|
||||
# source of native methods og WF
|
||||
PLUGINNATIVESRC=native.c
|
||||
|
||||
# native methods of Waterfall itself
|
||||
PLUGIN_NATIVE_DLL = libJVMPnatives.so
|
||||
|
||||
# source of Mozilla-dependent module - should be separeated
|
||||
MOZEXTSRCDIR = ../../src/plugin/mozilla
|
||||
MOZEXTCSRC = wfe_mozilla.c wfm6_native.c
|
||||
MOZEXT_DLL = libwf_moz6.so
|
||||
|
||||
PRELOAD_HACK = Helper.libXm.so.4
|
||||
|
||||
TESTEXTSRCDIR = ../../src/host
|
||||
TESTEXTCSRC = test_extension.c
|
||||
TESTEXT_DLL = libwf_test.so
|
||||
|
||||
# source of Netscape4x-dependent module - should be separeated
|
||||
NCEXTSRCDIR = ../../src/plugin/netscape4
|
||||
NCEXTCSRC = wfe_netscape4.c shmtran.c
|
||||
NCEXT_DLL = libwf_netscape4.so
|
||||
|
||||
HOSTCPPSRCDIR = ../../src/host
|
||||
HOSTCPPSRCS = host.cpp
|
||||
HOSTPROG = plugin_host
|
||||
|
||||
VPATH=$(PLUGINCSRCDIR):$(HOSTCPPSRCDIR):$(MOZEXTSRCDIR):$(NCEXTSRCDIR):$(TESTEXTSRCDIR):$(PLUGINCSRCDIR)/unix
|
||||
|
||||
|
||||
|
||||
PLUGINOBJS=$(PLUGINCSRCS:%.c=%.o)
|
||||
PLUGIN_NATIVE_OBJS=$(PLUGINNATIVESRC:%.c=%.o)
|
||||
HOSTOBJS=$(HOSTCPPSRCS:%.cpp=%.o)
|
||||
MOZEXTOBJS = $(MOZEXTCSRC:%.c=%.o)
|
||||
NCEXTOBJS = $(NCEXTCSRC:%.c=%.o)
|
||||
TESTEXTOBJS=$(TESTEXTCSRC:%.c=%.o)
|
||||
|
||||
all: sane
|
||||
release: all
|
||||
@ cd ../java; $(MAKE) release
|
||||
@ rm -rf wfrelease; mkdir wfrelease; mkdir wfrelease/ext
|
||||
@ cp $(PRELOAD_HACK) wfrelease
|
||||
@ cp wf.jar wfrelease
|
||||
@ cp $(PLUGIN_DLL) wfrelease
|
||||
@ cp $(MOZEXT_DLL) wfrelease
|
||||
@ cp $(PLUGIN_NATIVE_DLL) wfrelease
|
||||
@ cp plugin.policy wfrelease
|
||||
@ cp set_paths wfrelease
|
||||
@ cp ext/*.jar wfrelease/ext
|
||||
@ $(TAR) czf wf-bin.tgz wfrelease
|
||||
@ echo "Release is wf-bin.tgz"
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .cpp .c .o
|
||||
.cpp.o:
|
||||
$(CXX) $(CXXFLAGS) -c $<
|
||||
.c.o:
|
||||
$(CC) $(CFLAGS) -c $<
|
||||
|
||||
ifndef WFJDKHOME
|
||||
sane:
|
||||
@echo
|
||||
@echo "Set WFJDKHOME before"
|
||||
@echo
|
||||
else
|
||||
sane: GNUmakefile plugin host_prog ext plugin.policy
|
||||
endif
|
||||
|
||||
natives: plugin_no_java host_prog
|
||||
plugin_no_java: plugin_objs plugin_dll plugin_native_dll plugin_exec
|
||||
plugin: plugin_no_java java
|
||||
plugin_objs: $(PLUGINOBJS) $(PLUGIN_NATIVE_OBJS)
|
||||
plugin_dll: $(PLUGIN_DLL)
|
||||
ext: $(MOZEXT_DLL) $(NCEXT_DLL) $(TESTEXT_DLL) $(PRELOAD_HACK)
|
||||
$(MOZEXT_DLL): $(MOZEXTOBJS)
|
||||
$(LD) $(LIBFLAGS) -o $(MOZEXT_DLL) $(MOZEXTOBJS)
|
||||
cp -f $(MOZEXT_DLL) libwf_moz6_g.so
|
||||
$(PRELOAD_HACK): ../../src/plugin/mozilla/XmHelper.c
|
||||
gcc -D_GNU_SOURCE -O2 -fPIC -shared ../../src/plugin/mozilla/XmHelper.c -o $(PRELOAD_HACK) -ldl
|
||||
$(TESTEXT_DLL): $(TESTEXTOBJS)
|
||||
$(LD) $(LIBFLAGS) -o $(TESTEXT_DLL) $(TESTEXTOBJS)
|
||||
cp -f $(TESTEXT_DLL) libwf_test_g.so
|
||||
ifeq ($(USE_SHM), 1)
|
||||
$(NCEXT_DLL): $(NCEXTOBJS)
|
||||
$(LD) $(LIBFLAGS) -o $(NCEXT_DLL) $(NCEXTOBJS)
|
||||
cp -f $(NCEXT_DLL) libwf_netscape4_g.so
|
||||
else
|
||||
$(NCEXT_DLL):
|
||||
@echo "Not building Netscape 4 extension if SHM disabled"
|
||||
endif
|
||||
$(PLUGIN_DLL): $(PLUGINOBJS)
|
||||
$(LD) $(LIBFLAGS) -o $(PLUGIN_DLL) $(PLUGINOBJS) $(PLUGINLIBS)
|
||||
plugin_native_dll: $(PLUGIN_NATIVE_DLL)
|
||||
$(PLUGIN_NATIVE_DLL): $(PLUGIN_NATIVE_OBJS)
|
||||
$(LD) $(LIBFLAGS) -o $(PLUGIN_NATIVE_DLL) $(PLUGIN_NATIVE_OBJS) $(JAVALIBS) $(XLIBS)
|
||||
cp -f $(PLUGIN_NATIVE_DLL) libJVMPnatives_g.so
|
||||
java:
|
||||
@cd ../java; $(MAKE) all
|
||||
|
||||
host_prog: $(HOSTOBJS) $(HOSTPROG)
|
||||
|
||||
host_objs: $(HOSTOBJS)
|
||||
$(HOSTPROG): $(HOSTOBJS)
|
||||
$(CXX) -o $(HOSTPROG) $(HOSTOBJS) $(HOSTLIBS)
|
||||
|
||||
clean: java_clean
|
||||
rm -f $(HOSTPROG) $(PLUGINOBJS) $(HOSTOBJS) core *.so *.o $(PRELOAD_HACK) plugin.policy
|
||||
|
||||
java_clean:
|
||||
@cd ../java; $(MAKE) clean
|
||||
|
||||
ifeq ($(USE_SHM), 1)
|
||||
plugin_exec: jvmp_exec
|
||||
jvmp_exec: java_plugin_shm_host.o shmtran.o
|
||||
$(CC) $(CFLAGS) -o jvmp_exec java_plugin_shm_host.o shmtran.o $(PLUGINLIBS)
|
||||
else
|
||||
plugin_exec:
|
||||
endif
|
||||
|
||||
plugin.policy: ../../java/plugin.policy
|
||||
@$(CP) -f ../../java/plugin.policy .
|
||||
.PHONY: java clean all host_objs plugin_native_dll plugin_exec
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
#
|
||||
# The contents of this file are subject to the Mozilla Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is The Waterfall Java Plugin Module
|
||||
#
|
||||
# The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
# Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# $Id: dump.sh,v 1.1 2001/05/09 17:29:53 edburns%acm.org Exp $
|
||||
#
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
# Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
|
||||
tar czvf /tmp/jp.tgz /ws/M2308/mozilla/modules/jvmp/java/ /ws/M2308/mozilla/modules/jvmp/public/ /ws/M2308/mozilla/modules/jvmp/src/ /ws/M2308/mozilla/modules/jvmp/build/java/ /ws/M2308/mozilla/modules/jvmp/build/unix/GNUmakefile
|
Двоичные данные
java/waterfall/wf/build/unix/ext/jpav.jar
Двоичные данные
java/waterfall/wf/build/unix/ext/jpav.jar
Двоичный файл не отображается.
Двоичные данные
java/waterfall/wf/build/unix/ext/moz6.jar
Двоичные данные
java/waterfall/wf/build/unix/ext/moz6.jar
Двоичный файл не отображается.
|
@ -1,116 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is The Waterfall Java Plugin Module
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* $Id: gtktest.c,v 1.1 2001/05/09 17:29:53 edburns%acm.org Exp $
|
||||
*
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <pthread.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
void destroy( GtkWidget *widget,
|
||||
gpointer data )
|
||||
{
|
||||
gtk_main_quit();
|
||||
}
|
||||
|
||||
void my_exit() {
|
||||
static int t=0;
|
||||
fprintf(stderr, "My at exit called %d\n", t++);
|
||||
}
|
||||
|
||||
int g_argc;
|
||||
char** g_argv;
|
||||
|
||||
|
||||
void* thread_func(void* arg) {
|
||||
GtkWidget* window;
|
||||
char* name = (char*) arg;
|
||||
GtkWidget* button;
|
||||
static int s = 0;
|
||||
|
||||
atexit(&my_exit);
|
||||
if (s) {
|
||||
return;
|
||||
while (1) {usleep(100);}
|
||||
putenv("DISPLAY=hercules:1");
|
||||
};
|
||||
s = 1;
|
||||
|
||||
/* gtk_init(&g_argc, &g_argv); */
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (window), "destroy",
|
||||
GTK_SIGNAL_FUNC (destroy), NULL);
|
||||
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
|
||||
|
||||
button = gtk_button_new_with_label (name);
|
||||
/*
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (destroy), NULL);
|
||||
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (gtk_widget_destroy),
|
||||
GTK_OBJECT (window));
|
||||
*/
|
||||
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (gtk_main_quit),
|
||||
GTK_OBJECT (window));
|
||||
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (window), button);
|
||||
gtk_widget_show (button);
|
||||
gtk_widget_show (window);
|
||||
|
||||
gtk_main ();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
pthread_t t[2];
|
||||
void* res;
|
||||
|
||||
g_argc = argc;
|
||||
g_argv = argv;
|
||||
gtk_init(&g_argc, &g_argv);
|
||||
atexit(&my_exit);
|
||||
|
||||
if (pthread_create(&(t[0]), NULL, thread_func, "Frame one") != 0) {
|
||||
fprintf(stderr, "Cannot create first thread\n");
|
||||
exit(1);
|
||||
};
|
||||
if (1 && pthread_create(&(t[1]), NULL, thread_func, "Frame two") != 0) {
|
||||
fprintf(stderr, "Cannot create second thread\n");
|
||||
exit(1);
|
||||
};
|
||||
pthread_join(t[0], &res);
|
||||
pthread_join(t[1], &res);
|
||||
/*while (1) {
|
||||
usleep(100);
|
||||
fprintf(stderr, ".");
|
||||
};
|
||||
*/
|
||||
return 0;
|
||||
}
|
|
@ -1,69 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is The Waterfall Java Plugin Module
|
||||
#
|
||||
# The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
# Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# $Id: set_paths,v 1.1 2001/05/09 17:29:53 edburns%acm.org Exp $
|
||||
#
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
# Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
|
||||
WFHOME=`pwd`
|
||||
# Customizable part
|
||||
JVMTYPE=sun
|
||||
#JVMTYPE=ibm
|
||||
JVM_KIND=hotspot
|
||||
#JVM_KIND=classic
|
||||
XTXMMIX=1
|
||||
# End of customizable part
|
||||
|
||||
case "`uname -m`" in \
|
||||
i[3-6]86) \
|
||||
ARCH=i386 \
|
||||
;; \
|
||||
i86pc) \
|
||||
ARCH=i386 \
|
||||
;; \
|
||||
sparc*) \
|
||||
ARCH=sparc \
|
||||
;; \
|
||||
sun4u) \
|
||||
ARCH=sparc \
|
||||
;; \
|
||||
*) \
|
||||
ARCH=uname -m \
|
||||
;; \
|
||||
esac
|
||||
# workaround for bug/feature in JDK - it resolving libjvm.so using
|
||||
# dlopen("libjvm.so") - doesn't work if libjvm.so isn't in LD_LIBRARY_PATH
|
||||
case $JVMTYPE in
|
||||
sun)
|
||||
LD_LIBRARY_PATH=${WFJDKHOME}/jre/lib/${ARCH}/${JVM_KIND}:${WFJDKHOME}/jre/lib/${ARCH}:${LD_LIBRARY_PATH}
|
||||
;;
|
||||
ibm)
|
||||
LD_LIBRARY_PATH=${WFJDKHOME}/jre/bin/${JVM_KIND}:${WFJDKHOME}/jre/bin:${LD_LIBRARY_PATH}
|
||||
;;
|
||||
esac
|
||||
if [ $XTXMMIX -eq 1 ]; then
|
||||
# workaround for mixing of libXt.so and libXm.so in one application, if first
|
||||
# loaded is libXt.so - as with Mozilla.
|
||||
LD_PRELOAD=${WFHOME}/Helper.libXm.so.4
|
||||
fi
|
||||
|
||||
export WFHOME LD_LIBRARY_PATH LD_PRELOAD
|
|
@ -1,79 +0,0 @@
|
|||
#!/bin/csh -x
|
||||
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is The Waterfall Java Plugin Module
|
||||
#
|
||||
# The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
# Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# $Id: set_paths.csh,v 1.1 2001/05/09 17:29:53 edburns%acm.org Exp $
|
||||
#
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
# Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
|
||||
setenv WFHOME `pwd`
|
||||
# Customizable part
|
||||
setenv JVMTYPE sun
|
||||
#setenv JVMTYPE ibm
|
||||
setenv JVM_KIND hotspot
|
||||
#setenv JVM_KIND classic
|
||||
setenv XTXMMIX 1
|
||||
# End of customizable part
|
||||
|
||||
switch (`uname -m`)
|
||||
case i[3-6]86:
|
||||
setenv ARCH i386
|
||||
breaksw
|
||||
|
||||
case i86pc:
|
||||
setenv ARCH i386
|
||||
breaksw
|
||||
|
||||
case sparc*:
|
||||
setenv ARCH sparc
|
||||
breaksw
|
||||
|
||||
case sun4u:
|
||||
setenv ARCH sparc
|
||||
breaksw
|
||||
|
||||
default:
|
||||
setenv ARCH `uname -m`
|
||||
|
||||
endsw
|
||||
|
||||
if ($?LD_LIBRARY_PATH) then
|
||||
# me such a stupid - how to use negation in C shell
|
||||
else
|
||||
setenv LD_LIBRARY_PATH ""
|
||||
endif
|
||||
|
||||
# workaround for bug/feature in JDK - it resolving libjvm.so using
|
||||
# dlopen("libjvm.so") - doesn't work if libjvm.so isn't in LD_LIBRARY_PATH
|
||||
switch ($JVMTYPE)
|
||||
case sun:
|
||||
setenv LD_LIBRARY_PATH {$WFJDKHOME}/jre/lib/{$ARCH}/{$JVM_KIND}:{$WFJDKHOME}/jre/lib/{$ARCH}:{$LD_LIBRARY_PATH}
|
||||
breaksw
|
||||
case ibm:
|
||||
setenv LD_LIBRARY_PATH $WFJDKHOME/jre/bin/$JVM_KIND:$WFJDKHOME/jre/bin/$ARCH:$LD_LIBRARY_PATH
|
||||
breaksw
|
||||
endsw
|
||||
|
||||
if ($XTXMMIX == 1) then
|
||||
# workaround for mixing of libXt.so and libXm.so in one application, if first
|
||||
# loaded is libXt.so - as with Mozilla.
|
||||
setenv LD_PRELOAD $WFHOME/Helper.libXm.so.4
|
||||
endif
|
|
@ -1,4 +0,0 @@
|
|||
LIBRARY jvmp
|
||||
|
||||
EXPORTS
|
||||
JVMP_GetPlugin @1
|
|
@ -1,192 +0,0 @@
|
|||
#
|
||||
# The contents of this file are subject to the Mozilla Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is The Waterfall Java Plugin Module
|
||||
#
|
||||
# The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
# Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# $Id: makefile.win,v 1.1 2001/05/09 17:29:53 edburns%acm.org Exp $
|
||||
#
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
# Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
|
||||
BUILDDIR=.
|
||||
ROOTDIR=..\..
|
||||
|
||||
CC=cl
|
||||
CXX=cl
|
||||
CP=copy
|
||||
DEL=del/f/q
|
||||
DELTREE=del/S/Q/F
|
||||
MKDIR=mkdir
|
||||
ZIP=zip
|
||||
LD = link
|
||||
MAKE=nmake -nologo
|
||||
|
||||
# type of really used JVM
|
||||
# values: _JVMP_IBMJVM, _JVMP_SUNJVM
|
||||
#JVMTYPE = _JVMP_IBMJVM
|
||||
JVMTYPE = _JVMP_SUNJVM
|
||||
# kind of JVM: classic, hotspot
|
||||
JVMKIND = hotspot
|
||||
#JVMKIND = classic
|
||||
THREADTYPE = _JVMP_WIN32THREADS
|
||||
ARCH=win32
|
||||
|
||||
|
||||
CCDEBUG = -MDd -Zi -Od
|
||||
#CCDEBUG =
|
||||
INCLUDES = -I$(ROOTDIR)\include -I..\..\public -I..\..\public\$(ARCH) -I$(WFJDKHOME)\include -I$(WFJDKHOME)\include\$(ARCH)
|
||||
# XXX: hardcoded platform
|
||||
EXTRA_CFLAGS = $(CCDEBUG) -D$(JVMTYPE) -D$(THREADTYPE) -DXP_WIN32 -DARCH="\"win32\"" -DWIN32 -DJVMKIND="\"$(JVMKIND)\"" -DPLATFORM="\"i386\""
|
||||
|
||||
CFLAGS = -nologo -DWIN32 $(PICFLAGS) $(EXTRA_CFLAGS) $(INCLUDES) -WX
|
||||
CXXFLAGS = $(CFLAGS) -I$(HOSTINCPATH) -I$(HOSTINCPATH)\glib -I$(HOSTINCPATH)\gdk -DXP_WIN32
|
||||
LIBFLAGS = -nologo -debug
|
||||
|
||||
PLUGINCSRCDIR = ..\..\src\plugin
|
||||
PLUGINMDDIR = ..\..\src\plugin\win32
|
||||
|
||||
PLUGINCSRCS = java_plugin.c jpthreads.c
|
||||
# source of native methods for Plugin
|
||||
PLUGINNATIVESRC = native.c
|
||||
PLUGIN_DLL = jvmp.dll
|
||||
|
||||
# well, just a hack
|
||||
PLUGIN_NATIVE_DLL=JVMPnatives.dll
|
||||
|
||||
# source of Mozilla-dependent module - should be separated
|
||||
MOZEXTSRCDIR = ..\..\src\plugin\mozilla
|
||||
MOZEXTCSRC = wfe_mozilla.c wfm6_native.c
|
||||
MOZEXT_DLL = wf_moz6.dll
|
||||
TESTEXTSRCDIR = ..\..\src\host
|
||||
TESTEXTCSRC = test_extension.c
|
||||
TESTEXT_DLL = wf_test.dll
|
||||
|
||||
HOSTCPPSRCDIR = ..\..\src\host
|
||||
HOSTCPPSRCS = host.cpp
|
||||
HOSTPROG=plugin_host.exe
|
||||
|
||||
PLUGINOBJS=$(PLUGINCSRCS:.c=.obj)
|
||||
PLUGIN_NATIVE_OBJS=$(PLUGINNATIVESRC:.c=.obj)
|
||||
HOSTOBJS=$(HOSTCPPSRCS:.cpp=.obj)
|
||||
MOZEXTOBJS = $(MOZEXTCSRC:.c=.obj)
|
||||
NCEXTOBJS = $(NCEXTCSRC:.c=.obj)
|
||||
TESTEXTOBJS=$(TESTEXTCSRC:.c=.obj)
|
||||
OBJDIR =
|
||||
|
||||
INSTALLER = installer.exe
|
||||
INSTSRCDIR = ..\..\src\plugin\win32
|
||||
INSTSRC = installer.c
|
||||
INSTOBJS = $(INSTSRC:.c=.obj)
|
||||
|
||||
PLUGINLIBS=user32.lib
|
||||
INSTLIBS=user32.lib
|
||||
|
||||
HOSTLIBS=$(HOSTLIBPATH)\glib-1.3.lib $(HOSTLIBPATH)\gtk-1.3.lib $(HOSTLIBPATH)\gdk-1.3.lib
|
||||
|
||||
#instead of vpath
|
||||
{$(PLUGINCSRCDIR)}.c{$(OBJDIR)}.obj:
|
||||
@$(CC) $(CFLAGS) -D_JVMP_IMPLEMENTATION -c -Fo$@ $<
|
||||
{$(PLUGINMDDIR)}.c{$(OBJDIR)}.obj:
|
||||
@$(CC) $(CFLAGS) -D_JVMP_IMPLEMENTATION -c -Fo$@ $<
|
||||
{$(HOSTCPPSRCDIR)}.cpp{$(OBJDIR)}.obj:
|
||||
@echo $<
|
||||
@$(CXX) $(CXXFLAGS) -c -Fo$@ $<
|
||||
{$(MOZEXTSRCDIR)}.c{$(OBJDIR)}.obj:
|
||||
@$(CC) $(CFLAGS) -c -Fo$@ $<
|
||||
{$(TESTEXTSRCDIR)}.c{$(OBJDIR)}.obj:
|
||||
@$(CC) $(CFLAGS) -c -Fo$@ $<
|
||||
{$(INSTSRCDIR)}.c{$(OBJDIR)}.obj:
|
||||
@$(CC) $(CFLAGS) -c -Fo$@ $<
|
||||
|
||||
|
||||
all: makefile.win ext plugin
|
||||
release: all
|
||||
@ cd ..\java
|
||||
@ $(MAKE) -fmakefile.win release
|
||||
@ cd ..\win32
|
||||
@ IF NOT EXIST wfrelease $(MKDIR) wfrelease
|
||||
@ $(DELTREE) wfrelease > NUL
|
||||
@ $(MKDIR) wfrelease\ext
|
||||
@ $(CP) wf.jar wfrelease > NUL
|
||||
@ $(CP) $(PLUGIN_DLL) wfrelease > NUL
|
||||
@ $(CP) $(MOZEXT_DLL) wfrelease > NUL
|
||||
@ $(CP) $(PLUGIN_NATIVE_DLL) wfrelease > NUL
|
||||
@ $(CP) plugin.policy wfrelease > NUL
|
||||
@ $(CP) ext\*.jar wfrelease\ext\
|
||||
@ $(ZIP) -r wf-bin.zip wfrelease
|
||||
@ echo "Release is wf-bin.zip"
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .cpp .c .obj
|
||||
|
||||
.cpp.obj:
|
||||
$(CXX) $(CFLAGS) -c $<
|
||||
plugin_no_java: plugin_objs plugin_dll plugin_native_dll plugin_exec plugin.policy
|
||||
#$(INSTALLER)
|
||||
plugin: plugin_no_java java_classes
|
||||
plugin_objs: $(PLUGINOBJS) $(PLUGIN_NATIVE_OBJS)
|
||||
plugin_dll: $(PLUGIN_DLL)
|
||||
ext: $(MOZEXT_DLL) $(TESTEXT_DLL)
|
||||
$(MOZEXT_DLL): $(MOZEXTOBJS)
|
||||
@echo linking $@
|
||||
@$(LD) $(LIBFLAGS) -dll -def:wfe_mozilla.def -out:$@ $(MOZEXTOBJS)
|
||||
$(TESTEXT_DLL): $(TESTEXTOBJS)
|
||||
@echo linking $<
|
||||
@$(LD) $(LIBFLAGS) -dll -def:wfe_test.def -out:$(TESTEXT_DLL) $(TESTEXTOBJS)
|
||||
$(PLUGIN_DLL): $(PLUGINOBJS)
|
||||
@echo linking $@
|
||||
@$(LD) $(LIBFLAGS) -dll -def:jvmp.def -out:$@ $(PLUGINOBJS) $(PLUGINLIBS)
|
||||
plugin_native_dll: $(PLUGIN_NATIVE_DLL)
|
||||
$(PLUGIN_NATIVE_DLL): $(PLUGIN_NATIVE_OBJS)
|
||||
@echo linking $@
|
||||
@$(LD) $(LIBFLAGS) -dll -out:$@ $(PLUGIN_NATIVE_OBJS)
|
||||
@$(CP) $@ JVMPnatives_g.dll > NUL
|
||||
plugin.policy: ..\..\java\plugin.policy
|
||||
@$(CP) ..\..\java\plugin.policy . > NUL
|
||||
java_classes:
|
||||
@ cd ..\java
|
||||
$(MAKE) -fmakefile.win all
|
||||
|
||||
|
||||
host_prog: $(HOSTOBJS) $(HOSTPROG)
|
||||
|
||||
host_objs: $(HOSTOBJS)
|
||||
$(HOSTPROG): $(HOSTOBJS)
|
||||
@echo linking $@
|
||||
@$(LD) $(LIBFLAGS) -out:$(HOSTPROG) $(HOSTOBJS) $(HOSTLIBS)
|
||||
|
||||
clean:
|
||||
@echo Removing compiled files..
|
||||
@-del/Q $(PLUGINOBJS) $(HOSTOBJS) *.exe *.dll *.obj *.ilk *.exp *.lib *.pdb
|
||||
@rm -rf ext
|
||||
@cd ..\java
|
||||
@$(MAKE) -fmakefile.win clean
|
||||
|
||||
|
||||
$(INSTALLER): $(INSTOBJS)
|
||||
@echo Compiling installer
|
||||
$(LD) $(LIBFLAGS) -out:$(INSTALLER) $(INSTOBJS) $(INSTLIBS)
|
||||
|
||||
plugin_exec:
|
||||
.PHONY: java_classes clean all host_objs plugin_native_dll plugin_exec release
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is The Waterfall Java Plugin Module
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* $Id: plugin.policy,v 1.1 2001/05/09 17:29:53 edburns%acm.org Exp $
|
||||
*
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
*/
|
||||
|
||||
grant codeBase "file:${jvmp.home}/classes/" {
|
||||
permission java.security.AllPermission;
|
||||
};
|
||||
grant codeBase "file:${jvmp.home}/wf.jar" {
|
||||
permission java.security.AllPermission;
|
||||
};
|
||||
|
||||
grant {
|
||||
permission java.lang.RuntimePermission "accessClassInPackage.sun.jvmp";
|
||||
permission java.lang.RuntimePermission "accessClassInPackage.sun.jvmp.applet";
|
||||
permission java.lang.RuntimePermission "accessClassInPackage.sun.security.action";
|
||||
permission java.lang.RuntimePermission "accessClassInPackage.sun.awt.image";
|
||||
permission java.lang.RuntimePermission "accessClassInPackage.sun.audio";
|
||||
permission java.lang.RuntimePermission "accessClassInPackage.sun.applet";
|
||||
permission java.lang.RuntimePermission "modifyThread";
|
||||
};
|
|
@ -1,30 +0,0 @@
|
|||
@REM
|
||||
@REM The contents of this file are subject to the Mozilla Public
|
||||
@REM License Version 1.1 (the "License"); you may not use this file
|
||||
@REM except in compliance with the License. You may obtain a copy of
|
||||
@REM the License at http://www.mozilla.org/MPL/
|
||||
@REM
|
||||
@REM Software distributed under the License is distributed on an "AS
|
||||
@REM IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
@REM implied. See the License for the specific language governing
|
||||
@REM rights and limitations under the License.
|
||||
@REM
|
||||
@REM The Original Code is The Waterfall Java Plugin Module
|
||||
@REM
|
||||
@REM The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
@REM Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
@REM All Rights Reserved.
|
||||
@REM
|
||||
@REM $Id: set_env.bat,v 1.1 2001/05/09 17:29:53 edburns%acm.org Exp $
|
||||
@REM
|
||||
@REM
|
||||
@REM Contributor(s):
|
||||
@REM
|
||||
@REM Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
|
||||
@echo off
|
||||
echo Setting some variables for WF....
|
||||
set WFJDKHOME=c:\jdk1.3
|
||||
set HOSTINCPATH=d:\inn\libs\include
|
||||
set HOSTLIBPATH=d:\inn\libs\lib
|
||||
set PATH=%HOSTLIBPATH%;%PATH%
|
|
@ -1,9 +0,0 @@
|
|||
LIBRARY wf_moz6
|
||||
|
||||
EXPORTS
|
||||
JVMP_GetExtension
|
||||
Java_sun_jvmp_mozilla_MozillaAppletPeer_getParams
|
||||
Java_sun_jvmp_mozilla_MozillaAppletPeer_nativeShowDocument
|
||||
Java_sun_jvmp_mozilla_MozillaAppletPeer_nativeShowStatus
|
||||
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
LIBRARY wf_test
|
||||
|
||||
EXPORTS
|
||||
JVMP_GetExtension
|
||||
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
Mon Apr 2 16:43:40 2001:
|
||||
Started ChangeLog.
|
||||
Major clean up of build system
|
||||
No more jni.h, jni_md.h in Waterfall tree
|
||||
Added "release" target to makefile - allows binary-only release bundling
|
||||
Waterfall classes now in JAR
|
||||
|
||||
Thu Apr 26 02:48:51 2001:
|
||||
Minor build system updates.
|
||||
Fixed crashers on Solaris by simple
|
||||
reordering of some entries in LD_LIBRARY_PATH.
|
||||
Added support for x86 Solaris, but it sometimes crashes -
|
||||
almost sure not Waterfall fault.
|
|
@ -1,17 +0,0 @@
|
|||
1. Netscape 4 build is broken, as I see no reasons to work on it (very tight
|
||||
in time).
|
||||
If someone wishes to do it - please note that on Unix you need to run JVM
|
||||
in separate process. It's bad for speed. Also you need to complete remote
|
||||
bridge shmtran.[ch] as it shouldn't work for calls like
|
||||
NC->Java->NC for now. It's not too hard, you just need to poll on proper
|
||||
SHM queue
|
||||
when waiting for completion of the call, and if something has come -
|
||||
process it.
|
||||
|
||||
2. Rewrite code borrowed from Java Plugin and remove dead code.
|
||||
|
||||
3. Add handler for access to browser-provided protocols from applets
|
||||
(most obvious HTTPS).
|
||||
|
||||
4. Complete Waterfall own security model - maybe just get rid of capabilies
|
||||
at all, if I'll see no use of it.
|
|
@ -1,54 +0,0 @@
|
|||
How to build Waterfall:
|
||||
|
||||
Requirments:
|
||||
Linux/Solaris:
|
||||
gcc, pthreads, JDK1.3, LessTif/Motif headers only
|
||||
glib, gtk+ - only for test program, not used in Waterfall
|
||||
|
||||
Win32:
|
||||
Visual C++ 5.0, 6.0, JDK1.3
|
||||
glib, gtk+ - only for test program -
|
||||
can be found at http://user.sgic.fi/~tml/gimp/win32/
|
||||
|
||||
Build, run:
|
||||
Linux/Solaris:
|
||||
- get CVS tree
|
||||
- cd build/unix
|
||||
- export/setenv WFJDKHOME=<path to JDK1.3 to be used by Waterfall>
|
||||
- edit Defs.gmk to select desired JVM type/vendor (default is Sun Hotspot
|
||||
JVM)
|
||||
- gmake
|
||||
- edit set_path script according to selected JVM type/vendor
|
||||
- source ./set_path
|
||||
- ./plugin_host - runs test program
|
||||
It allows
|
||||
- to start/stop JVM, stop hangs up program, as not implemented by JDK
|
||||
- obtain capabilities (required to perform other actions)
|
||||
- show/hide Java console
|
||||
- get Waterfall module description
|
||||
- load test extension and interact with it
|
||||
- register native window and test it using test extension
|
||||
- test Java/native thread interaction
|
||||
Win32:
|
||||
- get CVS tree
|
||||
- set WFJDKHOME=<path to JDK1.3 to be used by Waterfall>
|
||||
- cd build\win32
|
||||
- edit makefile.win to select desired JVM type/vendor(default is Sun
|
||||
Hotspot JVM)
|
||||
- if you wish to build test program
|
||||
- make folder for GTK/GDK libs
|
||||
- mkdir include and copy GTK/GDK/GLIB headers there
|
||||
- mkdir lib and copy GTK/GDK/GLIB libs there
|
||||
- set env variables HOSTINCPATH and HOSTLIBPATH pointing on include and lib respectively
|
||||
- type nmake -f makefile.win host_prog
|
||||
- nmake -f makefile.win
|
||||
- set WFHOME=<path to current directory>
|
||||
- plugin_host.exe - runs test program
|
||||
- to start/stop JVM, stop hangs up program, as not implemented by JDK
|
||||
- obtain capabilities (required to perform other actions)
|
||||
- show/hide Java console
|
||||
- get Waterfall module description
|
||||
- load test extension and interact with it
|
||||
- register native window and test it using test extension
|
||||
- test Java/native thread interaction - not yet implemented
|
||||
on Win32
|
|
@ -1,30 +0,0 @@
|
|||
Here follows short description of building and running Waterfall binaries
|
||||
with Mozilla web browser.
|
||||
|
||||
Unix (Solaris, Linux)
|
||||
|
||||
1. export/setenv WFJDKHOME='JDK_1_3_directory'
|
||||
2. checkout wf_moz6 CVS module
|
||||
3. put resulting wf_moz6 directory to $(MOZILLA)/modules
|
||||
4. cd $(MOZILLA)/modules/wf_moz6
|
||||
5. edit src/Makefile.in and set WF variable to point to the
|
||||
top of WF tree (I hope you already checkouted and built WF tree,
|
||||
if not - read building.txt).
|
||||
6. gmake
|
||||
7. pushd $(WF)/build/unix; source set_paths; popd
|
||||
8. run Mozilla from the same command line prompt
|
||||
|
||||
Windows
|
||||
|
||||
1. set WFJDKHOME='JDK_1_3_directory'
|
||||
2. checkout wf_moz6 CVS module
|
||||
3. put resulting wf_moz6 directory to $(MOZILLA)\modules
|
||||
4. cd $(MOZILLA)\modules\wf_moz6
|
||||
5. edit src\makefile.win and set WF variable to point to the
|
||||
top of WF tree (I hope you already checkouted and built WF tree,
|
||||
if not - read building.txt).
|
||||
6. make -fmakefile.win
|
||||
7. set WFHOME=$(WF)\build\win32
|
||||
8. run Mozilla
|
||||
|
||||
|
|
@ -1,55 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is The Waterfall Java Plugin Module
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* $Id: awt_Plugin.h,v 1.1 2001/05/09 17:29:53 edburns%acm.org Exp $
|
||||
*
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
*/
|
||||
|
||||
/*
|
||||
* Export functions for Netscape to use to get AWT info
|
||||
*/
|
||||
|
||||
#ifndef _AWT_PLUGIN_H_
|
||||
#define _AWT_PLUGIN_H_
|
||||
|
||||
#include <jni.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
|
||||
void getAwtLockFunctions(void (**AwtLock)(JNIEnv *),
|
||||
void (**AwtUnlock)(JNIEnv *),
|
||||
void (**AwtNoFlushUnlock)(JNIEnv *),
|
||||
void *);
|
||||
|
||||
void getExtAwtData(Display *,
|
||||
int,
|
||||
int *, /* awt_depth */
|
||||
Colormap *, /* awt_cmap */
|
||||
Visual **, /* awt_visInfo.visual */
|
||||
int *, /* awt_num_colors */
|
||||
void *);
|
||||
|
||||
void getAwtData(int *, Colormap *, Visual **, int *, void *);
|
||||
|
||||
Display *getAwtDisplay(void);
|
||||
|
||||
#endif /* _AWT_PLUGIN_H_ */
|
|
@ -1,21 +0,0 @@
|
|||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
#include <jni.h>
|
||||
/* Header for class sun_plugin_generic_motif_Plugin */
|
||||
|
||||
#ifndef _Included_sun_jvmp_generic_motif_Plugin
|
||||
#define _Included_sun_jvmp_generic_motif_Plugin
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/*
|
||||
* Class: sun_jvmp_generic_motif_Plugin
|
||||
* Method: getWidget
|
||||
* Signature: (IIIII)I
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL Java_sun_jvmp_generic_motif_Plugin_getWidget
|
||||
(JNIEnv *, jclass, jint, jint, jint, jint, jint);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
|
@ -1,69 +0,0 @@
|
|||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
#include <jni.h>
|
||||
/* Header for class sun_jvmp_generic_motif_PthreadSynchroObject */
|
||||
|
||||
#ifndef _Included_sun_jvmp_generic_motif_PthreadSynchroObject
|
||||
#define _Included_sun_jvmp_generic_motif_PthreadSynchroObject
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/*
|
||||
* Class: sun_jvmp_generic_motif_PthreadSynchroObject
|
||||
* Method: checkHandle
|
||||
* Signature: (J)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_sun_jvmp_generic_motif_PthreadSynchroObject_checkHandle
|
||||
(JNIEnv *, jobject, jlong);
|
||||
|
||||
/*
|
||||
* Class: sun_jvmp_generic_motif_PthreadSynchroObject
|
||||
* Method: doDestroy
|
||||
* Signature: (J)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_sun_jvmp_generic_motif_PthreadSynchroObject_doDestroy
|
||||
(JNIEnv *, jobject, jlong);
|
||||
|
||||
/*
|
||||
* Class: sun_jvmp_generic_motif_PthreadSynchroObject
|
||||
* Method: doLock
|
||||
* Signature: (J)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_sun_jvmp_generic_motif_PthreadSynchroObject_doLock
|
||||
(JNIEnv *, jobject, jlong);
|
||||
|
||||
/*
|
||||
* Class: sun_jvmp_generic_motif_PthreadSynchroObject
|
||||
* Method: doNotify
|
||||
* Signature: (J)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_sun_jvmp_generic_motif_PthreadSynchroObject_doNotify
|
||||
(JNIEnv *, jobject, jlong);
|
||||
|
||||
/*
|
||||
* Class: sun_jvmp_generic_motif_PthreadSynchroObject
|
||||
* Method: doNotifyAll
|
||||
* Signature: (J)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_sun_jvmp_generic_motif_PthreadSynchroObject_doNotifyAll
|
||||
(JNIEnv *, jobject, jlong);
|
||||
|
||||
/*
|
||||
* Class: sun_jvmp_generic_motif_PthreadSynchroObject
|
||||
* Method: doUnlock
|
||||
* Signature: (J)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_sun_jvmp_generic_motif_PthreadSynchroObject_doUnlock
|
||||
(JNIEnv *, jobject, jlong);
|
||||
|
||||
/*
|
||||
* Class: sun_jvmp_generic_motif_PthreadSynchroObject
|
||||
* Method: doWait
|
||||
* Signature: (JI)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_sun_jvmp_generic_motif_PthreadSynchroObject_doWait
|
||||
(JNIEnv *, jobject, jlong, jint);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
|
@ -1,102 +0,0 @@
|
|||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
#include <jni.h>
|
||||
/* Header for class sun_jvmp_mozilla_JSObject */
|
||||
|
||||
#ifndef _Included_sun_jvmp_mozilla_JSObject
|
||||
#define _Included_sun_jvmp_mozilla_JSObject
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/* Inaccessible static: m_evaluator */
|
||||
/*
|
||||
* Class: sun_jvmp_mozilla_JSObject
|
||||
* Method: JSFinalize
|
||||
* Signature: (IIJ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_sun_jvmp_mozilla_JSObject_JSFinalize
|
||||
(JNIEnv *, jclass, jint, jint, jlong);
|
||||
|
||||
/*
|
||||
* Class: sun_jvmp_mozilla_JSObject
|
||||
* Method: JSGetNativeJSObject
|
||||
* Signature: (JLjava/lang/String;[[B[IILjava/security/AccessControlContext;)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_sun_jvmp_mozilla_JSObject_JSGetNativeJSObject
|
||||
(JNIEnv *, jclass, jlong, jstring, jobjectArray, jintArray, jint, jobject);
|
||||
|
||||
/*
|
||||
* Class: sun_jvmp_mozilla_JSObject
|
||||
* Method: JSGetThreadID
|
||||
* Signature: (J)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_sun_jvmp_mozilla_JSObject_JSGetThreadID
|
||||
(JNIEnv *, jclass, jlong);
|
||||
|
||||
/*
|
||||
* Class: sun_jvmp_mozilla_JSObject
|
||||
* Method: JSObjectCall
|
||||
* Signature: (IIJLjava/lang/String;[[B[IILjava/lang/String;[Ljava/lang/Object;Ljava/security/AccessControlContext;)Ljava/lang/Object;
|
||||
*/
|
||||
JNIEXPORT jobject JNICALL Java_sun_jvmp_mozilla_JSObject_JSObjectCall
|
||||
(JNIEnv *, jclass, jint, jint, jlong, jstring, jobjectArray, jintArray, jint, jstring, jobjectArray, jobject);
|
||||
|
||||
/*
|
||||
* Class: sun_jvmp_mozilla_JSObject
|
||||
* Method: JSObjectEval
|
||||
* Signature: (IIJLjava/lang/String;[[B[IILjava/lang/String;Ljava/security/AccessControlContext;)Ljava/lang/Object;
|
||||
*/
|
||||
JNIEXPORT jobject JNICALL Java_sun_jvmp_mozilla_JSObject_JSObjectEval
|
||||
(JNIEnv *, jclass, jint, jint, jlong, jstring, jobjectArray, jintArray, jint, jstring, jobject);
|
||||
|
||||
/*
|
||||
* Class: sun_jvmp_mozilla_JSObject
|
||||
* Method: JSObjectGetMember
|
||||
* Signature: (IIJLjava/lang/String;[[B[IILjava/lang/String;Ljava/security/AccessControlContext;)Ljava/lang/Object;
|
||||
*/
|
||||
JNIEXPORT jobject JNICALL Java_sun_jvmp_mozilla_JSObject_JSObjectGetMember
|
||||
(JNIEnv *, jclass, jint, jint, jlong, jstring, jobjectArray, jintArray, jint, jstring, jobject);
|
||||
|
||||
/*
|
||||
* Class: sun_jvmp_mozilla_JSObject
|
||||
* Method: JSObjectGetSlot
|
||||
* Signature: (IIJLjava/lang/String;[[B[IIILjava/security/AccessControlContext;)Ljava/lang/Object;
|
||||
*/
|
||||
JNIEXPORT jobject JNICALL Java_sun_jvmp_mozilla_JSObject_JSObjectGetSlot
|
||||
(JNIEnv *, jclass, jint, jint, jlong, jstring, jobjectArray, jintArray, jint, jint, jobject);
|
||||
|
||||
/*
|
||||
* Class: sun_jvmp_mozilla_JSObject
|
||||
* Method: JSObjectRemoveMember
|
||||
* Signature: (IIJLjava/lang/String;[[B[IILjava/lang/String;Ljava/security/AccessControlContext;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_sun_jvmp_mozilla_JSObject_JSObjectRemoveMember
|
||||
(JNIEnv *, jclass, jint, jint, jlong, jstring, jobjectArray, jintArray, jint, jstring, jobject);
|
||||
|
||||
/*
|
||||
* Class: sun_jvmp_mozilla_JSObject
|
||||
* Method: JSObjectSetMember
|
||||
* Signature: (IIJLjava/lang/String;[[B[IILjava/lang/String;Ljava/lang/Object;Ljava/security/AccessControlContext;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_sun_jvmp_mozilla_JSObject_JSObjectSetMember
|
||||
(JNIEnv *, jclass, jint, jint, jlong, jstring, jobjectArray, jintArray, jint, jstring, jobject, jobject);
|
||||
|
||||
/*
|
||||
* Class: sun_jvmp_mozilla_JSObject
|
||||
* Method: JSObjectSetSlot
|
||||
* Signature: (IIJLjava/lang/String;[[B[IIILjava/lang/Object;Ljava/security/AccessControlContext;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_sun_jvmp_mozilla_JSObject_JSObjectSetSlot
|
||||
(JNIEnv *, jclass, jint, jint, jlong, jstring, jobjectArray, jintArray, jint, jint, jobject, jobject);
|
||||
|
||||
/*
|
||||
* Class: sun_jvmp_mozilla_JSObject
|
||||
* Method: JSObjectToString
|
||||
* Signature: (IIJ)Ljava/lang/String;
|
||||
*/
|
||||
JNIEXPORT jstring JNICALL Java_sun_jvmp_mozilla_JSObject_JSObjectToString
|
||||
(JNIEnv *, jclass, jint, jint, jlong);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
|
@ -1,45 +0,0 @@
|
|||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
#include <jni.h>
|
||||
/* Header for class sun_jvmp_mozilla_JavaScriptProtectionDomain */
|
||||
|
||||
#ifndef _Included_sun_jvmp_mozilla_JavaScriptProtectionDomain
|
||||
#define _Included_sun_jvmp_mozilla_JavaScriptProtectionDomain
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/*
|
||||
* Class: sun_jvmp_mozilla_JavaScriptProtectionDomain
|
||||
* Method: finalize
|
||||
* Signature: (J)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_sun_jvmp_mozilla_JavaScriptProtectionDomain_finalize
|
||||
(JNIEnv *, jobject, jlong);
|
||||
|
||||
/*
|
||||
* Class: sun_jvmp_mozilla_JavaScriptProtectionDomain
|
||||
* Method: getCodeBase
|
||||
* Signature: (J)Ljava/lang/String;
|
||||
*/
|
||||
JNIEXPORT jstring JNICALL Java_sun_jvmp_mozilla_JavaScriptProtectionDomain_getCodeBase
|
||||
(JNIEnv *, jclass, jlong);
|
||||
|
||||
/*
|
||||
* Class: sun_jvmp_mozilla_JavaScriptProtectionDomain
|
||||
* Method: getRawCerts
|
||||
* Signature: (J)[[B
|
||||
*/
|
||||
JNIEXPORT jobjectArray JNICALL Java_sun_jvmp_mozilla_JavaScriptProtectionDomain_getRawCerts
|
||||
(JNIEnv *, jclass, jlong);
|
||||
|
||||
/*
|
||||
* Class: sun_jvmp_mozilla_JavaScriptProtectionDomain
|
||||
* Method: implies
|
||||
* Signature: (JLjava/lang/String;Ljava/lang/String;)Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL Java_sun_jvmp_mozilla_JavaScriptProtectionDomain_implies
|
||||
(JNIEnv *, jobject, jlong, jstring, jstring);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
|
@ -1,58 +0,0 @@
|
|||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
#include <jni.h>
|
||||
/* Header for class sun_jvmp_mozilla_MozillaAppletPeer */
|
||||
|
||||
#ifndef _Included_sun_jvmp_mozilla_MozillaAppletPeer
|
||||
#define _Included_sun_jvmp_mozilla_MozillaAppletPeer
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/* Inaccessible static: appletPanels */
|
||||
/* Inaccessible static: audioClips */
|
||||
/* Inaccessible static: imageRefs */
|
||||
/*
|
||||
* Class: sun_jvmp_mozilla_MozillaAppletPeer
|
||||
* Method: finalizeParams
|
||||
* Signature: ()V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_sun_jvmp_mozilla_MozillaAppletPeer_finalizeParams
|
||||
(JNIEnv *, jobject);
|
||||
|
||||
/*
|
||||
* Class: sun_jvmp_mozilla_MozillaAppletPeer
|
||||
* Method: getParams
|
||||
* Signature: ()[[Ljava/lang/String;
|
||||
*/
|
||||
JNIEXPORT jobjectArray JNICALL Java_sun_jvmp_mozilla_MozillaAppletPeer_getParams
|
||||
(JNIEnv *, jobject);
|
||||
|
||||
/*
|
||||
* Class: sun_jvmp_mozilla_MozillaAppletPeer
|
||||
* Method: nativeShowDocument
|
||||
* Signature: (Ljava/lang/String;Ljava/lang/String;)Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL Java_sun_jvmp_mozilla_MozillaAppletPeer_nativeShowDocument
|
||||
(JNIEnv *, jobject, jstring, jstring);
|
||||
|
||||
/*
|
||||
* Class: sun_jvmp_mozilla_MozillaAppletPeer
|
||||
* Method: nativeShowStatus
|
||||
* Signature: (Ljava/lang/String;)Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL Java_sun_jvmp_mozilla_MozillaAppletPeer_nativeShowStatus
|
||||
(JNIEnv *, jobject, jstring);
|
||||
|
||||
|
||||
/*
|
||||
* Class: sun_jvmp_mozilla_MozillaAppletPeer
|
||||
* Method: nativeReturnJObject
|
||||
* Signature: (Ljava/lang/Object;J)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_sun_jvmp_mozilla_MozillaAppletPeer_nativeReturnJObject
|
||||
(JNIEnv *, jobject, jobject, jlong);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
|
@ -1,30 +0,0 @@
|
|||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
#include <jni.h>
|
||||
/* Header for class sun_jvmp_mozilla_MozillaPeerFactory */
|
||||
|
||||
#ifndef _Included_sun_jvmp_mozilla_MozillaPeerFactory
|
||||
#define _Included_sun_jvmp_mozilla_MozillaPeerFactory
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/* Inaccessible static: initialized */
|
||||
/*
|
||||
* Class: sun_jvmp_mozilla_MozillaPeerFactory
|
||||
* Method: nativeGetProxyInfoForURL
|
||||
* Signature: (Ljava/lang/String;)Ljava/lang/String;
|
||||
*/
|
||||
JNIEXPORT jstring JNICALL Java_sun_jvmp_mozilla_MozillaPeerFactory_nativeGetProxyInfoForURL
|
||||
(JNIEnv *, jobject, jstring);
|
||||
|
||||
/*
|
||||
* Class: sun_jvmp_mozilla_MozillaPeerFactory
|
||||
* Method: nativeHandleCall
|
||||
* Signature: (IJ)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_sun_jvmp_mozilla_MozillaPeerFactory_nativeHandleCall
|
||||
(JNIEnv *, jobject, jint, jlong);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
|
@ -1,42 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is The Waterfall Java Plugin Module
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* $Id: plugin.policy,v 1.1 2001/05/09 17:29:53 edburns%acm.org Exp $
|
||||
*
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
*/
|
||||
|
||||
grant codeBase "file:${jvmp.home}/classes/" {
|
||||
permission java.security.AllPermission;
|
||||
};
|
||||
grant codeBase "file:${jvmp.home}/wf.jar" {
|
||||
permission java.security.AllPermission;
|
||||
};
|
||||
|
||||
grant {
|
||||
permission java.lang.RuntimePermission "accessClassInPackage.sun.jvmp";
|
||||
permission java.lang.RuntimePermission "accessClassInPackage.sun.jvmp.applet";
|
||||
permission java.lang.RuntimePermission "accessClassInPackage.sun.security.action";
|
||||
permission java.lang.RuntimePermission "accessClassInPackage.sun.awt.image";
|
||||
permission java.lang.RuntimePermission "accessClassInPackage.sun.audio";
|
||||
permission java.lang.RuntimePermission "accessClassInPackage.sun.applet";
|
||||
permission java.lang.RuntimePermission "modifyThread";
|
||||
};
|
|
@ -1,41 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is The Waterfall Java Plugin Module
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* $Id: BrowserSupport.java,v 1.1 2001/05/09 17:29:54 edburns%acm.org Exp $
|
||||
*
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
*/
|
||||
|
||||
package sun.jvmp;
|
||||
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import sun.jvmp.applet.ProxyInfo;
|
||||
|
||||
/**
|
||||
* Generic interface of browser support
|
||||
*/
|
||||
public interface BrowserSupport
|
||||
{
|
||||
|
||||
public ProxyInfo getProxyInfoForURL(URL url);
|
||||
public URLConnection getConnectionForURL(URL url);
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is The Waterfall Java Plugin Module
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* $Id: ComponentException.java,v 1.1 2001/05/09 17:29:54 edburns%acm.org Exp $
|
||||
*
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
*/
|
||||
|
||||
package sun.jvmp;
|
||||
|
||||
public class ComponentException extends Exception
|
||||
{
|
||||
String message="Component exception";
|
||||
public ComponentException(String message)
|
||||
{
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public ComponentException()
|
||||
{}
|
||||
};
|
|
@ -1,121 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is The Waterfall Java Plugin Module
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* $Id: ComponentLoader.java,v 1.1 2001/05/09 17:29:54 edburns%acm.org Exp $
|
||||
*
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
*/
|
||||
|
||||
package sun.jvmp;
|
||||
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.beans.*;
|
||||
import java.io.*;
|
||||
import java.util.jar.*;
|
||||
import java.lang.reflect.*;
|
||||
import java.security.CodeSource;
|
||||
|
||||
class ComponentLoader
|
||||
{
|
||||
protected PluggableJVM jvm;
|
||||
|
||||
ComponentLoader(PluggableJVM jvm)
|
||||
{
|
||||
this.jvm = jvm;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load component from the given URL.
|
||||
* It should be a JAR with attribute "Factory-Class" set to the name of
|
||||
* factory class of this component.
|
||||
**/
|
||||
public ObjectFactory getComponent(URL url)
|
||||
{
|
||||
try {
|
||||
//jvm.trace("url="+url, jvm.LOG_DEBUG);
|
||||
JarInputStream jis = new JarInputStream(url.openStream());
|
||||
URL wfcp = jvm.getCodeSource().getLocation();
|
||||
// yes - own classloader for every component - must be safer
|
||||
URLClassLoader comploader = new URLClassLoader(new URL [] {url, wfcp},
|
||||
this.getClass().getClassLoader());
|
||||
Class factory = null;
|
||||
Manifest mf = jis.getManifest();
|
||||
Attributes a = mf.getMainAttributes();
|
||||
// this is magic to allow component to provide
|
||||
// custom protocol handlers
|
||||
String pkgs =
|
||||
a.getValue(new Attributes.Name("Protocol-Handlers"));
|
||||
if (pkgs != null) jvm.registerProtocolHandlers(comploader, pkgs);
|
||||
String classname =
|
||||
a.getValue(new Attributes.Name("Factory-Class"));
|
||||
if (classname == null) return null;
|
||||
|
||||
factory = Class.forName(classname, true, comploader);
|
||||
Method m = factory.getDeclaredMethod("getFactory",
|
||||
new Class[]{PluggableJVM.class,
|
||||
CodeSource.class});
|
||||
CodeSource cs = new CodeSource(url, null);
|
||||
Object o = m.invoke(null, new Object[]{jvm, cs});
|
||||
return (ObjectFactory)o;
|
||||
} catch (Exception e) {
|
||||
// as I'm such a lazy butt to perform all checks here
|
||||
jvm.trace("getComponent failed: "+e, PluggableJVM.LOG_WARNING);
|
||||
jvm.trace(e, PluggableJVM.LOG_WARNING);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void register(URL url)
|
||||
{
|
||||
ObjectFactory of = getComponent(url);
|
||||
if (of == null) return;
|
||||
jvm.registerService(of);
|
||||
}
|
||||
|
||||
/**
|
||||
* Autoregister components from those locations
|
||||
**/
|
||||
public void register(URL[] urls)
|
||||
{
|
||||
if (urls == null) return;
|
||||
for (int i=0; i<urls.length; i++)
|
||||
register(urls[i]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Autoregister all components from some directory
|
||||
**/
|
||||
public void registerAllInDir(File dir)
|
||||
{
|
||||
if (dir == null || !dir.isDirectory()) return;
|
||||
File[] comps = dir.listFiles();
|
||||
if (comps == null) return;
|
||||
try {
|
||||
for (int i=0; i<comps.length; i++)
|
||||
if (comps[i].isFile()) register(comps[i].toURL());
|
||||
} catch(Exception e) {
|
||||
jvm.trace("registerAllInDir failed: "+e, PluggableJVM.LOG_WARNING);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -1,104 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is The Waterfall Java Plugin Module
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* $Id: HostObjectPeer.java,v 1.1 2001/05/09 17:29:54 edburns%acm.org Exp $
|
||||
*
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
*/
|
||||
|
||||
package sun.jvmp;
|
||||
|
||||
import sun.jvmp.security.*;
|
||||
// peer event types, synchronize with nsIJavaHTMLObject.idl
|
||||
public interface HostObjectPeer extends IDObject
|
||||
{
|
||||
/**
|
||||
* Some peer types. Just for reference.
|
||||
**/
|
||||
public static final int PT_UNKNOWN = 0;
|
||||
public static final int PT_EMBED = 1;
|
||||
public static final int PT_OBJECT = 2;
|
||||
public static final int PT_APPLET = 3;
|
||||
public static final int PT_PLUGLET = 4;
|
||||
|
||||
/**
|
||||
* Some peer events. Just for reference.
|
||||
**/
|
||||
public static final int PE_NOPE = 0;
|
||||
public static final int PE_CREATE = 1;
|
||||
public static final int PE_SETWINDOW = 2;
|
||||
public static final int PE_DESTROY = 3;
|
||||
public static final int PE_START = 4;
|
||||
public static final int PE_STOP = 5;
|
||||
public static final int PE_NEWPARAMS = 6;
|
||||
public static final int PE_SETTYPE = 7;
|
||||
public static final int PE_PEEREVENT = 8;
|
||||
public static final int PE_GETPEER = 9;
|
||||
|
||||
/**
|
||||
* Java object events - usage is voluntary.
|
||||
**/
|
||||
public static final int JE_NOPE = 0;
|
||||
public static final int JE_SHOWSTATUS = 1;
|
||||
public static final int JE_SHOWDOCUMENT = 2;
|
||||
// generic event sent by applet
|
||||
public static final int JE_APPLETEVENT = 3;
|
||||
// error requiring browser's attention happened in applet
|
||||
public static final int JE_APPLETERROR = 4;
|
||||
// error requiring browser's attention happened in JVM
|
||||
public static final int JE_JVMERROR = 5;
|
||||
|
||||
/**
|
||||
* returns pointer to peer factory used to create this peer
|
||||
**/
|
||||
public HostObjectPeerFactory getFactory();
|
||||
/**
|
||||
* Event handler - called when SendEvent/PostEvent methods called.
|
||||
* Calls comes directly from PluggableJVM main event loop -
|
||||
* maybe it's better for each peer to have own message queue,
|
||||
* but it will make performance overhead.
|
||||
**/
|
||||
public int handleEvent(SecurityCaps caps, int eventID, long eventData);
|
||||
|
||||
/**
|
||||
* This method is called directly from native thread -
|
||||
* do anything you want.
|
||||
**/
|
||||
public int handleCall(SecurityCaps caps, int arg1, long arg2);
|
||||
|
||||
/**
|
||||
* Method called when host calls JVMP_DestroyPeer.
|
||||
* Final clean up here. Return 0 if don't want to die, or caps
|
||||
* isn't good enough.
|
||||
*/
|
||||
public int destroy(SecurityCaps caps);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,68 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is The Waterfall Java Plugin Module
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* $Id: HostObjectPeerFactory.java,v 1.1 2001/05/09 17:29:54 edburns%acm.org Exp $
|
||||
*
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
*/
|
||||
|
||||
package sun.jvmp;
|
||||
|
||||
import sun.jvmp.security.*;
|
||||
import java.security.*;
|
||||
|
||||
// interface that should be implemented by all Waterfall extensions
|
||||
// Java classes.
|
||||
// creates Java peer of given version.
|
||||
// vendor ID is already fixed, and should be known by this factory
|
||||
public interface HostObjectPeerFactory extends IDObject
|
||||
{
|
||||
public String getCID();
|
||||
public HostObjectPeer create(int version);
|
||||
/**
|
||||
* Event handler - called when SendExtEvent/PostExtEvent methods called.
|
||||
* Calls comes directly from PluggableJVM main event loop -
|
||||
* maybe it's better for each extension to have own message queue,
|
||||
* but it will make performance overhead.
|
||||
**/
|
||||
public int handleEvent(SecurityCaps caps,
|
||||
int eventID,
|
||||
long eventData);
|
||||
/**
|
||||
* This method is called directly from native thread -
|
||||
* do anything you want.
|
||||
**/
|
||||
public int handleCall(SecurityCaps caps, int arg1, long arg2);
|
||||
|
||||
/**
|
||||
* Method called when host calls JVMP_UnregisterExtension.
|
||||
* Final clean up here. Return 0 if don't want to die, or caps
|
||||
* isn't good enough.
|
||||
*/
|
||||
public int destroy(SecurityCaps caps);
|
||||
/**
|
||||
* Returns permission collection required for this extension to work
|
||||
* properly, null if nothing
|
||||
*/
|
||||
public PermissionCollection getPermissions(CodeSource codesource);
|
||||
}
|
||||
|
||||
|
|
@ -1,147 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is The Waterfall Java Plugin Module
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* $Id: IDList.java,v 1.1 2001/05/09 17:29:54 edburns%acm.org Exp $
|
||||
*
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
*/
|
||||
|
||||
package sun.jvmp;
|
||||
|
||||
import java.util.Vector;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Hashtable;
|
||||
|
||||
public class IDList {
|
||||
protected Vector m_items;
|
||||
protected Hashtable m_ids;
|
||||
// this is common for
|
||||
static int m_nextID = 1;
|
||||
public IDList()
|
||||
{
|
||||
m_items = new Vector(0, 5);
|
||||
m_ids = new Hashtable();
|
||||
}
|
||||
|
||||
// this is way to make all IDList's error-prone, as
|
||||
// ID will be truly unique for all instances
|
||||
static synchronized int getNextID()
|
||||
{
|
||||
if (m_nextID == Integer.MAX_VALUE) m_nextID = 1;
|
||||
return m_nextID++;
|
||||
}
|
||||
|
||||
// XXX: reimplement it with smth more efficient
|
||||
int getStorage(int id)
|
||||
{
|
||||
Integer storage = (Integer)m_ids.get(new Integer(id));
|
||||
if (storage == null) return -1;
|
||||
return storage.intValue();
|
||||
}
|
||||
|
||||
int getId(int storage)
|
||||
{
|
||||
int id = getNextID();
|
||||
m_ids.put(new Integer(id), new Integer(storage));
|
||||
return id;
|
||||
}
|
||||
|
||||
public synchronized int add(IDObject o)
|
||||
{
|
||||
int id = 0, free_slot = -1;
|
||||
if (o == null) return 0; // null objects cannot be saved
|
||||
// first - find out if this object already added
|
||||
// reverse order - to give smallest IDs first.
|
||||
for (int i = m_items.size()-1; i >= 0; i--)
|
||||
{
|
||||
IDObject o1 = (IDObject)m_items.elementAt(i);
|
||||
if (o1 == null)
|
||||
{
|
||||
free_slot = i;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (o1.equals(o))
|
||||
{
|
||||
id = o1.getID();
|
||||
o.setID(id);
|
||||
return id;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (free_slot != -1)
|
||||
{
|
||||
id = getId(free_slot);
|
||||
m_items.setElementAt(o, free_slot);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_items.add(o);
|
||||
id = getId(m_items.indexOf(o));
|
||||
}
|
||||
o.setID(id);
|
||||
return id;
|
||||
}
|
||||
// XXX: should I shrink underlying Vector?
|
||||
public synchronized IDObject remove(int id)
|
||||
{
|
||||
IDObject o = get(id);
|
||||
m_items.setElementAt(null, getStorage(id));
|
||||
return o;
|
||||
}
|
||||
|
||||
public synchronized IDObject remove(IDObject o)
|
||||
{
|
||||
if (o == null) return null;
|
||||
for (int i = 0; i < m_items.size(); i++)
|
||||
{
|
||||
IDObject o1 = (IDObject)m_items.elementAt(i);
|
||||
if (o.equals(o1))
|
||||
{
|
||||
m_items.setElementAt(null, i);
|
||||
return o1;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public synchronized IDObject get(int id)
|
||||
{
|
||||
int storage = getStorage(id);
|
||||
if (storage == -1) return null;
|
||||
return (IDObject)m_items.elementAt(storage);
|
||||
}
|
||||
|
||||
public synchronized int length()
|
||||
{
|
||||
int count = 0;
|
||||
for (int i = 0; i < m_items.size(); i++)
|
||||
if (m_items.elementAt(i) != null) count++;
|
||||
return count;
|
||||
}
|
||||
|
||||
public Enumeration elements()
|
||||
{
|
||||
return m_items.elements();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is The Waterfall Java Plugin Module
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* $Id: IDObject.java,v 1.1 2001/05/09 17:29:54 edburns%acm.org Exp $
|
||||
*
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
*/
|
||||
|
||||
package sun.jvmp;
|
||||
|
||||
public interface IDObject {
|
||||
public void setID(int id);
|
||||
public int getID();
|
||||
}
|
|
@ -1,58 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is The Waterfall Java Plugin Module
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* $Id: MultipleHashtable.java,v 1.1 2001/05/09 17:29:54 edburns%acm.org Exp $
|
||||
*
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
*/
|
||||
|
||||
package sun.jvmp;
|
||||
|
||||
import java.util.*;
|
||||
/**
|
||||
* utility class - hashtable with multiple values per key
|
||||
*/
|
||||
|
||||
public class MultipleHashtable extends Hashtable
|
||||
{
|
||||
public MultipleHashtable()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public Object put(Object key, Object value)
|
||||
{
|
||||
Vector v = getVector(key);
|
||||
if (v == null) v = new Vector();
|
||||
v.add(value);
|
||||
return super.put(key, v);
|
||||
}
|
||||
|
||||
public Vector getVector(Object key)
|
||||
{
|
||||
return (Vector)super.get(key);
|
||||
}
|
||||
// public Object get(Object key)
|
||||
// {
|
||||
// // I know, I'm bad :)
|
||||
// return null;
|
||||
// }
|
||||
}
|
|
@ -1,73 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is The Waterfall Java Plugin Module
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* $Id: NativeFrame.java,v 1.1 2001/05/09 17:29:54 edburns%acm.org Exp $
|
||||
*
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
*/
|
||||
|
||||
package sun.jvmp;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
public class NativeFrame implements IDObject
|
||||
{
|
||||
protected Frame m_f;
|
||||
protected int m_id = 0;
|
||||
|
||||
public NativeFrame(Frame f)
|
||||
{
|
||||
m_f = f;
|
||||
}
|
||||
|
||||
public void setID(int id)
|
||||
{
|
||||
if (m_id !=0) return;
|
||||
m_id = id;
|
||||
}
|
||||
|
||||
public int getID()
|
||||
{
|
||||
return m_id;
|
||||
}
|
||||
|
||||
public Frame getFrame()
|
||||
{
|
||||
return m_f;
|
||||
}
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
NativeFrame f;
|
||||
if (obj == null) return false;
|
||||
try {
|
||||
f = (NativeFrame)obj;
|
||||
} catch (ClassCastException e) {
|
||||
return false;
|
||||
}
|
||||
return (m_f == f.getFrame());
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
if (m_f != null) return m_f.toString();
|
||||
return "null NativeFrame object";
|
||||
}
|
||||
}
|
|
@ -1,71 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is The Waterfall Java Plugin Module
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* $Id: NativeThread.java,v 1.1 2001/05/09 17:29:54 edburns%acm.org Exp $
|
||||
*
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
*/
|
||||
|
||||
package sun.jvmp;
|
||||
|
||||
public class NativeThread implements IDObject
|
||||
{
|
||||
protected Thread m_t;
|
||||
protected int m_id = 0;
|
||||
|
||||
public NativeThread(Thread t)
|
||||
{
|
||||
m_t = t;
|
||||
}
|
||||
|
||||
public void setID(int id)
|
||||
{
|
||||
if (m_id !=0) return;
|
||||
m_id = id;
|
||||
}
|
||||
|
||||
public int getID()
|
||||
{
|
||||
return m_id;
|
||||
}
|
||||
|
||||
public Thread getThread()
|
||||
{
|
||||
return m_t;
|
||||
}
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
NativeThread t;
|
||||
if (obj == null) return false;
|
||||
try {
|
||||
t = (NativeThread)obj;
|
||||
} catch (ClassCastException e) {
|
||||
return false;
|
||||
}
|
||||
return (m_t == t.getThread());
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
if (m_t != null) return m_t.toString();
|
||||
return "null NativeThread object";
|
||||
}
|
||||
}
|
|
@ -1,83 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is The Waterfall Java Plugin Module
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* $Id: ObjectFactory.java,v 1.1 2001/05/09 17:29:54 edburns%acm.org Exp $
|
||||
*
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
*/
|
||||
|
||||
package sun.jvmp;
|
||||
|
||||
import java.util.Enumeration;
|
||||
import java.security.*;
|
||||
/**
|
||||
* This interface describes interface to be implemented by object factory
|
||||
* if it likes to be used by Waterfall actors.
|
||||
* Protocol:
|
||||
* 1. getCIDs(), if returned null - done
|
||||
* 2. call handleConflict() on every conflicting CID (see handleConflict())
|
||||
* XXX: shouldn't interface be locked on conflict resolution time?
|
||||
* 3. now object factory is ready to produce object instances using
|
||||
* instantiate()
|
||||
* 4. also permissions provided by this ObjectFactory used by system policy
|
||||
**/
|
||||
public interface ObjectFactory {
|
||||
/**
|
||||
* Returns name of this object factory. Also can be used for
|
||||
* versioning, i.e. name can be
|
||||
* WF-AppletViewer:00001
|
||||
* and so useful in conflict resolution
|
||||
**/
|
||||
public String getName();
|
||||
|
||||
/**
|
||||
* Returns list of CIDs this object factory provides
|
||||
**/
|
||||
public Enumeration getCIDs();
|
||||
|
||||
/**
|
||||
* This method called with a rejected CID and conficting object factory.
|
||||
* Returned value true if ObjectFactory insist to be the owner of this CID,
|
||||
* false otherwise.
|
||||
* If both returned true, or both returned false - status quo is saved.
|
||||
* Otherwise factory returned true becomes owner of CID.
|
||||
* Using this protocol, versioning issues can be solved easily.
|
||||
**/
|
||||
public boolean handleConflict(String cid,
|
||||
ObjectFactory f);
|
||||
|
||||
/**
|
||||
* When Waterfall asked to create instance of object with given CID
|
||||
* - this method got called.
|
||||
**/
|
||||
public Object instantiate(String cid, Object arg);
|
||||
|
||||
/**
|
||||
* Object factory allowed to extend Waterfall security policy
|
||||
* using this method. Usually this method used to grant certain
|
||||
* permissions to itself, but also can be used to define system-wide policy.
|
||||
* This isn't recommended in generic case, but some kind of extensions,
|
||||
* for example applet viewers, cannot avoid it.
|
||||
**/
|
||||
public PermissionCollection getPermissions(CodeSource codesource);
|
||||
}
|
||||
|
||||
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,51 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is The Waterfall Java Plugin Module
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* $Id: SynchroObject.java,v 1.1 2001/05/09 17:29:56 edburns%acm.org Exp $
|
||||
*
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
*/
|
||||
|
||||
package sun.jvmp;
|
||||
|
||||
public abstract class SynchroObject implements IDObject
|
||||
{
|
||||
protected int m_id = 0;
|
||||
|
||||
/* much like standard Java synchro API */
|
||||
public abstract void _lock();
|
||||
public abstract void _unlock();
|
||||
public abstract void _wait(int milli) throws InterruptedException;
|
||||
public abstract void _notify();
|
||||
public abstract void _notifyAll();
|
||||
public abstract void _destroy();
|
||||
|
||||
public void setID(int id)
|
||||
{
|
||||
if (m_id != 0) return;
|
||||
m_id = id;
|
||||
}
|
||||
|
||||
public int getID()
|
||||
{
|
||||
return m_id;
|
||||
}
|
||||
}
|
|
@ -1,229 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is The Waterfall Java Plugin Module
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* $Id: WaterfallExtension.java,v 1.1 2001/05/09 17:29:56 edburns%acm.org Exp $
|
||||
*
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
*/
|
||||
|
||||
package sun.jvmp;
|
||||
|
||||
import sun.jvmp.security.*;
|
||||
import java.lang.reflect.*;
|
||||
import java.net.*;
|
||||
import java.util.*;
|
||||
import sun.jvmp.security.*;
|
||||
import java.security.*;
|
||||
import java.io.*;
|
||||
|
||||
class WaterfallExtension implements AccessControlDecider, IDObject
|
||||
{
|
||||
protected int m_version;
|
||||
protected String m_cid;
|
||||
protected int m_id;
|
||||
Class bootstrapClass = null;
|
||||
ClassLoader extClassLoader;
|
||||
boolean inited;
|
||||
HostObjectPeerFactory factory;
|
||||
AccessControlDecider decider;
|
||||
PluggableJVM m_jvm;
|
||||
String m_classpath, m_classname;
|
||||
|
||||
public WaterfallExtension(PluggableJVM jvm, String cid, int version,
|
||||
String classpath, String classname,
|
||||
long data)
|
||||
throws ClassNotFoundException,
|
||||
MalformedURLException,
|
||||
NoSuchMethodException,
|
||||
SecurityException,
|
||||
IllegalAccessException,
|
||||
IllegalArgumentException,
|
||||
InvocationTargetException
|
||||
{
|
||||
inited = false;
|
||||
m_cid = cid;
|
||||
m_version = version;
|
||||
m_jvm = jvm;
|
||||
m_classpath = classpath;
|
||||
m_classname = classname;
|
||||
try
|
||||
{
|
||||
classpath = getDefaultClassPath() + classpath;
|
||||
URL[] urls = getURLs(classpath);
|
||||
ClassLoader loader = this.getClass().getClassLoader();
|
||||
|
||||
extClassLoader = new URLClassLoader(urls, loader);
|
||||
bootstrapClass =
|
||||
Class.forName(classname, true, extClassLoader);
|
||||
|
||||
Method start =
|
||||
bootstrapClass.getDeclaredMethod("start",
|
||||
new Class[]{PluggableJVM.class, Long.class});
|
||||
// start() is a static method - returns factory
|
||||
// to produce instances of desired type
|
||||
factory = (HostObjectPeerFactory)
|
||||
start.invoke(null, new Object[]{m_jvm, new Long(data)});
|
||||
decider = (AccessControlDecider)factory;
|
||||
|
||||
if (!m_cid.equals(factory.getCID()))
|
||||
{
|
||||
// smth is wrong, created object
|
||||
// is of incorrect type
|
||||
m_jvm.trace("RETURNED CONTRACT ID ISN'T CORRECT",
|
||||
PluggableJVM.LOG_ERROR);
|
||||
// XXX: correct exception?
|
||||
throw new
|
||||
IllegalArgumentException("Mismatch contract ID: "+
|
||||
factory.getCID() +
|
||||
" instead of "+ m_cid);
|
||||
}
|
||||
}
|
||||
catch (ClassCastException e)
|
||||
{
|
||||
m_jvm.trace("Extension class not implements required interfaces",
|
||||
PluggableJVM.LOG_ERROR);
|
||||
m_jvm.trace(e, PluggableJVM.LOG_ERROR);
|
||||
throw e;
|
||||
}
|
||||
catch (MalformedURLException e)
|
||||
{
|
||||
m_jvm.trace("Oops, can't create URLs from\""
|
||||
+classpath+"\"", PluggableJVM.LOG_ERROR);
|
||||
throw e;
|
||||
}
|
||||
catch (ClassNotFoundException e)
|
||||
{
|
||||
m_jvm.trace("Oops, can't find class \""
|
||||
+classname+"\"", PluggableJVM.LOG_ERROR);
|
||||
throw e;
|
||||
}
|
||||
catch (NoSuchMethodException e)
|
||||
{
|
||||
m_jvm.trace("No start method in class "+classname,
|
||||
PluggableJVM.LOG_ERROR);
|
||||
throw e;
|
||||
}
|
||||
//PluggableJVM.trace("+++++++ Extension inited");
|
||||
inited = true;
|
||||
}
|
||||
|
||||
public void setID(int id)
|
||||
{
|
||||
if (m_id != 0) return;
|
||||
if (factory != null) factory.setID(id);
|
||||
m_id = id;
|
||||
}
|
||||
public int getID()
|
||||
{
|
||||
return m_id;
|
||||
}
|
||||
|
||||
public String getCID()
|
||||
{
|
||||
return m_cid;
|
||||
}
|
||||
|
||||
public int getVersion()
|
||||
{
|
||||
return m_version;
|
||||
}
|
||||
|
||||
public HostObjectPeer instantiate(SecurityCaps caps, int version)
|
||||
{
|
||||
if (!inited)
|
||||
return null;
|
||||
return factory.create(version);
|
||||
}
|
||||
|
||||
public int decide(CallingContext ctx, String principal, int cap_no)
|
||||
{
|
||||
if (decider == null) return NA;
|
||||
return decider.decide(ctx, principal, cap_no);
|
||||
}
|
||||
|
||||
public boolean belongs(int cap_no)
|
||||
{
|
||||
if (decider == null) return false;
|
||||
return decider.belongs(cap_no);
|
||||
}
|
||||
|
||||
|
||||
protected URL[] getURLs(String classpath)
|
||||
throws MalformedURLException
|
||||
{
|
||||
int i, pos, count;
|
||||
URL url;
|
||||
if (classpath == null || "".equals(classpath)) return new URL[]{};
|
||||
Vector v = new Vector();
|
||||
pos = count = 0;
|
||||
do
|
||||
{
|
||||
count++;
|
||||
i = classpath.indexOf("|", pos);
|
||||
if (i == -1)
|
||||
url = new URL(classpath.substring(pos));
|
||||
else
|
||||
url = new URL(classpath.substring(pos, i));
|
||||
//m_jvm.trace("adding URL: "+ url, PluggableJVM.LOG_DEBUG);
|
||||
v.add(url);
|
||||
pos = i+1;
|
||||
}
|
||||
while (i > -1);
|
||||
|
||||
URL[] urls = (URL[])(v.toArray(new URL[v.size()]));
|
||||
return urls;
|
||||
}
|
||||
|
||||
public HostObjectPeerFactory getFactory()
|
||||
{
|
||||
return factory;
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
StringBuffer buf = new StringBuffer();
|
||||
buf.append("Waterfall extension: ");
|
||||
buf.append("classpath=\""+m_classpath+"\" classname="+m_classname+"\n");
|
||||
buf.append("cid="+m_cid+" version="+m_version);
|
||||
if (factory != null) buf.append(" factory=" + factory.toString());
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
protected String getDefaultClassPath()
|
||||
{
|
||||
StringBuffer sb = new StringBuffer();
|
||||
String wfHome = System.getProperty("jvmp.home");
|
||||
File dir = new File(wfHome, "ext");
|
||||
if (dir == null || !dir.isDirectory()) return "";
|
||||
File[] comps = dir.listFiles();
|
||||
if (comps == null) return "";
|
||||
try {
|
||||
for (int i=0; i<comps.length; i++)
|
||||
if (comps[i].isFile())
|
||||
sb.append(comps[i].toURL().toString()+"|");
|
||||
} catch(Exception e) {
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1,104 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is The Waterfall Java Plugin Module
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* $Id: GenericSynchroObject.java,v 1.1 2001/05/09 17:29:57 edburns%acm.org Exp $
|
||||
*
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
*/
|
||||
|
||||
package sun.jvmp.generic;
|
||||
|
||||
import sun.jvmp.*;
|
||||
|
||||
public abstract class GenericSynchroObject extends SynchroObject
|
||||
{
|
||||
protected long m_handle = 0;
|
||||
protected boolean m_state = false;
|
||||
|
||||
public void _lock()
|
||||
{
|
||||
int res;
|
||||
if (!m_state)
|
||||
throw new IllegalMonitorStateException("Invalid object state");
|
||||
if ((res = doLock(m_handle)) != 0)
|
||||
throw new IllegalMonitorStateException("Invalid native state: err="
|
||||
+res);
|
||||
}
|
||||
|
||||
public void _unlock()
|
||||
{
|
||||
int res;
|
||||
if (!m_state)
|
||||
throw new IllegalMonitorStateException("Invalid object state");
|
||||
if ((res=doUnlock(m_handle)) != 0)
|
||||
throw new IllegalMonitorStateException("Invalid native state: err="
|
||||
+res);
|
||||
}
|
||||
|
||||
public void _wait(int milli) throws InterruptedException
|
||||
{
|
||||
int res;
|
||||
if (!m_state)
|
||||
throw new IllegalMonitorStateException("Invalid object state");
|
||||
if ((res = doWait(m_handle, milli)) < -1)
|
||||
throw new IllegalMonitorStateException("Invalid native state: err="
|
||||
+res);
|
||||
if (res == -1) throw new InterruptedException("Native wait() interrupted");
|
||||
}
|
||||
|
||||
public void _notify()
|
||||
{
|
||||
int res;
|
||||
if (!m_state)
|
||||
throw new IllegalMonitorStateException("Invalid object state");
|
||||
if ((res=doNotify(m_handle)) != 0)
|
||||
throw new IllegalMonitorStateException("Invalid native state: err="
|
||||
+res);
|
||||
}
|
||||
|
||||
public void _notifyAll()
|
||||
{
|
||||
int res;
|
||||
if (!m_state)
|
||||
throw new IllegalMonitorStateException("Invalid object state");
|
||||
if ((res=doNotifyAll(m_handle)) != 0)
|
||||
throw new IllegalMonitorStateException("Invalid native state: err="
|
||||
+res);
|
||||
}
|
||||
|
||||
public void _destroy()
|
||||
{
|
||||
int res;
|
||||
if (!m_state)
|
||||
throw new IllegalMonitorStateException("Invalid object state");
|
||||
if ((res=doDestroy(m_handle)) != 0)
|
||||
throw new IllegalMonitorStateException("Invalid native state: err="
|
||||
+res);
|
||||
}
|
||||
|
||||
protected abstract int checkHandle(long handle);
|
||||
protected abstract int doLock(long handle);
|
||||
protected abstract int doUnlock(long handle);
|
||||
protected abstract int doWait(long handle, int milli);
|
||||
protected abstract int doNotify(long handle);
|
||||
protected abstract int doNotifyAll(long handle);
|
||||
protected abstract int doDestroy(long handle);
|
||||
};
|
|
@ -1,124 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is The Waterfall Java Plugin Module
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* $Id: Plugin.java,v 1.1 2001/05/09 17:29:58 edburns%acm.org Exp $
|
||||
*
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
*/
|
||||
|
||||
// XXX: this class depends on sun.awt.*
|
||||
package sun.jvmp.generic.motif;
|
||||
|
||||
import sun.jvmp.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class Plugin extends PluggableJVM
|
||||
{
|
||||
static Plugin real_instance = null;
|
||||
|
||||
protected Plugin()
|
||||
{
|
||||
super();
|
||||
instance = this;
|
||||
};
|
||||
|
||||
|
||||
protected static PluggableJVM startJVM(String codebase, int debug)
|
||||
{
|
||||
debugLevel = debug;
|
||||
|
||||
// for now, only one instance of JVM is allowed - can be fixed easily
|
||||
if (real_instance == null)
|
||||
{
|
||||
|
||||
real_instance = new Plugin();
|
||||
// don't do nothing until init is complete
|
||||
real_instance.init(codebase, true);
|
||||
real_instance.start();
|
||||
};
|
||||
return real_instance;
|
||||
};
|
||||
|
||||
protected NativeFrame SysRegisterWindow(int handle,
|
||||
int width, int height)
|
||||
{
|
||||
NativeFrame nf;
|
||||
if (!initedNative)
|
||||
{
|
||||
loadLibrary();
|
||||
}
|
||||
long widget = getWidget(handle, width, height, 0, 0);
|
||||
Frame f = createEmbeddedFrame(widget);
|
||||
if (f == null)
|
||||
{
|
||||
trace("Creation of frame failed", LOG_ERROR);
|
||||
return null;
|
||||
}
|
||||
f.setBounds(0, 0, width, height);
|
||||
f.setResizable(false);
|
||||
nf = new NativeFrame(f);
|
||||
return nf;
|
||||
}
|
||||
|
||||
protected NativeFrame SysUnregisterWindow(int id)
|
||||
{
|
||||
NativeFrame nf = (NativeFrame)nativeFrames.get(id);
|
||||
if (nf == null) return null;
|
||||
Frame f = nf.getFrame();
|
||||
f.removeAll();
|
||||
f.removeNotify();
|
||||
return nf;
|
||||
};
|
||||
|
||||
protected SynchroObject SysRegisterMonitorObject(long handle)
|
||||
{
|
||||
SynchroObject so = null;
|
||||
try {
|
||||
so = new PthreadSynchroObject(handle);
|
||||
} catch (Exception e) {
|
||||
trace("SysRegisterMonitorObject failed: "+e, LOG_ERROR);
|
||||
return null;
|
||||
}
|
||||
return so;
|
||||
}
|
||||
|
||||
protected SynchroObject SysUnregisterMonitorObject(int id)
|
||||
{
|
||||
SynchroObject so = getSynchroObjectWithID(id);
|
||||
if (so == null) return null;
|
||||
so._destroy();
|
||||
return so;
|
||||
}
|
||||
|
||||
/*
|
||||
this is a separate method as MEmbeddedFrame constructor arguments
|
||||
differs in 1.1 and 1.2.
|
||||
and maybe we should use reflection (like original plugin)
|
||||
to call proper constructor
|
||||
*/
|
||||
private Frame createEmbeddedFrame(long widget)
|
||||
{
|
||||
return new sun.awt.motif.MEmbeddedFrame(widget);
|
||||
};
|
||||
|
||||
static private native long getWidget(int winid, int width,
|
||||
int height, int x, int y);
|
||||
};
|
|
@ -1,47 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is The Waterfall Java Plugin Module
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* $Id: PthreadSynchroObject.java,v 1.1 2001/05/09 17:29:58 edburns%acm.org Exp $
|
||||
*
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
*/
|
||||
|
||||
package sun.jvmp.generic.motif;
|
||||
|
||||
import sun.jvmp.generic.GenericSynchroObject;
|
||||
|
||||
public class PthreadSynchroObject extends GenericSynchroObject
|
||||
{
|
||||
public PthreadSynchroObject(long handle) throws IllegalArgumentException
|
||||
{
|
||||
m_handle = handle;
|
||||
if (checkHandle(handle) != 0)
|
||||
throw new IllegalArgumentException("Invalid handle passed to constructor");
|
||||
m_state = true;
|
||||
}
|
||||
protected native int checkHandle(long handle);
|
||||
protected native int doLock(long handle);
|
||||
protected native int doUnlock(long handle);
|
||||
protected native int doWait(long handle, int milli);
|
||||
protected native int doNotify(long handle);
|
||||
protected native int doNotifyAll(long handle);
|
||||
protected native int doDestroy(long handle);
|
||||
};
|
|
@ -1,114 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is The Waterfall Java Plugin Module
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* $Id: Plugin.java,v 1.1 2001/05/09 17:29:58 edburns%acm.org Exp $
|
||||
*
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
*/
|
||||
|
||||
package sun.jvmp.generic.win32;
|
||||
|
||||
import sun.jvmp.*;
|
||||
import java.awt.*;
|
||||
|
||||
|
||||
public class Plugin extends PluggableJVM
|
||||
{
|
||||
static Plugin real_instance = null;
|
||||
|
||||
protected Plugin()
|
||||
{
|
||||
super();
|
||||
instance = this;
|
||||
};
|
||||
|
||||
|
||||
protected static PluggableJVM startJVM(String codebase, int debug)
|
||||
{
|
||||
debugLevel = debug;
|
||||
// for now, only one instance of JVM is allowed - can be fixed easily
|
||||
if (real_instance == null)
|
||||
{
|
||||
|
||||
real_instance = new Plugin();
|
||||
// don't do nothing until init is complete
|
||||
real_instance.init(codebase, false);
|
||||
real_instance.start();
|
||||
};
|
||||
return real_instance;
|
||||
};
|
||||
|
||||
protected NativeFrame SysRegisterWindow(int handle,
|
||||
int width, int height)
|
||||
{
|
||||
NativeFrame nf;
|
||||
|
||||
Frame frame = createEmbeddedFrame(handle);
|
||||
if (frame == null)
|
||||
{
|
||||
trace("Creation of frame failed", LOG_ERROR);
|
||||
return null;
|
||||
};
|
||||
frame.setBounds(0, 0, width, height);
|
||||
frame.setResizable(false);
|
||||
nf = new NativeFrame(frame);
|
||||
return nf;
|
||||
}
|
||||
|
||||
protected NativeFrame SysUnregisterWindow(int id)
|
||||
{
|
||||
NativeFrame nf = (NativeFrame)nativeFrames.get(id);
|
||||
if (nf == null) return null;
|
||||
Frame f = nf.getFrame();
|
||||
// XXX: hacky, but Win32 impl really throws exception here
|
||||
try {
|
||||
f.removeAll();
|
||||
f.removeNotify();
|
||||
} catch (Exception e){
|
||||
trace(e, LOG_DEBUG);
|
||||
}
|
||||
return nf;
|
||||
};
|
||||
|
||||
protected SynchroObject SysRegisterMonitorObject(long handle)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
protected SynchroObject SysUnregisterMonitorObject(int id)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
this is a separate method as MEmbeddedFrame constructor arguments
|
||||
differs in 1.1 and 1.2.
|
||||
and maybe we should use reflection (like original plugin)
|
||||
to call proper constructor
|
||||
*/
|
||||
private Frame createEmbeddedFrame(int handle)
|
||||
{
|
||||
return new sun.awt.windows.WEmbeddedFrame(handle);
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
|
|
@ -1,223 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is The Waterfall Java Plugin Module
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* $Id: ActivatorAppletContext.java,v 1.1 2001/05/09 17:29:58 edburns%acm.org Exp $
|
||||
*
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
*/
|
||||
|
||||
package sun.jvmp.jpav;
|
||||
|
||||
import sun.jvmp.applet.*;
|
||||
import java.applet.*;
|
||||
import java.util.*;
|
||||
import sun.applet.*;
|
||||
import java.awt.*;
|
||||
import java.net.*;
|
||||
import java.io.*;
|
||||
import java.lang.reflect.*;
|
||||
import sun.misc.Ref;
|
||||
|
||||
public abstract class ActivatorAppletContext implements AppletContext
|
||||
{
|
||||
|
||||
/*
|
||||
* Get an audio clip.
|
||||
*
|
||||
* @param url url of the desired audio clip
|
||||
*/
|
||||
public AudioClip getAudioClip(URL url) {
|
||||
System.getSecurityManager().checkConnect(url.getHost(), url.getPort());
|
||||
synchronized (audioClips) {
|
||||
AudioClip clip = (AudioClip)audioClips.get(url);
|
||||
if (clip == null) {
|
||||
clip = new AppletAudioClip(url);
|
||||
audioClips.put(url, clip);
|
||||
}
|
||||
return clip;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Get an image.
|
||||
*
|
||||
* @param url of the desired image
|
||||
*/
|
||||
public Image getImage(URL url) {
|
||||
//sun.jvmp.PluggableJVM.trace("Ask for image: "+url);
|
||||
return getCachedImage(url);
|
||||
}
|
||||
|
||||
static Image getCachedImage(URL url) {
|
||||
System.getSecurityManager().checkConnect(url.getHost(), url.getPort());
|
||||
return (Image)getCachedImageRef(url).get();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an image ref.
|
||||
*/
|
||||
static Ref getCachedImageRef(URL url) {
|
||||
synchronized (imageRefs) {
|
||||
AppletImageRef ref = (AppletImageRef)imageRefs.get(url);
|
||||
if (ref == null) {
|
||||
ref = new AppletImageRef(url);
|
||||
imageRefs.put(url, ref);
|
||||
}
|
||||
return ref;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get an applet by name.
|
||||
*/
|
||||
public Applet getApplet(String name) {
|
||||
name = name.toLowerCase();
|
||||
for (Enumeration e = appletPanels.elements() ; e.hasMoreElements() ;) {
|
||||
AppletPanel p = (AppletPanel)e.nextElement();
|
||||
String param = p.getParameter("name");
|
||||
if (param != null) {
|
||||
param = param.toLowerCase();
|
||||
}
|
||||
if (name.equals(param) &&
|
||||
p.getDocumentBase().equals(appletPanel.getDocumentBase())) {
|
||||
try {
|
||||
if (checkConnect(appletPanel.getCodeBase().getHost(),
|
||||
p.getCodeBase().getHost())==false)
|
||||
return null;
|
||||
} catch (InvocationTargetException ee) {
|
||||
showStatus(ee.getTargetException().getMessage());
|
||||
return null;
|
||||
} catch (Exception ee) {
|
||||
showStatus(ee.getMessage());
|
||||
return null;
|
||||
}
|
||||
return p.getApplet();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an enumeration of all the accessible
|
||||
* applets on this page.
|
||||
*/
|
||||
public Enumeration getApplets() {
|
||||
Vector v = new Vector();
|
||||
for (Enumeration e = appletPanels.elements() ; e.hasMoreElements() ;) {
|
||||
AppletPanel p = (AppletPanel)e.nextElement();
|
||||
if (p.getDocumentBase().equals(appletPanel.getDocumentBase())) {
|
||||
try {
|
||||
checkConnect(appletPanel.getCodeBase().getHost(),
|
||||
p.getCodeBase().getHost());
|
||||
v.addElement(p.getApplet());
|
||||
} catch (InvocationTargetException ee) {
|
||||
showStatus(ee.getTargetException().getMessage());
|
||||
} catch (Exception ee) {
|
||||
showStatus(ee.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
return v.elements();
|
||||
}
|
||||
|
||||
/*
|
||||
* <p>
|
||||
* Check that a particular applet is authorized to connect to
|
||||
* the target applet.
|
||||
* This code is JDK 1.1 and 1.2 dependent
|
||||
* </p>
|
||||
*
|
||||
* @param source Source applet host name requesting the connect
|
||||
* @param target Target applet host name to connect to
|
||||
*
|
||||
* @return true if the connection is granted
|
||||
*/
|
||||
private boolean checkConnect(String sourceHostName, String targetHostName)
|
||||
throws SecurityException, InvocationTargetException, Exception
|
||||
{
|
||||
SocketPermission panelSp =
|
||||
new SocketPermission(sourceHostName,
|
||||
"connect");
|
||||
SocketPermission sp =
|
||||
new SocketPermission(targetHostName,
|
||||
"connect");
|
||||
if (panelSp.implies(sp)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* Replaces the Web page currently being viewed with the given URL
|
||||
*
|
||||
* @param url the address to transfer to
|
||||
*/
|
||||
abstract public void showDocument(URL url);
|
||||
|
||||
/*
|
||||
* Requests that the browser or applet viewer show the Web page
|
||||
* indicated by the url argument.
|
||||
*
|
||||
* @param url the address to transfer to
|
||||
* @param target One of the value
|
||||
* "_self" show in the current frame
|
||||
* "_parent"show in the parent frame
|
||||
* "_top" show in the topmost frame
|
||||
* "_blank" show in a new unnamed top-level windownameshow in a
|
||||
* new top-level window named name
|
||||
*/
|
||||
abstract public void showDocument(URL url, String target);
|
||||
|
||||
/*
|
||||
* Show status.
|
||||
*
|
||||
* @param status status message
|
||||
*/
|
||||
abstract public void showStatus(String status);
|
||||
|
||||
/*
|
||||
* Add a applet in this applet context
|
||||
*
|
||||
* @param applet the applet to add
|
||||
*/
|
||||
void addAppletInContext(AppletPanel appletPanel) {
|
||||
this.appletPanel = appletPanel;
|
||||
appletPanels.addElement(appletPanel);
|
||||
}
|
||||
|
||||
/*
|
||||
* Remove applet from this applet context
|
||||
*
|
||||
* @param applet applet to remove
|
||||
*/
|
||||
void removeAppletFromContext(AppletPanel applet) {
|
||||
appletPanels.removeElement(applet);
|
||||
}
|
||||
|
||||
private AppletPanel appletPanel;
|
||||
|
||||
private static Vector appletPanels = new Vector();
|
||||
|
||||
private static Hashtable audioClips = new Hashtable();
|
||||
private static Hashtable imageRefs = new Hashtable();
|
||||
}
|
||||
|
|
@ -1,737 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is The Waterfall Java Plugin Module
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* $Id: ActivatorAppletPanel.java,v 1.1 2001/05/09 17:29:59 edburns%acm.org Exp $
|
||||
*
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
*/
|
||||
|
||||
package sun.jvmp.jpav;
|
||||
import java.applet.*;
|
||||
import java.io.*;
|
||||
import sun.applet.*;
|
||||
import java.net.URL;
|
||||
import java.net.MalformedURLException;
|
||||
import java.util.*;
|
||||
import java.awt.*;
|
||||
import sun.jvmp.*;
|
||||
import sun.jvmp.applet.*;
|
||||
import java.lang.reflect.*;
|
||||
|
||||
public class ActivatorAppletPanel extends AppletPanel implements ProxyType
|
||||
{
|
||||
|
||||
// Network Access Level
|
||||
public static final int NETWORK_ACCESS_NONE = 0;
|
||||
public static final int NETWORK_ACCESS_HOST = 1;
|
||||
public static final int NETWORK_ACCESS_UNRESTRICTED = 2;
|
||||
|
||||
PluggableJVM m_jvm;
|
||||
|
||||
/*
|
||||
* are we initialized
|
||||
*/
|
||||
public static boolean javaEnabled = true;
|
||||
private boolean inited = false;
|
||||
|
||||
/**
|
||||
* Some constants...
|
||||
*/
|
||||
private static String propertiesFileName = "properties";
|
||||
|
||||
/**
|
||||
* Look here for the properties file
|
||||
*/
|
||||
public static File theUserPropertiesFile;
|
||||
public static File theAppletViewerPropsFile;
|
||||
|
||||
URL documentURL = null;
|
||||
URL baseURL = null;
|
||||
Frame m_f = null;
|
||||
private int width;
|
||||
private int height;
|
||||
|
||||
private static AppletMessageHandler amh =
|
||||
new AppletMessageHandler("appletpanel");
|
||||
|
||||
// Parameters handler
|
||||
protected java.util.Hashtable atts;
|
||||
|
||||
// Localization strings.
|
||||
private static ResourceBundle rb;
|
||||
|
||||
// JAR files that have not yet been loaded.
|
||||
private String cookedJars;
|
||||
|
||||
public static void loadPropertiesFiles() {
|
||||
|
||||
String sep = File.separator;
|
||||
theUserPropertiesFile = new File(System.getProperty("user.home") +
|
||||
sep + ".java" +
|
||||
sep + propertiesFileName);
|
||||
// ensure the props folder can be made
|
||||
new File(theUserPropertiesFile.getParent()).mkdirs();
|
||||
theAppletViewerPropsFile = new File(System.getProperty("java.home") +
|
||||
sep + "lib" +
|
||||
sep + "appletviewer.properties");
|
||||
}
|
||||
|
||||
|
||||
private class Initer extends Thread {
|
||||
ActivatorAppletPanel that;
|
||||
|
||||
Initer(ActivatorAppletPanel that) {
|
||||
super(Thread.currentThread().getThreadGroup(), "IniterThread");
|
||||
this.that = that;
|
||||
}
|
||||
|
||||
/**
|
||||
* Main body of thread. Call init on our AppletViewer.
|
||||
*/
|
||||
public void run() {
|
||||
init_run_wrapper(); // To identify this thread's stack
|
||||
}
|
||||
|
||||
private void init_run_wrapper()
|
||||
{
|
||||
m_jvm.trace("real Init()", PluggableJVM.LOG_DEBUG);
|
||||
that.init();
|
||||
that.sendEvent(sun.applet.AppletPanel.APPLET_INIT);
|
||||
that.sendEvent(sun.applet.AppletPanel.APPLET_START);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a new applet viewer.
|
||||
* Restricted to subclasses for security reasons,
|
||||
*
|
||||
* @param appletContext the AppletContext to use
|
||||
*/
|
||||
public ActivatorAppletPanel(PluggableJVM jvm,
|
||||
WFAppletContext appletContext,
|
||||
Hashtable atts) {
|
||||
if (appletContext == null)
|
||||
throw new IllegalArgumentException("AppletContext");
|
||||
this.appletContext = appletContext;
|
||||
appletContext.addAppletInContext(this);
|
||||
this.atts = atts;
|
||||
m_jvm = jvm;
|
||||
}
|
||||
|
||||
public void sendEvent(int id) {
|
||||
super.sendEvent(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Init the applet, called once to start the download of the applet
|
||||
*/
|
||||
public void init() {
|
||||
ClassLoaderInfo cli = ClassLoaderInfo.find(this);
|
||||
cli.addReference();
|
||||
synchronized(AppletViewer.class) {
|
||||
super.init();
|
||||
}
|
||||
sendEvent(sun.applet.AppletPanel.APPLET_LOAD);
|
||||
//sendEvent(sun.applet.AppletPanel.APPLET_INIT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Start the applet.
|
||||
*/
|
||||
public void appletStart() {
|
||||
if (inited)
|
||||
sendEvent(sun.applet.AppletPanel.APPLET_START);
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop the applet.
|
||||
*/
|
||||
public void appletStop() {
|
||||
sendEvent(sun.applet.AppletPanel.APPLET_STOP);
|
||||
}
|
||||
|
||||
public int getLoadingStatus()
|
||||
{
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Notification that the applet is being closed
|
||||
*
|
||||
* @param timeOut max time we are waiting for the applet to die
|
||||
* in milliseconds.
|
||||
*/
|
||||
public void onClose(final int timeOut) {
|
||||
|
||||
// Just make sure we are destroying the thread from a utility
|
||||
// thread to not block the main thread for that.
|
||||
|
||||
Runnable work = new Runnable() {
|
||||
public void run() {
|
||||
onPrivateClose(timeOut);
|
||||
}
|
||||
};
|
||||
Thread closingThread = new Thread(work);
|
||||
closingThread.start();
|
||||
}
|
||||
|
||||
/**
|
||||
* Notification that the applet is being closed
|
||||
*
|
||||
* @param timeOut max time we are waiting for the applet to die
|
||||
* in milliseconds.
|
||||
*/
|
||||
protected void onPrivateClose(int timeOut) {
|
||||
appletContext.removeAppletFromContext(this);
|
||||
if (status==APPLET_LOAD) {
|
||||
stopLoading();
|
||||
}
|
||||
sendEvent(APPLET_STOP);
|
||||
sendEvent(APPLET_DESTROY);
|
||||
sendEvent(APPLET_DISPOSE);
|
||||
sendEvent(APPLET_QUIT);
|
||||
ClassLoaderInfo cli = ClassLoaderInfo.find(this);
|
||||
cli.removeReference();
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialized the properties for this AppletViewer like the Applet
|
||||
* codebase and document base.
|
||||
*/
|
||||
protected void initProperties() {
|
||||
String att = getParameter("java_codebase");
|
||||
if (att == null)
|
||||
att = getParameter("codebase");
|
||||
if (att != null) {
|
||||
if (!att.endsWith("/")) {
|
||||
att += "/";
|
||||
}
|
||||
try {
|
||||
baseURL = new URL(documentURL, att);
|
||||
} catch (MalformedURLException e) {
|
||||
}
|
||||
}
|
||||
if (baseURL == null) {
|
||||
String file = documentURL.getFile();
|
||||
int i = file.lastIndexOf('/');
|
||||
if (i > 0 && i < file.length() - 1) {
|
||||
try {
|
||||
baseURL = new URL(documentURL, file.substring(0, i + 1));
|
||||
} catch (MalformedURLException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// when all is said & done, baseURL shouldn't be null
|
||||
if (baseURL == null)
|
||||
baseURL = documentURL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an applet parameter.
|
||||
*/
|
||||
public String getParameter(String name) {
|
||||
name = name.toLowerCase();
|
||||
if (atts.get(name) != null) {
|
||||
return (String) atts.get(name);
|
||||
} else {
|
||||
String value=null;
|
||||
try {
|
||||
value = getParameterFromHTML(name);
|
||||
} catch (Throwable e) {
|
||||
m_jvm.trace(e, PluggableJVM.LOG_WARNING);
|
||||
}
|
||||
if (value != null)
|
||||
atts.put(name.toLowerCase(), value);
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get applet's parameters.
|
||||
*/
|
||||
public Hashtable getParameters()
|
||||
{
|
||||
return (Hashtable) atts.clone();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Method to retrieve the parameter from the HTML tags
|
||||
*
|
||||
* @param name the parameter name
|
||||
*
|
||||
* @return the parameter value, null if undefined
|
||||
*/
|
||||
protected String getParameterFromHTML(String name)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set an applet parameter.
|
||||
*/
|
||||
public void setParameter(String name, Object value) {
|
||||
name = name.toLowerCase();
|
||||
atts.put(name, value.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the document url.
|
||||
*/
|
||||
public URL getDocumentBase() {
|
||||
return documentURL;
|
||||
|
||||
}
|
||||
|
||||
public void setWindow(Frame f)
|
||||
{
|
||||
if (f == null)
|
||||
{
|
||||
m_jvm.trace("Got zero Frame for SetWindow",
|
||||
PluggableJVM.LOG_ERROR);
|
||||
return;
|
||||
}
|
||||
f.setLayout(null);
|
||||
Applet a = getApplet();
|
||||
if (a == null) {
|
||||
try {
|
||||
int wd = Integer.parseInt(getParameter("width"));
|
||||
int ht = Integer.parseInt(getParameter("height"));
|
||||
this.width = wd;
|
||||
this.height = ht;
|
||||
} catch (NumberFormatException e) {
|
||||
// Try and maintain consistency between the parameters and
|
||||
// our width/height. If the parameters are not properly
|
||||
// set to be integers, then reset them to our w, h
|
||||
setParameter("width", new Integer(width));
|
||||
setParameter("height", new Integer(height));
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
}
|
||||
} else {
|
||||
// The applet exists, so resize it and its frame, and
|
||||
// have the width/height parameters reflect these values
|
||||
setParameter("width", new Integer(width));
|
||||
setParameter("height", new Integer(height));
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
|
||||
setSize(width, height);
|
||||
a.resize(width, height);
|
||||
a.setVisible(true);
|
||||
}
|
||||
setBounds(0, 0, width, height);
|
||||
if (m_f == f) return;
|
||||
m_f = f;
|
||||
f.add(this);
|
||||
f.show();
|
||||
f.setBounds(0, 0, width, height);
|
||||
maybeInit();
|
||||
}
|
||||
|
||||
private void maybeInit() {
|
||||
m_jvm.trace("maybeInit()", PluggableJVM.LOG_DEBUG);
|
||||
if (!inited && m_f != null && getDocumentBase() != null)
|
||||
{
|
||||
inited = true;
|
||||
Initer initer = new Initer(this);
|
||||
initer.start();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the document url.
|
||||
* This must be done early, before initProperties is called.
|
||||
*/
|
||||
public void setDocumentBase(URL url)
|
||||
{
|
||||
documentURL = url;
|
||||
initProperties();
|
||||
// If the window has already been set, we can init the applet.
|
||||
maybeInit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the base url.
|
||||
*/
|
||||
public URL getCodeBase() {
|
||||
return baseURL;
|
||||
}
|
||||
/**
|
||||
* Get the width.
|
||||
*/
|
||||
public int getWidth() {
|
||||
String w = getParameter("width");
|
||||
if (w != null) {
|
||||
return Integer.valueOf(w).intValue();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the height.
|
||||
*/
|
||||
public int getHeight() {
|
||||
String h = getParameter("height");
|
||||
if (h != null) {
|
||||
return Integer.valueOf(h).intValue();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the code parameter
|
||||
*/
|
||||
public String getCode() {
|
||||
|
||||
// Support HTML 4.0 style of OBJECT tag.
|
||||
//
|
||||
// <OBJECT classid=java:sun.plugin.MyClass .....>
|
||||
// <PARAM ....>
|
||||
// </OBJECT>
|
||||
//
|
||||
// In this case, the CODE will be inside the classid
|
||||
// attribute.
|
||||
//
|
||||
String moniker = getParameter("classid");
|
||||
String code = null;
|
||||
|
||||
if (moniker != null)
|
||||
{
|
||||
int index = moniker.indexOf("java:");
|
||||
|
||||
if (index > -1)
|
||||
{
|
||||
code = moniker.substring(5 + index);
|
||||
|
||||
if (code != null || !code.equals(""))
|
||||
return code;
|
||||
}
|
||||
}
|
||||
|
||||
code = getParameter("java_code");
|
||||
if (code==null)
|
||||
code=getParameter("code");
|
||||
return code;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the list of jar files if specified.
|
||||
* Otherwise return null.
|
||||
*/
|
||||
public String getJarFiles() {
|
||||
return cookedJars;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Allow pre-loading of local .jar files in plug-in lib/app directory
|
||||
* These .jar files are loaded with the PluginClassLoader so they
|
||||
* run in the applet's sandbox thereby saving developers the trouble
|
||||
* of writing trusted support classes.
|
||||
* The ClassLoaderInfo cli should be locked.
|
||||
*/
|
||||
protected Vector getLocalJarFiles() {
|
||||
|
||||
String fSep = File.separator;
|
||||
String libJarPath =
|
||||
System.getProperty("java.home") + fSep + "lib";
|
||||
|
||||
String appJarPath = libJarPath + fSep + "applet";
|
||||
return(getJarFilesFromPath(appJarPath));
|
||||
|
||||
}
|
||||
|
||||
|
||||
private Vector getJarFilesFromPath (String basePath) {
|
||||
File dir = new File(basePath);
|
||||
if (!dir.exists()) {
|
||||
return(null);
|
||||
}
|
||||
|
||||
String[] jarList = dir.list(new FilenameFilter() {
|
||||
public boolean accept(File f, String s) {
|
||||
return(s.endsWith(".jar"));
|
||||
}
|
||||
});
|
||||
|
||||
Vector jars = new Vector();
|
||||
|
||||
String fSep = File.separator;
|
||||
for (int i = 0; i < jarList.length; i++) {
|
||||
String fullJarPath = basePath + fSep + jarList[i];
|
||||
jars.add(new File(fullJarPath));
|
||||
}
|
||||
|
||||
return(jars);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Return the value of the object param
|
||||
*/
|
||||
public String getSerializedObject() {
|
||||
String object = getParameter("java_object");
|
||||
if (object==null)
|
||||
object=getParameter("object");// another name?
|
||||
return object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the applet context. For now this is
|
||||
* also implemented by the AppletPanel class.
|
||||
*/
|
||||
public AppletContext getAppletContext()
|
||||
{
|
||||
return appletContext;
|
||||
}
|
||||
|
||||
public Object getViewedObject()
|
||||
{
|
||||
Applet applet = super.getApplet();
|
||||
return applet;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Paint this panel while visible and loading an applet to entertain
|
||||
* the user.
|
||||
*
|
||||
* @param g the graphics context
|
||||
*/
|
||||
public void paint(Graphics g)
|
||||
{
|
||||
if (getViewedObject() == null && g != null) {
|
||||
setBackground(Color.lightGray);
|
||||
g.setColor(Color.black);
|
||||
Dimension d = getSize();
|
||||
Font fontOld = g.getFont();
|
||||
FontMetrics fm = null;
|
||||
if (fontOld != null)
|
||||
fm = g.getFontMetrics(fontOld);
|
||||
String str = getWaitingMessage();
|
||||
|
||||
// Display message on the screen if the applet is not started yet.
|
||||
if (d != null && fm != null)
|
||||
g.drawString(str, (d.width - fm.stringWidth(str))/ 2,
|
||||
(d.height + fm.getAscent())/ 2);
|
||||
}
|
||||
}
|
||||
|
||||
public String getWaitingMessage() {
|
||||
return "loading applet...";
|
||||
//return getMessage("loading") + getHandledType() + " ...";
|
||||
}
|
||||
|
||||
/*
|
||||
* <p>
|
||||
* Load an applet from a serialized stream. This is likely to happen
|
||||
* when the user uses the Back/Forward buttons
|
||||
* </p>
|
||||
*
|
||||
* @param is Input stream of the serialized applet
|
||||
*/
|
||||
protected void load(java.io.InputStream is) {
|
||||
this.is = is;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @return the applet name
|
||||
*/
|
||||
public String getName() {
|
||||
|
||||
String name = getParameter("name");
|
||||
if (name!=null)
|
||||
return name;
|
||||
|
||||
// Remove .class extension
|
||||
name = getCode();
|
||||
if (name != null){
|
||||
int index = name.lastIndexOf(".class");
|
||||
if (index != -1)
|
||||
name = name.substring(0, index);
|
||||
} else{
|
||||
// Remove .object extension
|
||||
name = getSerializedObject();
|
||||
|
||||
if (name != null) {
|
||||
int index = name.lastIndexOf(".ser");
|
||||
if (index != -1)
|
||||
name = name.substring(0, index);
|
||||
}
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the java component displayed by this viewer class
|
||||
*/
|
||||
protected String getHandledType() {
|
||||
return getMessage("java_applet");
|
||||
}
|
||||
|
||||
public void setStatus(int status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public void showActivatorAppletStatus(String msg) {
|
||||
showAppletStatus(msg);
|
||||
}
|
||||
|
||||
public void showActivatorAppletLog(String msg) {
|
||||
showAppletLog(msg);
|
||||
}
|
||||
|
||||
public void setDoInit(boolean doInit) {
|
||||
this.doInit = doInit;
|
||||
}
|
||||
|
||||
private WFAppletContext appletContext;
|
||||
|
||||
|
||||
/**
|
||||
* Method to get an internationalized string from the Activator resource.
|
||||
*/
|
||||
public static String getMessage(String key) {
|
||||
return key;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Method to get an internationalized string from the Activator resource.
|
||||
*/
|
||||
public static String[] getMessageArray(String key) {
|
||||
return new String[] { key };
|
||||
}
|
||||
|
||||
private java.io.InputStream is;
|
||||
|
||||
/**
|
||||
* This method actually creates an AppletClassLoader.
|
||||
*
|
||||
* It can be override by subclasses (such as the Plug-in)
|
||||
* to provide different classloaders. This method should be
|
||||
* called only when running inside JDK 1.2.
|
||||
*/
|
||||
protected AppletClassLoader createClassLoader(final URL codebase) {
|
||||
return new ActivatorClassLoader(codebase);
|
||||
}
|
||||
|
||||
/*
|
||||
* We overload our parent loadJarFiles so tht we can avoid
|
||||
* reloading JAR files that are already loaded.
|
||||
* KGH Mar 98
|
||||
*/
|
||||
protected void loadJarFiles(AppletClassLoader loader)
|
||||
throws IOException, InterruptedException
|
||||
{
|
||||
|
||||
|
||||
// Cache option as read from the Html page tag
|
||||
String copt;
|
||||
|
||||
// Cache Archive value as read from the Html page tag
|
||||
String carch;
|
||||
|
||||
// Cache Version value as read from the Html page tag
|
||||
String cver;
|
||||
|
||||
// Vector to store the names of the jar files to be cached
|
||||
Vector jname = new Vector();
|
||||
|
||||
// Vector to store actual version numbers
|
||||
Vector jVersion = new Vector();
|
||||
|
||||
|
||||
// Figure out the list of all required JARs.
|
||||
String raw = getParameter("java_archive");
|
||||
if (raw == null)
|
||||
{
|
||||
raw = getParameter("archive");
|
||||
}
|
||||
|
||||
|
||||
ClassLoaderInfo cli = ClassLoaderInfo.find(this);
|
||||
|
||||
try
|
||||
{
|
||||
// Prevent two applets trying to load JARS from the same
|
||||
// classloader at the same time.
|
||||
cli.lock();
|
||||
|
||||
// If there are no JARs, this is easy.
|
||||
if (raw == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Figure out which JAR files still need to be loaded.
|
||||
String cooked = "";
|
||||
StringTokenizer st = new StringTokenizer(raw, ",", false);
|
||||
while(st.hasMoreTokens())
|
||||
{
|
||||
String tok = st.nextToken().trim();
|
||||
if (cli.hasJar(tok))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
cli.addJar(tok);
|
||||
|
||||
if (cooked.equals(""))
|
||||
{
|
||||
cooked = tok;
|
||||
}
|
||||
else
|
||||
{
|
||||
cooked = cooked + "," + tok;
|
||||
}
|
||||
}
|
||||
|
||||
cookedJars = cooked;
|
||||
|
||||
// Now call into our superlcass to do the actual JAR loading.
|
||||
// It will call back to our getJarFiles method to find which
|
||||
// JARs need to be loaded, and we will give it the cooked list.
|
||||
super.loadJarFiles(loader);
|
||||
|
||||
}
|
||||
finally
|
||||
{
|
||||
// Other people can load JARs now.
|
||||
cli.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is The Waterfall Java Plugin Module
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* $Id: ActivatorClassLoader.java,v 1.1 2001/05/09 17:29:59 edburns%acm.org Exp $
|
||||
*
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
*/
|
||||
|
||||
package sun.jvmp.jpav;
|
||||
|
||||
import java.net.URL;
|
||||
|
||||
public class ActivatorClassLoader extends sun.jvmp.applet.WFAppletClassLoader
|
||||
{
|
||||
private URL base;
|
||||
public ActivatorClassLoader(URL base) {
|
||||
super(base);
|
||||
this.base = base;
|
||||
}
|
||||
};
|
|
@ -1,398 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is The Waterfall Java Plugin Module
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* $Id: ActivatorProxyHandler.java,v 1.1 2001/05/09 17:29:59 edburns%acm.org Exp $
|
||||
*
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
*/
|
||||
|
||||
package sun.jvmp.jpav;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.HashMap;
|
||||
import java.util.StringTokenizer;
|
||||
import sun.jvmp.*;
|
||||
import sun.jvmp.applet.*;
|
||||
|
||||
|
||||
public class ActivatorProxyHandler implements ProxyHandler, ProxyType {
|
||||
|
||||
private int proxyType = PROXY_TYPE_NO_PROXY;
|
||||
|
||||
/* proxyList contains all the proxy information in the form of
|
||||
* "http=webcache1-cup:8080;ftp=webcache2-cup;gopher=javaweb:9090". Proxy
|
||||
* information for a particular protocol is seperated by ';'. If a port
|
||||
* number is specified, it is specified by using ':' following the proxy
|
||||
* host. If a specified protocol is not specified in the list, no proxy
|
||||
* is assumed. There is another form of this string which is "webcache-cup:8080".
|
||||
* In this case, it means all protocol will use this proxy (Apply-all).
|
||||
* Notice that no '=' is in the string in this case.
|
||||
*/
|
||||
private String proxyList = null;
|
||||
|
||||
/* proxyOverride contains all the domain which no proxy should be used when
|
||||
* a connection is made. For example, "a.eng,b.eng,c.*.eng". In this case,
|
||||
* if the host name is a.eng, b.eng, or c.c.eng, no proxy is used. Otherwise,
|
||||
* proxy information will be returned according to the protocol in the URL.
|
||||
* Note that wildcard can be used. If all local address should be bypassed,
|
||||
* a special string '<local>' is used.
|
||||
*/
|
||||
private String proxyOverride = null;
|
||||
|
||||
/**
|
||||
* <p> Proxy info cache.
|
||||
* </p>
|
||||
*/
|
||||
private HashMap proxyTable = null;
|
||||
|
||||
private BrowserSupport support = null;
|
||||
|
||||
public ActivatorProxyHandler(int proxyType,
|
||||
String proxyList,
|
||||
String proxyOverride,
|
||||
BrowserSupport sup)
|
||||
{
|
||||
this.proxyType = proxyType;
|
||||
this.proxyList = proxyList;
|
||||
this.proxyOverride = proxyOverride;
|
||||
this.support = sup;
|
||||
proxyTable = new HashMap();
|
||||
}
|
||||
|
||||
|
||||
/* getProxyInfo is a function which takes a proxy-info-list, a
|
||||
* proxy-bypass-list, a URL, and returns the corresponding proxy information
|
||||
* with respect to the given URL.
|
||||
*
|
||||
* parameters :
|
||||
* u [in] a string which contains all the proxy information
|
||||
*
|
||||
* out:
|
||||
* ProxyInfo [out] ProxyInfo contains the corresponding proxy result.
|
||||
*
|
||||
*/
|
||||
public synchronized ProxyInfo getProxyInfo(URL u)
|
||||
{
|
||||
ProxyInfo pinfo = null;
|
||||
|
||||
try {
|
||||
pinfo = (ProxyInfo) proxyTable.get(u.getProtocol()
|
||||
+ u.getHost()
|
||||
+ u.getPort());
|
||||
|
||||
// XXX: is it OK?
|
||||
if (pinfo != null)
|
||||
return pinfo;
|
||||
|
||||
if (proxyType == PROXY_TYPE_NO_PROXY ||
|
||||
(proxyType == PROXY_TYPE_MANUAL && isProxyBypass(proxyOverride, u)))
|
||||
// Check if it is direct connect
|
||||
pinfo = new ProxyInfo(null, -1);
|
||||
else if (proxyType == PROXY_TYPE_MANUAL)
|
||||
{
|
||||
String socksInfo = null;
|
||||
|
||||
// Extract info about SOCKS
|
||||
int i = proxyList.indexOf("socks=");
|
||||
if (i != -1)
|
||||
{
|
||||
int j = proxyList.indexOf(";", i);
|
||||
if (j == -1)
|
||||
socksInfo = proxyList.substring(i + 6);
|
||||
else
|
||||
socksInfo = proxyList.substring(i + 6, j);
|
||||
}
|
||||
|
||||
|
||||
if (proxyList.indexOf("=") == -1)
|
||||
{
|
||||
// Apply all option
|
||||
pinfo = new ProxyInfo(proxyList);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Parse proxy list
|
||||
String protocol = u.getProtocol();
|
||||
|
||||
i = proxyList.indexOf(protocol + "=");
|
||||
if (i == -1)
|
||||
// Cannot find the protocol proxy
|
||||
pinfo = new ProxyInfo(null, socksInfo);
|
||||
else
|
||||
{
|
||||
int j = proxyList.indexOf(";", i);
|
||||
|
||||
if (j == -1) {
|
||||
pinfo = new ProxyInfo(proxyList.substring(i + protocol.length() + 1), socksInfo);
|
||||
}
|
||||
else {
|
||||
pinfo = new ProxyInfo(proxyList.substring(i + protocol.length() + 1, j), socksInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (support == null)
|
||||
pinfo = null;
|
||||
else
|
||||
pinfo = support.getProxyInfoForURL(u);
|
||||
}
|
||||
|
||||
proxyTable.put(u.getProtocol() + u.getHost() + u.getPort(), pinfo);
|
||||
}
|
||||
catch (Exception e) {
|
||||
PluggableJVM.trace("Proxy is not configured",
|
||||
PluggableJVM.LOG_ERROR);
|
||||
PluggableJVM.trace(e, PluggableJVM.LOG_ERROR);
|
||||
pinfo = new ProxyInfo(null, -1);
|
||||
}
|
||||
|
||||
return pinfo;
|
||||
}
|
||||
|
||||
|
||||
/* isProxyBypass is a function which takes a proxy override list and a URL
|
||||
* , and returns true if the hostname matches the proxy override list;
|
||||
* otherwise, false is returned.
|
||||
*
|
||||
* parameters :
|
||||
* proxyOverride [in] a string which contains the proxy override list
|
||||
* u [in] a URL which contains the hostname
|
||||
*
|
||||
* out:
|
||||
* boolean [out] if the proxy override list matches the hostname,
|
||||
* true is returned. Otherwise, false is returned.
|
||||
*
|
||||
* Notes: i) proxyOverride contains all the domain which no proxy should be
|
||||
* used when a connection is made. For example, "a.eng,b.eng,c.*.eng".
|
||||
* In this case, if the host name is a.eng, b.eng, or c.c.eng, no
|
||||
* proxy is used. Otherwise, proxy information will be returned
|
||||
* according to the protocol in the URL. Note that wildcard can be
|
||||
* used. If all local address should be bypassed, a special string
|
||||
* '<local>' is used.
|
||||
*
|
||||
*/
|
||||
private boolean isProxyBypass(String proxyOverride, URL u)
|
||||
{
|
||||
if (proxyOverride == null || proxyOverride.equals(""))
|
||||
return false;
|
||||
|
||||
String host = u.getHost();
|
||||
|
||||
// Extract proxy-override list
|
||||
StringTokenizer st = new StringTokenizer(proxyOverride, ",", false);
|
||||
while (st.hasMoreTokens())
|
||||
{
|
||||
String pattern = st.nextToken();
|
||||
|
||||
if (pattern.equals("<local>") && host.indexOf(".") == -1)
|
||||
return true;
|
||||
else if (shExpMatch(host, pattern))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/* shExpMatch is a function which takes a string and a pattern, and returns
|
||||
* true if the string matches the pattern; otherwise, false is returned.
|
||||
*
|
||||
* parameters :
|
||||
* str [in] a string which is used for pattern matching
|
||||
* shexp [in] a string which contains the pattern
|
||||
*
|
||||
* out:
|
||||
* boolean [out] if the string match the pattern, true is returned.
|
||||
* otherwise, false is returned.
|
||||
*
|
||||
* Notes: i) shexp contains the pattern which may include the wildcard '*'.
|
||||
* ii) The pattern matching is case-insensitive.
|
||||
*
|
||||
*/
|
||||
private boolean shExpMatch(String str, String shexp)
|
||||
{
|
||||
try {
|
||||
// Convert the string to lower case
|
||||
str = str.toLowerCase();
|
||||
shexp = shexp.toLowerCase();
|
||||
|
||||
return shExpMatch2(str, shexp);
|
||||
} catch (Throwable e) {
|
||||
|
||||
// Error recovery
|
||||
PluggableJVM.trace(e, PluggableJVM.LOG_WARNING);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/* shExpMatch2 is a function which takes a string and a pattern, and returns
|
||||
* true if the string matches the pattern; otherwise, false is returned.
|
||||
*
|
||||
* parameters :
|
||||
* str [in] a string which is used for pattern matching
|
||||
* shexp [in] a string which contains the pattern
|
||||
*
|
||||
* out:
|
||||
* boolean [out] if the string match the pattern, true is returned.
|
||||
* otherwise, false is returned.
|
||||
*
|
||||
* Notes: i) shexp contains the pattern which may include the wildcard '*'.
|
||||
*
|
||||
* ii) This is the actual implementation of the pattern matching
|
||||
* algorithm.
|
||||
*
|
||||
*/
|
||||
private boolean shExpMatch2(String str, String shexp)
|
||||
{
|
||||
// NULL is not a valid input.
|
||||
//
|
||||
if (str == null || shexp == null)
|
||||
return false;
|
||||
|
||||
if (shexp.equals("*"))
|
||||
return true;
|
||||
|
||||
// Check the position of the wildcard
|
||||
int index = shexp.indexOf('*');
|
||||
|
||||
if (index == -1)
|
||||
{
|
||||
// No wildcard anymore
|
||||
return str.equals(shexp);
|
||||
}
|
||||
else if (index == 0)
|
||||
{
|
||||
// Wildcard at the beginning of the pattern
|
||||
|
||||
for (int i=0; i <= str.length(); i++)
|
||||
{
|
||||
// Loop through the string to see if anything match.
|
||||
if (shExpMatch2(str.substring(i), shexp.substring(1)))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// index > 0
|
||||
String sub = null, sub2 = null;
|
||||
|
||||
sub = shexp.substring(0, index);
|
||||
|
||||
if (index <= str.length())
|
||||
sub2 = str.substring(0, index);
|
||||
|
||||
if (sub != null && sub2 != null && sub.equals(sub2))
|
||||
return shExpMatch2(str.substring(index), shexp.substring(index));
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/* extractAutoProxySetting is a function which takes a proxy-info-string
|
||||
* which returned from the JavaScript function FindProxyForURL, and returns
|
||||
* the corresponding proxy information.
|
||||
*
|
||||
* parameters :
|
||||
* s [in] a string which contains all the proxy information
|
||||
*
|
||||
* out:
|
||||
* ProxyInfo [out] ProxyInfo contains the corresponding proxy result.
|
||||
*
|
||||
* Notes: i) s contains all the proxy information in the form of
|
||||
* "PROXY webcache1-cup:8080;SOCKS webcache2-cup". There are three
|
||||
* possible values inside the string:
|
||||
* a) "DIRECT" -- no proxy is used.
|
||||
* b) "PROXY" -- Proxy is used.
|
||||
* c) "SOCKS" -- SOCKS support is used.
|
||||
* Information for each proxy settings are seperated by ';'. If a
|
||||
* port number is specified, it is specified by using ':' following
|
||||
* the proxy host.
|
||||
*
|
||||
*/
|
||||
private ProxyInfo extractAutoProxySetting(String s)
|
||||
{
|
||||
if (s != null)
|
||||
{
|
||||
StringTokenizer st = new StringTokenizer(s, ";", false);
|
||||
if (st.hasMoreTokens())
|
||||
{
|
||||
String pattern = st.nextToken();
|
||||
|
||||
int i = pattern.indexOf("PROXY");
|
||||
|
||||
if (i != -1) {
|
||||
// "PROXY" is specified
|
||||
return new ProxyInfo(pattern.substring(i + 6));
|
||||
}
|
||||
|
||||
i = pattern.indexOf("SOCKS");
|
||||
|
||||
if (i != -1)
|
||||
{
|
||||
// "SOCKS" is specified
|
||||
return new ProxyInfo(null, pattern.substring(i + 6));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// proxy string contains 'DIRECT' or unrecognized text
|
||||
return new ProxyInfo(null, -1);
|
||||
}
|
||||
|
||||
// The current default proxy handler
|
||||
private static ProxyHandler handler;
|
||||
|
||||
/*
|
||||
* <p>
|
||||
* @return the default proxy handler installed
|
||||
* </p>
|
||||
*
|
||||
*/
|
||||
public static ProxyHandler getDefaultProxyHandler() {
|
||||
return handler;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Set the default proxy handler reference
|
||||
* <p>
|
||||
*
|
||||
* @paran newDefault new default proxy handler
|
||||
*/
|
||||
public static void setDefaultProxyHandler(ProxyHandler newDefault) {
|
||||
handler = newDefault;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,113 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is The Waterfall Java Plugin Module
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* $Id: AppletMessageHandler.java,v 1.1 2001/05/09 17:29:59 edburns%acm.org Exp $
|
||||
*
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
*/
|
||||
|
||||
package sun.jvmp.jpav;
|
||||
|
||||
import java.util.ResourceBundle;
|
||||
import java.util.MissingResourceException;
|
||||
import java.text.MessageFormat;
|
||||
|
||||
/**
|
||||
* An hanlder of localized messages.
|
||||
*
|
||||
* @version 1.8, 03 Mar 1997
|
||||
* @author Koji Uno
|
||||
*/
|
||||
public class AppletMessageHandler {
|
||||
private static ResourceBundle rb;
|
||||
private String baseKey = null;
|
||||
|
||||
static {
|
||||
try {
|
||||
rb = ResourceBundle.getBundle
|
||||
("sun.jvmp.resources.MsgAppletViewer");
|
||||
} catch (MissingResourceException e) {
|
||||
//System.err.println(e.getMessage());
|
||||
//System.exit(1);
|
||||
}
|
||||
};
|
||||
|
||||
public AppletMessageHandler(String baseKey) {
|
||||
this.baseKey = baseKey;
|
||||
}
|
||||
|
||||
public String getMessage(String key) {
|
||||
return (String)rb.getString(getQualifiedKey(key));
|
||||
}
|
||||
|
||||
public String getMessage(String key, Object arg){
|
||||
String basemsgfmt = (String)rb.getString(getQualifiedKey(key));
|
||||
MessageFormat msgfmt = new MessageFormat(basemsgfmt);
|
||||
Object msgobj[] = new Object[1];
|
||||
if (arg == null) arg = "null";
|
||||
msgobj[0] = arg;
|
||||
return msgfmt.format(msgobj);
|
||||
}
|
||||
|
||||
public String getMessage(String key, Object arg1, Object arg2) {
|
||||
String basemsgfmt = (String)rb.getString(getQualifiedKey(key));
|
||||
MessageFormat msgfmt = new MessageFormat(basemsgfmt);
|
||||
Object msgobj[] = new Object[2];
|
||||
if (arg1 == null) {
|
||||
arg1 = "null";
|
||||
}
|
||||
if (arg2 == null) {
|
||||
arg2 = "null";
|
||||
}
|
||||
msgobj[0] = arg1;
|
||||
msgobj[1] = arg2;
|
||||
return msgfmt.format(msgobj);
|
||||
}
|
||||
|
||||
public String getMessage(String key, Object arg1, Object arg2, Object arg3) {
|
||||
String basemsgfmt = (String)rb.getString(getQualifiedKey(key));
|
||||
MessageFormat msgfmt = new MessageFormat(basemsgfmt);
|
||||
Object msgobj[] = new Object[3];
|
||||
if (arg1 == null) {
|
||||
arg1 = "null";
|
||||
}
|
||||
if (arg2 == null) {
|
||||
arg2 = "null";
|
||||
}
|
||||
if (arg3 == null) {
|
||||
arg3 = "null";
|
||||
}
|
||||
msgobj[0] = arg1;
|
||||
msgobj[1] = arg2;
|
||||
msgobj[2] = arg3;
|
||||
return msgfmt.format(msgobj);
|
||||
}
|
||||
|
||||
public String getMessage(String key, Object arg[]) {
|
||||
String basemsgfmt = (String)rb.getString(getQualifiedKey(key));
|
||||
MessageFormat msgfmt = new MessageFormat(basemsgfmt);
|
||||
return msgfmt.format(arg);
|
||||
}
|
||||
|
||||
String getQualifiedKey(String subKey) {
|
||||
return baseKey + "." + subKey;
|
||||
}
|
||||
}
|
|
@ -1,187 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is The Waterfall Java Plugin Module
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* $Id: ClassLoaderInfo.java,v 1.1 2001/05/09 17:29:59 edburns%acm.org Exp $
|
||||
*
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
*/
|
||||
|
||||
package sun.jvmp.jpav;
|
||||
|
||||
/**
|
||||
* This class keps track of information about active applet class loaders.
|
||||
* The classloaders are identified by their codebase URL.
|
||||
*
|
||||
* We keep around a pool of recently used class loaders.
|
||||
*
|
||||
* @author Graham Hamilton
|
||||
*/
|
||||
|
||||
import sun.applet.*;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import java.net.URL;
|
||||
|
||||
class ClassLoaderInfo {
|
||||
private URL codebase;
|
||||
private int references;
|
||||
private Hashtable jars;
|
||||
private boolean locked;
|
||||
private static boolean initialized;
|
||||
|
||||
// "infos" is a list of ClassLoaderInfos that are available for use.
|
||||
private static Hashtable infos = new Hashtable();
|
||||
|
||||
// "zombies" is a list of ClassLoaderInfos that currently have
|
||||
// a reference count of zero. We keep up to zombieLimit of these
|
||||
// guys available for resurrection. The least recently used is
|
||||
// at the front, the more recently used at the end.
|
||||
// All entries in zombies are also in infos.
|
||||
private static int zombieLimit;
|
||||
private static Vector zombies = new Vector();
|
||||
|
||||
private static synchronized void initialize() {
|
||||
if (initialized) {
|
||||
return;
|
||||
}
|
||||
initialized = true;
|
||||
zombieLimit = Integer.getInteger("javaplugin.jar.cache.size", 100).intValue();
|
||||
if (zombieLimit > 0) {
|
||||
System.err.println("java_cache_enabled");
|
||||
} else {
|
||||
System.err.println("java_cache_disabled");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Find ClassLoaderInfo for the given AppletPanel.
|
||||
*
|
||||
* If we don't have any active information, a new ClassLoaderInfo is
|
||||
* created with an initial reference count of zero.
|
||||
*/
|
||||
static synchronized ClassLoaderInfo find(AppletPanel panel) {
|
||||
initialize();
|
||||
URL codebase = panel.getCodeBase();
|
||||
//System.err.println("looking classloader for codebase:"+codebase);
|
||||
ClassLoaderInfo result = (ClassLoaderInfo)infos.get(codebase);
|
||||
if (result == null) {
|
||||
// System.out.println("ClassLoaderCache: adding " + codebase);
|
||||
result = new ClassLoaderInfo(codebase);
|
||||
infos.put(codebase, result);
|
||||
} else {
|
||||
// We make sure this loader isn't on the zombies list.
|
||||
zombies.removeElement(result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a retaining reference.
|
||||
*/
|
||||
synchronized void addReference() {
|
||||
references++;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a retaining reference. If there are no references left
|
||||
* then we put it on the zombies list.
|
||||
*/
|
||||
synchronized void removeReference() {
|
||||
references--;
|
||||
if (references < 0) {
|
||||
throw new Error("negative ref count???");
|
||||
}
|
||||
if (references == 0) {
|
||||
addZombie(this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the given ClassLoaderInfo to the zomboies list.
|
||||
* If there are too many zombies we get rid of some.
|
||||
*/
|
||||
private static synchronized void addZombie(ClassLoaderInfo cli) {
|
||||
// Add the ClassLoaderInfo to the end of the zombies list.
|
||||
zombies.addElement(cli);
|
||||
// If there are too many zombies, kill the first one.
|
||||
if (zombies.size() > zombieLimit) {
|
||||
ClassLoaderInfo victim = (ClassLoaderInfo)zombies.elementAt(0);
|
||||
// System.out.println("ClassLoaderCache: discarding " + victim.codebase);
|
||||
zombies.removeElementAt(0);
|
||||
infos.remove(victim.codebase);
|
||||
AppletPanel.flushClassLoader(victim.codebase);
|
||||
}
|
||||
}
|
||||
|
||||
private ClassLoaderInfo(URL codebase) {
|
||||
references = 0;
|
||||
this.codebase = codebase;
|
||||
jars = new Hashtable();
|
||||
}
|
||||
|
||||
synchronized void addJar(String name) {
|
||||
jars.put(name, name);
|
||||
}
|
||||
|
||||
synchronized boolean hasJar(String name) {
|
||||
if (jars.get(name) != null) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Flag and utility routines for recording whether local .jar files in lib/app/
|
||||
* have been loaded or not. This is used as a performance optimization
|
||||
* so that hasJar() does not need to be checked against the filesystem
|
||||
* each time an applet is loaded.
|
||||
*/
|
||||
|
||||
private boolean localJarsLoaded = false;
|
||||
|
||||
public boolean getLocalJarsLoaded() {
|
||||
return(localJarsLoaded);
|
||||
}
|
||||
|
||||
public void setLocalJarsLoaded(boolean loadedFlag) {
|
||||
localJarsLoaded = loadedFlag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Acquire the lock. This is used to prevent two AppletPanels
|
||||
* trying to classload JARs at the same time.
|
||||
*/
|
||||
public final synchronized void lock() throws InterruptedException {
|
||||
while (locked) {
|
||||
wait();
|
||||
}
|
||||
locked = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Release the lock. This allows other people do to classloading.
|
||||
*/
|
||||
public final synchronized void unlock() {
|
||||
locked = false;
|
||||
notifyAll();
|
||||
}
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is The Waterfall Java Plugin Module
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* $Id: CookieHandler.java,v 1.1 2001/05/09 17:29:59 edburns%acm.org Exp $
|
||||
*
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
*/
|
||||
|
||||
package sun.jvmp.jpav;
|
||||
|
||||
import java.net.URL;
|
||||
|
||||
public interface CookieHandler {
|
||||
|
||||
/* getCookieInfo takes a particular URL and returns its cookie info.
|
||||
*/
|
||||
String getCookieInfo(URL u);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1,287 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is The Waterfall Java Plugin Module
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* $Id: JavaPluginAVFactory.java,v 1.1 2001/05/09 17:29:59 edburns%acm.org Exp $
|
||||
*
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
*/
|
||||
|
||||
package sun.jvmp.jpav;
|
||||
|
||||
import sun.jvmp.*;
|
||||
import sun.jvmp.applet.*;
|
||||
import java.util.*;
|
||||
import java.security.*;
|
||||
import java.net.URL;
|
||||
import java.awt.Frame;
|
||||
import java.applet.Applet;
|
||||
import java.rmi.server.RMISocketFactory;
|
||||
import java.io.*;
|
||||
|
||||
public class JavaPluginAVFactory implements sun.jvmp.ObjectFactory
|
||||
{
|
||||
Vector cids;
|
||||
Hashtable permsHash;
|
||||
Permissions permsForAll;
|
||||
boolean inited=false;
|
||||
CodeSource codesource;
|
||||
PluggableJVM jvm;
|
||||
static JavaPluginAVFactory instance = null;
|
||||
|
||||
|
||||
public static ObjectFactory getFactory(PluggableJVM jvm,
|
||||
CodeSource codesource)
|
||||
throws ComponentException
|
||||
{
|
||||
if (instance == null)
|
||||
instance = new JavaPluginAVFactory(jvm, codesource);
|
||||
return instance;
|
||||
}
|
||||
|
||||
protected JavaPluginAVFactory(PluggableJVM jvm, CodeSource codesource)
|
||||
throws ComponentException
|
||||
{
|
||||
cids = new Vector();
|
||||
cids.add(WFAppletViewer.CID);
|
||||
permsHash = new Hashtable();
|
||||
this.jvm = jvm;
|
||||
this.codesource = codesource;
|
||||
/* Permissions p = new Permissions();
|
||||
// XXX: correct?
|
||||
//p.add(new java.security.AllPermission());
|
||||
permsHash.put(codesource, p);
|
||||
*/
|
||||
// XXX: rewrite with policy file
|
||||
permsForAll = new Permissions();
|
||||
permsForAll.add(new java.lang.RuntimePermission("accessClassInPackage.sun.jvmp.jpav"));
|
||||
permsForAll.add(new java.lang.RuntimePermission("accessClassInPackage.sun.jvmp.jpav.protocol.jdk12.http"));
|
||||
permsForAll.add(new java.lang.RuntimePermission("accessClassInPackage.sun.jvmp.jpav.protocol.jdk12.ftp"));
|
||||
permsForAll.add(new java.lang.RuntimePermission("accessClassInPackage.sun.jvmp.jpav.protocol.jdk12.jar"));
|
||||
permsForAll.add(new java.lang.RuntimePermission("accessClassInPackage.sun.jvmp.jpav.protocol.jdk12.https"));
|
||||
permsForAll.add(new java.lang.RuntimePermission("accessClassInPackage.sun.jvmp.jpav.protocol.jdk12.gopher"));
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return "Java Plugin applet viewer";
|
||||
}
|
||||
|
||||
public Enumeration getCIDs()
|
||||
{
|
||||
return cids.elements();
|
||||
}
|
||||
|
||||
public boolean handleConflict(String cid,
|
||||
ObjectFactory f)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public Object instantiate(String cid, Object arg)
|
||||
{
|
||||
AppletViewerArgs a;
|
||||
try {
|
||||
a = (AppletViewerArgs)arg;
|
||||
} catch (ClassCastException e) {
|
||||
return null;
|
||||
}
|
||||
if (!inited) initEnvironment(a.support);
|
||||
if ((cid == null) || (!WFAppletViewer.CID.equals(cid)) || (a == null))
|
||||
return null;
|
||||
return new TempAV(a.jvm, a.ctx, a.support, a.atts);
|
||||
}
|
||||
|
||||
public PermissionCollection getPermissions(CodeSource codesource)
|
||||
{
|
||||
// pity, but no clone() here
|
||||
Permissions p = new Permissions();
|
||||
for (Enumeration e=permsForAll.elements(); e.hasMoreElements(); )
|
||||
p.add((Permission)e.nextElement());
|
||||
if (codesource != null)
|
||||
{
|
||||
Permissions p1 = (Permissions)permsHash.get(codesource);
|
||||
if (p1 != null)
|
||||
{
|
||||
for (Enumeration e=p1.elements(); e.hasMoreElements(); )
|
||||
p.add((Permission)e.nextElement());
|
||||
}
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare the enviroment for executing applets.
|
||||
*/
|
||||
void initEnvironment(BrowserSupport support)
|
||||
{
|
||||
// if we are already initialized, just return
|
||||
if (inited) return;
|
||||
// Get our internationalization resources. (Make sure this is
|
||||
// done before calling showConsoleWindow.)
|
||||
//rb = ResourceBundle.getBundle("sun.plugin.resources.Activator");
|
||||
//rb = null;
|
||||
/**
|
||||
* maybe move all this stuff to plugin.policy file
|
||||
**/
|
||||
Properties props = new Properties(System.getProperties());
|
||||
// Define a number of standard properties
|
||||
props.put("acl.read", "+");
|
||||
props.put("acl.read.default", "");
|
||||
props.put("acl.write", "+");
|
||||
props.put("acl.write.default", "");
|
||||
// Standard browser properties
|
||||
props.put("browser", "sun.jvmp");
|
||||
//props.put("browser.version", theVersion);
|
||||
props.put("browser.vendor", "Sun Microsystems Inc.");
|
||||
props.put("http.agent", "Waterfall Applet Viewer/1.0");
|
||||
// Define which packages can NOT be accessed by applets
|
||||
props.put("package.restrict.access.sun", "true");
|
||||
//
|
||||
// This is important to set the netscape package access to "false".
|
||||
// Some applets running in IE and NS will access
|
||||
// netscape.javascript.JSObject sometimes. If we set this
|
||||
// restriction to "true", these applets will not run at all.
|
||||
// However, if we set it to "false", the applet may continue
|
||||
// to run by catching an exception.
|
||||
props.put("package.restrict.access.netscape", "false");
|
||||
|
||||
// Define which packages can NOT be extended by applets
|
||||
props.put("package.restrict.definition.java", "true");
|
||||
props.put("package.restrict.definition.sun", "true");
|
||||
props.put("package.restrict.definition.netscape", "true");
|
||||
|
||||
// Define which properties can be read by applets.
|
||||
// A property named by "key" can be read only when its twin
|
||||
// property "key.applet" is true. The following ten properties
|
||||
// are open by default. Any other property can be explicitly
|
||||
// opened up by the browser user setting key.applet=true in
|
||||
// ~/.java/properties. Or vice versa, any of the following can
|
||||
// be overridden by the user's properties.
|
||||
props.put("java.version.applet", "true");
|
||||
props.put("java.vendor.applet", "true");
|
||||
props.put("java.vendor.url.applet", "true");
|
||||
props.put("java.class.version.applet", "true");
|
||||
props.put("os.name.applet", "true");
|
||||
props.put("os.version.applet", "true");
|
||||
props.put("os.arch.applet", "true");
|
||||
props.put("file.separator.applet", "true");
|
||||
props.put("path.separator.applet", "true");
|
||||
props.put("line.separator.applet", "true");
|
||||
props.remove("proxyHost");
|
||||
props.remove("proxyPort");
|
||||
props.remove("http.proxyHost");
|
||||
props.remove("http.proxyPort");
|
||||
props.remove("https.proxyHost");
|
||||
props.remove("https.proxyPort");
|
||||
props.remove("ftpProxyHost");
|
||||
props.remove("ftpProxyPort");
|
||||
props.remove("ftpProxySet");
|
||||
props.remove("gopherProxyHost");
|
||||
props.remove("gopherProxyPort");
|
||||
props.remove("gopherProxySet");
|
||||
props.remove("socksProxyHost");
|
||||
props.remove("socksProxyPort");
|
||||
|
||||
// Set allow default user interaction in HTTP/HTTPS
|
||||
java.net.URLConnection.setDefaultAllowUserInteraction(true);
|
||||
|
||||
// Make sure proxy is detected on the fly in http, ftp and gopher.
|
||||
ProxyHandler handler
|
||||
= getDefaultProxyHandler(ActivatorAppletPanel.PROXY_TYPE_AUTOCONFIG,
|
||||
null,
|
||||
null,
|
||||
support);
|
||||
|
||||
try {
|
||||
ActivatorProxyHandler.setDefaultProxyHandler(handler);
|
||||
} catch(Throwable e) {
|
||||
PluggableJVM.trace(e, PluggableJVM.LOG_WARNING);
|
||||
}
|
||||
|
||||
// Set RMI socket factory for proxy.
|
||||
try {
|
||||
RMISocketFactory.setSocketFactory(new RMIActivatorSocketFactory());
|
||||
}
|
||||
catch (IOException e) {
|
||||
}
|
||||
System.setProperties(props);
|
||||
inited=true;
|
||||
}
|
||||
|
||||
protected static ProxyHandler
|
||||
getDefaultProxyHandler(int proxyType,
|
||||
String proxyList,
|
||||
String proxyOverride,
|
||||
BrowserSupport ctx)
|
||||
{
|
||||
return new ActivatorProxyHandler(proxyType,
|
||||
proxyList,
|
||||
proxyOverride,
|
||||
ctx);
|
||||
}
|
||||
}
|
||||
|
||||
class TempAV implements WFAppletViewer
|
||||
{
|
||||
ActivatorAppletPanel av;
|
||||
TempAV(PluggableJVM jvm, WFAppletContext ctx,
|
||||
BrowserSupport support, Hashtable atts)
|
||||
{
|
||||
av = new ActivatorAppletPanel(jvm, ctx, atts);
|
||||
}
|
||||
|
||||
public void startApplet()
|
||||
{
|
||||
av.appletStart();
|
||||
}
|
||||
|
||||
public void stopApplet()
|
||||
{
|
||||
av.appletStop();
|
||||
}
|
||||
|
||||
public void destroyApplet(int timeout)
|
||||
{
|
||||
av.onClose(timeout);
|
||||
}
|
||||
|
||||
public int getLoadingStatus()
|
||||
{
|
||||
return av.getLoadingStatus();
|
||||
}
|
||||
|
||||
public void setDocumentBase(URL docbase)
|
||||
{
|
||||
av.setDocumentBase(docbase);
|
||||
}
|
||||
|
||||
public void setWindow(Frame f)
|
||||
{
|
||||
av.setWindow(f);
|
||||
}
|
||||
|
||||
public Applet getApplet()
|
||||
{
|
||||
return av.getApplet();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -1,41 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is The Waterfall Java Plugin Module
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* $Id: ProxyHandler.java,v 1.1 2001/05/09 17:29:59 edburns%acm.org Exp $
|
||||
*
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
*/
|
||||
|
||||
package sun.jvmp.jpav;
|
||||
|
||||
import java.net.URL;
|
||||
import sun.jvmp.applet.ProxyInfo;
|
||||
|
||||
|
||||
public interface ProxyHandler {
|
||||
|
||||
/* getProxyInfo takes a particular URL and returns its proxy setting.
|
||||
*/
|
||||
ProxyInfo getProxyInfo(URL u);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1,75 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is The Waterfall Java Plugin Module
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* $Id: RMIActivatorSocketFactory.java,v 1.1 2001/05/09 17:29:59 edburns%acm.org Exp $
|
||||
*
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
*/
|
||||
|
||||
/*
|
||||
* @(#)RMIPluginSocketFactory.java 1.8 97/01/22
|
||||
*
|
||||
* Copyright (c) 1995, 1996 Sun Microsystems, Inc. All Rights Reserved.
|
||||
*
|
||||
* This software is the confidential and proprietary information of Sun
|
||||
* Microsystems, Inc. ("Confidential Information"). You shall not
|
||||
* disclose such Confidential Information and shall use it only in
|
||||
* accordance with the terms of the license agreement you entered into
|
||||
* with Sun.
|
||||
*
|
||||
* SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
|
||||
* SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES
|
||||
* SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
|
||||
* THIS SOFTWARE OR ITS DERIVATIVES.
|
||||
*
|
||||
* CopyrightVersion 1.1_beta
|
||||
*/
|
||||
package sun.jvmp.jpav;
|
||||
|
||||
import sun.rmi.transport.proxy.RMIMasterSocketFactory;
|
||||
import sun.rmi.transport.proxy.RMIHttpToPortSocketFactory;
|
||||
import sun.rmi.transport.proxy.RMIHttpToCGISocketFactory;
|
||||
|
||||
/**
|
||||
* RMIPluginSocketFactory attempts to create a socket connection to the
|
||||
* specified host using successively less efficient mechanisms
|
||||
* until one succeeds. If the host is successfully connected to,
|
||||
* the factory for the successful mechanism is stored in an internal
|
||||
* hash table keyed by the host name, so that future attempts to
|
||||
* connect to the same host will automatically use the same
|
||||
* mechanism.
|
||||
*/
|
||||
public class RMIActivatorSocketFactory extends RMIMasterSocketFactory {
|
||||
|
||||
/**
|
||||
* Create a RMIActivatorSocketFactory object. Establish order of
|
||||
* connection mechanisms to attempt on createSocket, if a direct
|
||||
* socket connection fails.
|
||||
*/
|
||||
public RMIActivatorSocketFactory()
|
||||
{
|
||||
altFactoryList.addElement(new RMIHttpToPortSocketFactory());
|
||||
altFactoryList.addElement(new RMIHttpToCGISocketFactory());
|
||||
}
|
||||
}
|
||||
|
|
@ -1,94 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is The Waterfall Java Plugin Module
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* $Id: Handler.java,v 1.1 2001/05/09 17:29:59 edburns%acm.org Exp $
|
||||
*
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
*/
|
||||
|
||||
package sun.jvmp.jpav.protocol.jdk12.ftp;
|
||||
|
||||
import java.net.URL;
|
||||
import java.io.IOException;
|
||||
import sun.jvmp.jpav.protocol.jdk12.http.HttpURLConnection;
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import sun.net.ftp.FtpClient;
|
||||
import sun.net.www.protocol.ftp.*;
|
||||
import sun.jvmp.applet.*;
|
||||
import sun.jvmp.jpav.*;
|
||||
|
||||
/**
|
||||
* Open an ftp connection given a URL
|
||||
*/
|
||||
public class Handler extends java.net.URLStreamHandler {
|
||||
|
||||
|
||||
public java.net.URLConnection openConnection(URL u) {
|
||||
/* if set for proxy usage then go through the gopher code to get
|
||||
* the url connection.
|
||||
*/
|
||||
ProxyHandler handler = ActivatorProxyHandler.getDefaultProxyHandler();
|
||||
ProxyInfo pinfo = null;
|
||||
|
||||
if (handler != null)
|
||||
pinfo = handler.getProxyInfo(u);
|
||||
|
||||
try {
|
||||
if (pinfo != null && pinfo.isProxyUsed())
|
||||
{
|
||||
return new HttpURLConnection(u, pinfo.getProxy(), pinfo.getPort());
|
||||
}
|
||||
else
|
||||
{
|
||||
/* make a direct ftp connection */
|
||||
return superOpenConnection(u);
|
||||
}
|
||||
} catch(IOException e) {
|
||||
return superOpenConnection(u);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected java.net.URLConnection superOpenConnection(URL u) {
|
||||
/* if set for proxy usage then go through the http code to get */
|
||||
/* the url connection. Bad things will happen if a user and
|
||||
* password are specified in the ftp url */
|
||||
try {
|
||||
if (FtpClient.getUseFtpProxy()) {
|
||||
String host = FtpClient.getFtpProxyHost();
|
||||
if (host != null &&
|
||||
host.length() > 0) {
|
||||
return new sun.jvmp.jpav.protocol.jdk12.http.HttpURLConnection(u, host,
|
||||
FtpClient.getFtpProxyPort());
|
||||
}
|
||||
}
|
||||
} catch(IOException e) {
|
||||
}
|
||||
|
||||
/* make a direct ftp connection */
|
||||
return new FtpURLConnection(u);
|
||||
}
|
||||
|
||||
protected int getDefaultPort() {
|
||||
return 21;
|
||||
}
|
||||
}
|
|
@ -1,67 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is The Waterfall Java Plugin Module
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* $Id: Handler.java,v 1.1 2001/05/09 17:29:59 edburns%acm.org Exp $
|
||||
*
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
*/
|
||||
|
||||
package sun.jvmp.jpav.protocol.jdk12.gopher;
|
||||
|
||||
import java.net.URL;
|
||||
import java.io.IOException;
|
||||
import sun.jvmp.jpav.protocol.jdk12.http.HttpURLConnection;
|
||||
import sun.jvmp.applet.*;
|
||||
import sun.jvmp.jpav.*;
|
||||
|
||||
/**
|
||||
* A class to handle the gopher protocol.
|
||||
*/
|
||||
|
||||
public class Handler extends sun.net.www.protocol.gopher.Handler {
|
||||
|
||||
public java.net.URLConnection openConnection(URL u) throws IOException {
|
||||
/* if set for proxy usage then go through the gopher code to get
|
||||
* the url connection.
|
||||
*/
|
||||
ProxyHandler handler = ActivatorProxyHandler.getDefaultProxyHandler();
|
||||
ProxyInfo pinfo = null;
|
||||
|
||||
if (handler != null)
|
||||
pinfo = handler.getProxyInfo(u);
|
||||
|
||||
try {
|
||||
if (pinfo != null && pinfo.isProxyUsed())
|
||||
{
|
||||
return new HttpURLConnection(u, pinfo.getProxy(), pinfo.getPort());
|
||||
}
|
||||
else
|
||||
{
|
||||
/* make a direct gopher connection */
|
||||
return super.openConnection(u);
|
||||
}
|
||||
} catch(IOException e) {
|
||||
return super.openConnection(u);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,49 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is The Waterfall Java Plugin Module
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* $Id: Handler.java,v 1.1 2001/05/09 17:29:59 edburns%acm.org Exp $
|
||||
*
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
*/
|
||||
|
||||
package sun.jvmp.jpav.protocol.jdk12.http;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
|
||||
|
||||
/**
|
||||
* Open an http input stream given a URL
|
||||
*/
|
||||
public class Handler extends sun.net.www.protocol.http.Handler {
|
||||
|
||||
/*
|
||||
* <p>
|
||||
* We use our protocol handler for JDK 1.2 to open the connection for
|
||||
* the specified URL
|
||||
* </p>
|
||||
*
|
||||
* @param URL the url to open
|
||||
*/
|
||||
public java.net.URLConnection openConnection(URL u) throws IOException {
|
||||
return new HttpURLConnection(u, this);
|
||||
}
|
||||
}
|
|
@ -1,97 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is The Waterfall Java Plugin Module
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* $Id: HttpClient.java,v 1.1 2001/05/09 17:30:00 edburns%acm.org Exp $
|
||||
*
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
*/
|
||||
|
||||
package sun.jvmp.jpav.protocol.jdk12.http;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.util.*;
|
||||
import sun.net.NetworkClient;
|
||||
import sun.net.ProgressEntry;
|
||||
import sun.net.ProgressData;
|
||||
import sun.net.www.MessageHeader;
|
||||
import sun.net.www.HeaderParser;
|
||||
import sun.net.www.MeteredStream;
|
||||
import sun.misc.Regexp;
|
||||
import sun.misc.RegexpPool;
|
||||
import sun.jvmp.applet.ProxyInfo;
|
||||
import sun.jvmp.jpav.*;
|
||||
|
||||
public class HttpClient extends sun.net.www.http.HttpClient {
|
||||
|
||||
/* This package-only CTOR should only be used for FTP piggy-backed on HTTP
|
||||
* HTTP URL's that use this won't take advantage of keep-alive.
|
||||
* Additionally, this constructor may be used as a last resort when the
|
||||
* first HttpClient gotten through New() failed (probably b/c of a
|
||||
* Keep-Alive mismatch).
|
||||
*
|
||||
* XXX That documentation is wrong ... it's not package-private any more
|
||||
*/
|
||||
public HttpClient(URL url, String proxy, int proxyPort)
|
||||
throws IOException {
|
||||
super (url, proxy, proxyPort);
|
||||
}
|
||||
|
||||
/* This class has no public constructor for HTTP. This method is used to
|
||||
* get an HttpClient to the specifed URL. If there's currently an
|
||||
* active HttpClient to that server/port, you'll get that one.
|
||||
*/
|
||||
public static HttpClient New(URL url, String proxy, int proxyPort)
|
||||
throws IOException {
|
||||
/* see if one's already around */
|
||||
HttpClient ret = (HttpClient) kac.get(url);
|
||||
if (ret == null) {
|
||||
ret = new HttpClient (url, proxy, proxyPort); // CTOR called openServer()
|
||||
} else {
|
||||
ret.url = url;
|
||||
}
|
||||
// don't know if we're keeping alive until we parse the headers
|
||||
// for now, keepingAlive is false
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a socket connected to the server, with any
|
||||
* appropriate options pre-established
|
||||
*/
|
||||
protected Socket doConnect (String server, int port)
|
||||
throws IOException, UnknownHostException {
|
||||
|
||||
ProxyHandler handler = sun.jvmp.jpav.ActivatorProxyHandler.getDefaultProxyHandler();
|
||||
if (handler != null)
|
||||
{
|
||||
ProxyInfo pinfo = handler.getProxyInfo(url);
|
||||
|
||||
if (pinfo != null && pinfo.isSocksUsed())
|
||||
{
|
||||
// Use SOCKS !!
|
||||
return new SocksSocket(server, port, pinfo.getSocksProxy(), pinfo.getSocksPort());
|
||||
}
|
||||
}
|
||||
|
||||
return super.doConnect(server, port);
|
||||
}
|
||||
}
|
|
@ -1,292 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is The Waterfall Java Plugin Module
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* $Id: HttpURLConnection.java,v 1.1 2001/05/09 17:30:00 edburns%acm.org Exp $
|
||||
*
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
*/
|
||||
|
||||
package sun.jvmp.jpav.protocol.jdk12.http;
|
||||
|
||||
import java.net.URL;
|
||||
import java.net.ProtocolException;
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedExceptionAction;
|
||||
import java.security.PrivilegedActionException;
|
||||
import sun.net.*;
|
||||
import sun.net.www.*;
|
||||
import sun.jvmp.applet.*;
|
||||
import sun.jvmp.jpav.*;
|
||||
|
||||
public class HttpURLConnection extends
|
||||
sun.net.www.protocol.http.HttpURLConnection {
|
||||
|
||||
protected String proxy = null;
|
||||
protected int proxyPort = -1;
|
||||
|
||||
// This is to keep trace of the failedOnce value in the super class. Since failedOnce
|
||||
// in the super one are declared private, we do some hack to get this value.
|
||||
boolean failedOnce = false;
|
||||
|
||||
public HttpURLConnection(URL u, Handler handler)
|
||||
throws IOException {
|
||||
super(u, handler);
|
||||
}
|
||||
|
||||
/** this constructor is used by other protocol handlers such as ftp
|
||||
that want to use http to fetch urls on their behalf. */
|
||||
public HttpURLConnection(URL u, String host, int port)
|
||||
throws IOException {
|
||||
super(u, host, port);
|
||||
this.proxy = host;
|
||||
this.proxyPort = port;
|
||||
}
|
||||
|
||||
static CookieHandler handler = null;
|
||||
|
||||
/* setCookieHandler is used only when a particular CookieHandler is required
|
||||
* to determine the cookie value of a particular URL on the fly.
|
||||
*/
|
||||
public static void setCookieHandler(CookieHandler h) {
|
||||
handler = h;
|
||||
}
|
||||
|
||||
protected boolean fromClassLoader() {
|
||||
Exception e = new Exception();
|
||||
ByteArrayOutputStream ba = new ByteArrayOutputStream();
|
||||
PrintStream pos = new PrintStream(ba);
|
||||
//e.printStackTrace(pos);
|
||||
String trace = ba.toString();
|
||||
StringTokenizer tok = new StringTokenizer(trace);
|
||||
String s = null;
|
||||
while(tok.hasMoreTokens()) {
|
||||
s = tok.nextToken();
|
||||
if ((s.startsWith("sun.applet.AppletClassLoader")) ||
|
||||
(s.startsWith("sun.applet.AppletResourceLoader")) ||
|
||||
(s.startsWith("sun.jvmp.jpav.ActivatorClassLoader"))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected boolean rightExt() {
|
||||
String fname = url.getFile();
|
||||
return (fname.endsWith(".jar") || fname.endsWith(".class"));
|
||||
}
|
||||
|
||||
void privBlock() throws Exception {
|
||||
try {
|
||||
if ("http".equals(url.getProtocol()) && !failedOnce) {
|
||||
http = HttpClient.New(url, proxy, proxyPort);
|
||||
} else {
|
||||
// make sure to construct new connection if first attempt failed
|
||||
http = getProxiedClient(url, proxy, proxyPort);
|
||||
}
|
||||
ps = (PrintStream)http.getOutputStream();
|
||||
} catch (IOException e) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
// overridden in HTTPS subclass
|
||||
|
||||
public synchronized void connect() throws IOException {
|
||||
if (connected)
|
||||
return;
|
||||
|
||||
// Determine proxy setting for the connection
|
||||
|
||||
if (proxy == null) {
|
||||
ProxyInfo pinfo = null;
|
||||
ProxyHandler proxyHandler = ActivatorProxyHandler.getDefaultProxyHandler();
|
||||
|
||||
if (proxyHandler!=null) {
|
||||
pinfo = proxyHandler.getProxyInfo(url);
|
||||
|
||||
if (pinfo != null)
|
||||
{
|
||||
proxy = pinfo.getProxy();
|
||||
proxyPort = pinfo.getPort();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check whether the applet is allowed to connect to the host.
|
||||
// This is necessary because we will enable privilege to
|
||||
// connect to the proxy
|
||||
SecurityManager m = System.getSecurityManager();
|
||||
if (m != null) {
|
||||
m.checkConnect(url.getHost(), url.getPort());
|
||||
}
|
||||
|
||||
// Determine cookie value
|
||||
if (handler != null)
|
||||
{
|
||||
// Use browser cookie only if the cookie has not
|
||||
// been set by the applet.
|
||||
if (getRequestProperty("cookie") == null)
|
||||
{
|
||||
String cookie = handler.getCookieInfo(url);
|
||||
|
||||
if (cookie != null)
|
||||
setRequestProperty("cookie", cookie);
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
AccessController.doPrivileged(new PrivilegedBlockAction(this));
|
||||
} catch (PrivilegedActionException e) {
|
||||
IOException ioe = (IOException)e.getException();
|
||||
throw ioe;
|
||||
}
|
||||
|
||||
// Workaround for Mozilla bugs
|
||||
String workaround = (String) java.security.AccessController.doPrivileged(
|
||||
new sun.security.action.GetPropertyAction("mozilla.workaround"));
|
||||
|
||||
if (workaround != null && workaround.equalsIgnoreCase("true"))
|
||||
{
|
||||
// Disable browser caching in Mozilla
|
||||
setUseCaches(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
// constructor to HTTP client calls openserver
|
||||
setUseCaches(getUseCaches() && rightExt());
|
||||
}
|
||||
|
||||
connected = true;
|
||||
}
|
||||
|
||||
private InputStream cacheStream = null;
|
||||
|
||||
public synchronized InputStream getInputStream() throws IOException{
|
||||
if (!connected)
|
||||
connect();
|
||||
if (useCaches) {
|
||||
try {
|
||||
// check if we are allowed to read files. If not, there is
|
||||
// no point to caching. Now, we have no idea where the
|
||||
// browser will put the file, so lets try to read
|
||||
// java.home property
|
||||
if (cacheStream != null)
|
||||
return cacheStream;
|
||||
|
||||
cacheStream = (InputStream)
|
||||
AccessController.doPrivileged(new FileCreator(this));
|
||||
if (cacheStream==null) {
|
||||
useCaches = false;
|
||||
} else {
|
||||
return cacheStream;
|
||||
}
|
||||
} catch (PrivilegedActionException e) { //IOException. fall through, and try
|
||||
//remote
|
||||
System.out.println("IO Exception, using remote copy");
|
||||
//e.printStackTrace();
|
||||
useCaches = false;
|
||||
} catch (SecurityException e1) {
|
||||
System.out.println("Security exception, using remote copy");
|
||||
useCaches = false;
|
||||
}
|
||||
}
|
||||
return super.getInputStream();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new HttpClient object, bypassing the cache of
|
||||
* HTTP client objects/connections.
|
||||
*
|
||||
* @param url the URL being accessed
|
||||
*/
|
||||
protected sun.net.www.http.HttpClient getNewClient (URL url)
|
||||
throws IOException {
|
||||
|
||||
// This is a hack to get the failedOnce value. Since getNewClient is only called by the
|
||||
// super class when failedOnce is true, we can obtain the failedOnce value this way.
|
||||
failedOnce = true;
|
||||
|
||||
return getProxiedClient(url, proxy, proxyPort);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create a new HttpClient object, set up so that it uses
|
||||
* per-instance proxying to the given HTTP proxy. This
|
||||
* bypasses the cache of HTTP client objects/connections.
|
||||
*
|
||||
* @param url the URL being accessed
|
||||
* @param proxyHost the proxy host to use
|
||||
* @param proxyPort the proxy port to use
|
||||
*/
|
||||
protected sun.net.www.http.HttpClient getProxiedClient (URL url, String proxyHost, int proxyPort)
|
||||
throws IOException {
|
||||
return new HttpClient (url, proxyHost, proxyPort);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get an internationalized string from the Activator resource.
|
||||
*/
|
||||
public static String getMessage(String key) {
|
||||
return key;
|
||||
}
|
||||
|
||||
// Localization strings.
|
||||
private static ResourceBundle rb;
|
||||
|
||||
class FileCreator implements PrivilegedExceptionAction {
|
||||
HttpURLConnection conn;
|
||||
|
||||
FileCreator(HttpURLConnection c) {
|
||||
conn = c;
|
||||
}
|
||||
|
||||
public Object run() throws Exception {
|
||||
|
||||
String fileName = null; //sun.plugin.CacheHandler.getCacheFile(conn.getURL());
|
||||
if (fileName!=null)
|
||||
return new BufferedInputStream(new FileInputStream(fileName));
|
||||
else
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
class PrivilegedBlockAction implements PrivilegedExceptionAction {
|
||||
HttpURLConnection conn;
|
||||
PrivilegedBlockAction(HttpURLConnection c)
|
||||
{
|
||||
conn = c;
|
||||
}
|
||||
|
||||
public Object run() throws Exception {
|
||||
conn.privBlock();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -1,407 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is The Waterfall Java Plugin Module
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* $Id: SocksSocket.java,v 1.1 2001/05/09 17:30:00 edburns%acm.org Exp $
|
||||
*
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
*/
|
||||
|
||||
/*
|
||||
* @(#)SocksSocket.java 1.4 00/02/16
|
||||
*
|
||||
* Copyright (c) 1995, 1996 Sun Microsystems, Inc. All Rights Reserved.
|
||||
*
|
||||
* This software is the confidential and proprietary information of Sun
|
||||
* Microsystems, Inc. ("Confidential Information"). You shall not
|
||||
* disclose such Confidential Information and shall use it only in
|
||||
* accordance with the terms of the license agreement you entered into
|
||||
* with Sun.
|
||||
*
|
||||
* SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
|
||||
* SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES
|
||||
* SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
|
||||
* THIS SOFTWARE OR ITS DERIVATIVES.
|
||||
*
|
||||
* CopyrightVersion 1.1_beta
|
||||
*
|
||||
* @author Stanley Man-Kit Ho
|
||||
*/
|
||||
|
||||
package sun.jvmp.jpav.protocol.jdk12.http;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
import java.net.Socket;
|
||||
import java.net.SocketException;
|
||||
|
||||
/**
|
||||
* This class implements client sockets (also called just
|
||||
* "sockets") through SOCKS. A socket is an endpoint for communication
|
||||
* between two machines.
|
||||
* <p>
|
||||
* The actual work of the socket is performed by an instance of the
|
||||
* <code>SocketImpl</code> class. An application, by changing
|
||||
* the socket factory that creates the socket implementation,
|
||||
* can configure itself to create sockets appropriate to the local
|
||||
* firewall.
|
||||
*
|
||||
* @author Stanley Man-Kit Ho
|
||||
* @version 1.00, 04/23/98
|
||||
* @see java.net.Socket
|
||||
* @since JDK1.0
|
||||
*/
|
||||
public class SocksSocket extends Socket {
|
||||
|
||||
private Socket socket = null;
|
||||
|
||||
/* SOCKS related constants */
|
||||
|
||||
private static final int SOCKS_PROTO_VERS = 4;
|
||||
private static final int SOCKS_REPLY_VERS = 4;
|
||||
|
||||
private static final int COMMAND_CONNECT = 1;
|
||||
private static final int COMMAND_BIND = 2;
|
||||
|
||||
private static final int REQUEST_GRANTED = 90;
|
||||
private static final int REQUEST_REJECTED = 91;
|
||||
private static final int REQUEST_REJECTED_NO_IDENTD = 92;
|
||||
private static final int REQUEST_REJECTED_DIFF_IDENTS = 93;
|
||||
|
||||
public static final int socksDefaultPort = 1080;
|
||||
|
||||
InetAddress address = null;
|
||||
int port = -1;
|
||||
|
||||
/**
|
||||
* Creates a stream socket and connects it to the specified port
|
||||
* number on the named host using SOCKS.
|
||||
* <p>
|
||||
* If the application has specified a server socket factory, that
|
||||
* factory's <code>createSocketImpl</code> method is called to create
|
||||
* the actual socket implementation. Otherwise a "plain" socket is created.
|
||||
*
|
||||
* @param host the host name.
|
||||
* @param port the port number.
|
||||
* @param socksAddress the host name of the SOCKS server.
|
||||
* @param socksPort the port number of the SOCKS server.
|
||||
* @exception IOException if an I/O error occurs when creating the socket.
|
||||
* @since JDK1.0
|
||||
*/
|
||||
public SocksSocket(String host, int port, String socksAddress, int socksPort)
|
||||
throws UnknownHostException, IOException
|
||||
{
|
||||
this(InetAddress.getByName(host), port, InetAddress.getByName(socksAddress), socksPort);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a stream socket and connects it to the specified port
|
||||
* number at the specified IP address using SOCKS.
|
||||
* <p>
|
||||
* If the application has specified a socket factory, that factory's
|
||||
* <code>createSocketImpl</code> method is called to create the
|
||||
* actual socket implementation. Otherwise a "plain" socket is created.
|
||||
*
|
||||
* @param address the IP address.
|
||||
* @param port the port number.
|
||||
* @param socksAddress the IP address of the SOCKS server.
|
||||
* @param socksPort the port number of the SOCKS server.
|
||||
* @exception IOException if an I/O error occurs when creating the socket.
|
||||
* @since JDK1.0
|
||||
*/
|
||||
public SocksSocket(InetAddress address, int port, InetAddress socksAddress, int socksPort) throws IOException {
|
||||
connect(address, port, socksAddress, socksPort);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates a socket and connects it to the specified address on
|
||||
* the specified port using SOCKS v4.
|
||||
* @param address the address
|
||||
* @param port the specified port
|
||||
* @param socksAddress the address of the SOCKS proxy
|
||||
* @param socksPort the specified port of the SOCKS proxy
|
||||
*/
|
||||
private void connect(InetAddress address, int port, InetAddress socksAddress, int socksPort) throws IOException {
|
||||
|
||||
if (socksPort == -1)
|
||||
socksPort = socksDefaultPort;
|
||||
|
||||
this.address = address;
|
||||
this.port = port;
|
||||
|
||||
if (socksAddress != null)
|
||||
{
|
||||
socket = new Socket(socksAddress, socksPort);
|
||||
|
||||
/**
|
||||
* Connect to the SOCKS server using the SOCKS connection protocol.
|
||||
*/
|
||||
sendSOCKSCommandPacket(COMMAND_CONNECT, address, port);
|
||||
|
||||
int protoStatus = getSOCKSReply();
|
||||
|
||||
switch (protoStatus) {
|
||||
case REQUEST_GRANTED:
|
||||
// connection set up, return control to the socket client
|
||||
return;
|
||||
|
||||
case REQUEST_REJECTED:
|
||||
case REQUEST_REJECTED_NO_IDENTD:
|
||||
throw new SocketException("SOCKS server cannot conect to identd");
|
||||
|
||||
case REQUEST_REJECTED_DIFF_IDENTS:
|
||||
throw new SocketException("User name does not match identd name");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
socket = new Socket(address, port);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Read the response from the socks server. Return the result code.
|
||||
*/
|
||||
private int getSOCKSReply() throws IOException {
|
||||
InputStream in = getInputStream();
|
||||
byte response[] = new byte[8];
|
||||
int bytesReceived = 0;
|
||||
int len = response.length;
|
||||
|
||||
for (int attempts = 0; bytesReceived<len && attempts<3; attempts++) {
|
||||
int count = in.read(response, bytesReceived, len - bytesReceived);
|
||||
if (count < 0)
|
||||
throw new SocketException("Malformed reply from SOCKS server");
|
||||
bytesReceived += count;
|
||||
}
|
||||
|
||||
if (bytesReceived != len) {
|
||||
throw new SocketException("Reply from SOCKS server has bad length: " + bytesReceived);
|
||||
}
|
||||
|
||||
if (response[0] != 0) { // should be version0
|
||||
throw new SocketException("Reply from SOCKS server has bad version " + response[0]);
|
||||
}
|
||||
|
||||
return response[1]; // the response code
|
||||
}
|
||||
|
||||
/**
|
||||
* Just creates and sends out to the connected socket a SOCKS command
|
||||
* packet.
|
||||
*/
|
||||
private void sendSOCKSCommandPacket(int command, InetAddress address,
|
||||
int port) throws IOException {
|
||||
|
||||
byte commandPacket[] = makeCommandPacket(command, address, port);
|
||||
OutputStream out = getOutputStream();
|
||||
|
||||
out.write(commandPacket);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create and return a SOCKS V4 command packet.
|
||||
*/
|
||||
private byte[] makeCommandPacket(int command, InetAddress address,
|
||||
int port) {
|
||||
|
||||
// base packet size = 8, + 1 null byte
|
||||
ByteArrayOutputStream byteStream = new ByteArrayOutputStream(8 + 1);
|
||||
|
||||
byteStream.write(SOCKS_PROTO_VERS);
|
||||
byteStream.write(command);
|
||||
|
||||
|
||||
byteStream.write((port >> 8) & 0xff);
|
||||
byteStream.write((port >> 0) & 0xff);
|
||||
|
||||
byte addressBytes[] = address.getAddress();
|
||||
byteStream.write(addressBytes, 0, addressBytes.length);
|
||||
|
||||
String userName = (String) java.security.AccessController.doPrivileged(
|
||||
new sun.security.action.GetPropertyAction("user.name"));
|
||||
|
||||
byte userNameBytes[] = new byte[userName.length()];
|
||||
userName.getBytes(0, userName.length(), userNameBytes, 0);
|
||||
|
||||
byteStream.write(userNameBytes, 0, userNameBytes.length);
|
||||
byteStream.write(0); // null termination for user name
|
||||
|
||||
return byteStream.toByteArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the address to which the socket is connected.
|
||||
*
|
||||
* @return the remote IP address to which this socket is connected.
|
||||
* @since JDK1.0
|
||||
*/
|
||||
public InetAddress getInetAddress() {
|
||||
return address;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the local address to which the socket is bound.
|
||||
*
|
||||
* @since JDK1.1
|
||||
*/
|
||||
public InetAddress getLocalAddress() {
|
||||
return socket.getLocalAddress();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the remote port to which this socket is connected.
|
||||
*
|
||||
* @return the remote port number to which this socket is connected.
|
||||
* @since JDK1.0
|
||||
*/
|
||||
public int getPort() {
|
||||
return port;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the local port to which this socket is bound.
|
||||
*
|
||||
* @return the local port number to which this socket is connected.
|
||||
* @since JDK1.0
|
||||
*/
|
||||
public int getLocalPort() {
|
||||
return socket.getLocalPort();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an input stream for this socket.
|
||||
*
|
||||
* @return an input stream for reading bytes from this socket.
|
||||
* @exception IOException if an I/O error occurs when creating the
|
||||
* input stream.
|
||||
* @since JDK1.0
|
||||
*/
|
||||
public InputStream getInputStream() throws IOException {
|
||||
return socket.getInputStream();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an output stream for this socket.
|
||||
*
|
||||
* @return an output stream for writing bytes to this socket.
|
||||
* @exception IOException if an I/O error occurs when creating the
|
||||
* output stream.
|
||||
* @since JDK1.0
|
||||
*/
|
||||
public OutputStream getOutputStream() throws IOException {
|
||||
return socket.getOutputStream();
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable/disable TCP_NODELAY (disable/enable Nagle's algorithm).
|
||||
*
|
||||
* @since JDK1.1
|
||||
*/
|
||||
public void setTcpNoDelay(boolean on) throws SocketException {
|
||||
socket.setTcpNoDelay(on);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests if TCP_NODELAY is enabled.
|
||||
*
|
||||
* @since JDK1.1
|
||||
*/
|
||||
public boolean getTcpNoDelay() throws SocketException {
|
||||
return socket.getTcpNoDelay();
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable/disable SO_LINGER with the specified linger time.
|
||||
*
|
||||
* @since JDK1.1
|
||||
*/
|
||||
public void setSoLinger(boolean on, int val) throws SocketException {
|
||||
socket.setSoLinger(on, val);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns setting for SO_LINGER. -1 returns implies that the
|
||||
* option is disabled.
|
||||
*
|
||||
* @since JDK1.1
|
||||
*/
|
||||
public int getSoLinger() throws SocketException {
|
||||
return socket.getSoLinger();
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable/disable SO_TIMEOUT with the specified timeout, in
|
||||
* milliseconds. With this option set to a non-zero timeout,
|
||||
* a read() call on the InputStream associated with this Socket
|
||||
* will block for only this amount of time. If the timeout expires,
|
||||
* a <B>java.io.InterruptedIOException</B> is raised, though the
|
||||
* Socket is still valid. The option <B>must</B> be enabled
|
||||
* prior to entering the blocking operation to have effect. The
|
||||
* timeout must be > 0.
|
||||
* A timeout of zero is interpreted as an infinite timeout.
|
||||
*
|
||||
* @since JDK 1.1
|
||||
*/
|
||||
public synchronized void setSoTimeout(int timeout) throws SocketException {
|
||||
socket.setSoTimeout(timeout);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns setting for SO_TIMEOUT. 0 returns implies that the
|
||||
* option is disabled (i.e., timeout of infinity).
|
||||
*
|
||||
* @since JDK1.1
|
||||
*/
|
||||
public synchronized int getSoTimeout() throws SocketException {
|
||||
return socket.getSoTimeout();
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes this socket.
|
||||
*
|
||||
* @exception IOException if an I/O error occurs when closing this socket.
|
||||
* @since JDK1.0
|
||||
*/
|
||||
public synchronized void close() throws IOException {
|
||||
socket.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts this socket to a <code>String</code>.
|
||||
*
|
||||
* @return a string representation of this socket.
|
||||
* @since JDK1.0
|
||||
*/
|
||||
public String toString() {
|
||||
return "SocksSocket[addr=" + getInetAddress() +
|
||||
",port=" + getPort() +
|
||||
",localport=" + getLocalPort() + "]";
|
||||
}
|
||||
}
|
|
@ -1,294 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is The Waterfall Java Plugin Module
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* $Id: BrowserHttpsInputStream.java,v 1.1 2001/05/09 17:30:00 edburns%acm.org Exp $
|
||||
*
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
*/
|
||||
|
||||
/*
|
||||
* @(#)BrowserHttpsInputStream.java 1.2 00/04/27
|
||||
*
|
||||
* Copyright (c) 1996-1999 Sun Microsystems, Inc. All Rights Reserved.
|
||||
*
|
||||
* This software is the confidential and proprietary information of Sun
|
||||
* Microsystems, Inc. ("Confidential Information"). You shall not
|
||||
* disclose such Confidential Information and shall use it only in
|
||||
* accordance with the terms of the license agreement you entered into
|
||||
* with Sun.
|
||||
*
|
||||
* SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
|
||||
* SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES
|
||||
* SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
|
||||
* THIS SOFTWARE OR ITS DERIVATIVES.
|
||||
*
|
||||
* CopyrightVersion 1.0
|
||||
*/
|
||||
|
||||
package sun.jvmp.jpav.protocol.jdk12.https;
|
||||
|
||||
import java.net.URLConnection;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
/**
|
||||
* HTTPS URL input stream support. The intention here is to allow input from the
|
||||
* server to be flushed prior to being closed. The browser API is used for reading
|
||||
* https response input.
|
||||
*
|
||||
* @author R.H. Yang
|
||||
*/
|
||||
public
|
||||
class BrowserHttpsInputStream extends java.io.InputStream
|
||||
{
|
||||
// parent URLConnection
|
||||
|
||||
BrowserHttpsURLConnection urlConnection;
|
||||
|
||||
// seek pointer
|
||||
|
||||
long seekPos;
|
||||
|
||||
// "cookie" for native connection (handle/ptr/whatever)
|
||||
|
||||
long nativeConnection;
|
||||
|
||||
// stream state
|
||||
|
||||
boolean open;
|
||||
|
||||
|
||||
// Construct input stream attached to specified Https URL Connection
|
||||
|
||||
public BrowserHttpsInputStream( BrowserHttpsURLConnection uc )
|
||||
throws IOException {
|
||||
urlConnection = uc;
|
||||
openStream();
|
||||
open = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads the next byte of data from the input stream. The value byte is
|
||||
* returned as an <code>int</code> in the range <code>0</code> to
|
||||
* <code>255</code>. If no byte is available because the end of the stream
|
||||
* has been reached, the value <code>-1</code> is returned. This method
|
||||
* blocks until input data is available, the end of the stream is detected,
|
||||
* or an exception is thrown.
|
||||
*
|
||||
* <p> A subclass must provide an implementation of this method.
|
||||
*
|
||||
* @return the next byte of data, or <code>-1</code> if the end of the
|
||||
* stream is reached.
|
||||
* @exception IOException if an I/O error occurs.
|
||||
*/
|
||||
public synchronized int read() throws IOException {
|
||||
ensureOpen();
|
||||
|
||||
if ( 0 == nativeConnection )
|
||||
return -1;
|
||||
|
||||
|
||||
// Read from native code
|
||||
|
||||
int numRead = readStream( temp, 0, 1 );
|
||||
|
||||
if ( 1 == numRead ) {
|
||||
++seekPos;
|
||||
|
||||
return temp[0] & 0xff;
|
||||
} else {
|
||||
return numRead;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads up to <code>len</code> bytes of data from the input stream into
|
||||
* an array of bytes. An attempt is made to read as many as
|
||||
* <code>len</code> bytes, but a smaller number may be read, possibly
|
||||
* zero. The number of bytes actually read is returned as an integer.
|
||||
*
|
||||
* <p> This method blocks until input data is available, end of file is
|
||||
* detected, or an exception is thrown.
|
||||
*
|
||||
* <p> If <code>b</code> is <code>null</code>, a
|
||||
* <code>NullPointerException</code> is thrown.
|
||||
*
|
||||
* <p> If <code>off</code> is negative, or <code>len</code> is negative, or
|
||||
* <code>off+len</code> is greater than the length of the array
|
||||
* <code>b</code>, then an <code>IndexOutOfBoundsException</code> is
|
||||
* thrown.
|
||||
*
|
||||
* <p> If <code>len</code> is zero, then no bytes are read and
|
||||
* <code>0</code> is returned; otherwise, there is an attempt to read at
|
||||
* least one byte. If no byte is available because the stream is at end of
|
||||
* file, the value <code>-1</code> is returned; otherwise, at least one
|
||||
* byte is read and stored into <code>b</code>.
|
||||
*
|
||||
* <p> The first byte read is stored into element <code>b[off]</code>, the
|
||||
* next one into <code>b[off+1]</code>, and so on. The number of bytes read
|
||||
* is, at most, equal to <code>len</code>. Let <i>k</i> be the number of
|
||||
* bytes actually read; these bytes will be stored in elements
|
||||
* <code>b[off]</code> through <code>b[off+</code><i>k</i><code>-1]</code>,
|
||||
* leaving elements <code>b[off+</code><i>k</i><code>]</code> through
|
||||
* <code>b[off+len-1]</code> unaffected.
|
||||
*
|
||||
* <p> In every case, elements <code>b[0]</code> through
|
||||
* <code>b[off]</code> and elements <code>b[off+len]</code> through
|
||||
* <code>b[b.length-1]</code> are unaffected.
|
||||
*
|
||||
* <p> If the first byte cannot be read for any reason other than end of
|
||||
* file, then an <code>IOException</code> is thrown. In particular, an
|
||||
* <code>IOException</code> is thrown if the input stream has been closed.
|
||||
*
|
||||
* @param b the buffer into which the data is read.
|
||||
* @param off the start offset in array <code>b</code>
|
||||
* at which the data is written.
|
||||
* @param len the maximum number of bytes to read.
|
||||
* @return the total number of bytes read into the buffer, or
|
||||
* <code>-1</code> if there is no more data because the end of
|
||||
* the stream has been reached.
|
||||
* @exception IOException if an I/O error occurs.
|
||||
* @see java.io.InputStream#read()
|
||||
*/
|
||||
public synchronized int read(byte b[], int off, int len) throws IOException {
|
||||
ensureOpen();
|
||||
|
||||
// Check for boundary conditions
|
||||
|
||||
if (b == null) {
|
||||
throw new NullPointerException();
|
||||
} else if ((off < 0) || (off > b.length) || (len < 0) ||
|
||||
((off + len) > b.length) || ((off + len) < 0)) {
|
||||
throw new IndexOutOfBoundsException();
|
||||
} else if (len == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ( 0 == nativeConnection )
|
||||
return -1;
|
||||
|
||||
|
||||
// Read from native code
|
||||
|
||||
int numRead = readStream( b, off, len );
|
||||
|
||||
if ( numRead > 0 ) {
|
||||
seekPos += numRead;
|
||||
}
|
||||
|
||||
return ( numRead > 0 ? numRead : -1 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Skips n bytes of input.
|
||||
* @param n the number of bytes to skip
|
||||
* @return the actual number of bytes skipped.
|
||||
* @exception IOException If an I/O error has occurred.
|
||||
*/
|
||||
// (Stolen from SocketInputStream)
|
||||
public long skip(long numbytes) throws IOException {
|
||||
synchronized( this ) {
|
||||
ensureOpen();
|
||||
}
|
||||
|
||||
if (numbytes <= 0) {
|
||||
return 0;
|
||||
}
|
||||
long n = numbytes;
|
||||
int buflen = (int) Math.min(1024, n);
|
||||
byte data[] = new byte[buflen];
|
||||
while (n > 0) {
|
||||
int r = read(data, 0, (int) Math.min((long) buflen, n));
|
||||
if (r < 0) {
|
||||
break;
|
||||
}
|
||||
n -= r;
|
||||
}
|
||||
|
||||
synchronized( this ) {
|
||||
seekPos += ( numbytes - n );
|
||||
}
|
||||
return numbytes - n;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of bytes that can be read (or skipped over) from
|
||||
* this input stream without blocking by the next caller of a method for
|
||||
* this input stream. The next caller might be the same thread or or
|
||||
* another thread.
|
||||
*
|
||||
* @return the number of bytes that can be read from this input stream
|
||||
* without blocking.
|
||||
* @exception IOException if an I/O error occurs.
|
||||
*/
|
||||
public synchronized int available() throws IOException {
|
||||
ensureOpen();
|
||||
|
||||
return ( 0 == nativeConnection ? 0 : bytesAvailable() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes this input stream and releases any system resources associated
|
||||
* with the stream.
|
||||
*
|
||||
* @exception IOException if an I/O error occurs.
|
||||
*/
|
||||
public synchronized void close() throws IOException {
|
||||
if (this.open == true)
|
||||
{
|
||||
closeStream();
|
||||
this.open = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check to make sure that this stream has not been closed
|
||||
*/
|
||||
private void ensureOpen() throws IOException {
|
||||
if ( !this.open )
|
||||
throw new IOException("Stream closed");
|
||||
}
|
||||
|
||||
protected void finalize() {
|
||||
try {
|
||||
close();
|
||||
} catch( IOException e ) {
|
||||
}
|
||||
}
|
||||
|
||||
private byte temp[] = new byte[1]; // for single-byte reads
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// native implementation
|
||||
|
||||
private native void openStream() throws IOException;
|
||||
|
||||
private native int readStream( byte[] buf, int offs, int len )
|
||||
throws IOException;
|
||||
|
||||
private native int bytesAvailable() throws IOException;
|
||||
|
||||
private native void closeStream() throws IOException;
|
||||
}
|
||||
|
|
@ -1,134 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is The Waterfall Java Plugin Module
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* $Id: BrowserHttpsOutputStream.java,v 1.1 2001/05/09 17:30:00 edburns%acm.org Exp $
|
||||
*
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
*/
|
||||
|
||||
/*
|
||||
* @(#)BrowserHttpsOutputStream.java 1.5 00/04/27
|
||||
*
|
||||
* Copyright (c) 1996-1997 Sun Microsystems, Inc. All Rights Reserved.
|
||||
*
|
||||
* This software is the confidential and proprietary information of Sun
|
||||
* Microsystems, Inc. ("Confidential Information"). You shall not
|
||||
* disclose such Confidential Information and shall use it only in
|
||||
* accordance with the terms of the license agreement you entered into
|
||||
* with Sun.
|
||||
*
|
||||
* SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
|
||||
* SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES
|
||||
* SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
|
||||
* THIS SOFTWARE OR ITS DERIVATIVES.
|
||||
*
|
||||
* CopyrightVersion 1.0
|
||||
*/
|
||||
|
||||
package sun.jvmp.jpav.protocol.jdk12.https;
|
||||
|
||||
import java.net.URLConnection;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
|
||||
/**
|
||||
* HTTPS URL POST support. This class buffers all the output stream
|
||||
* until the stream is closed, then it will do a POST on the web
|
||||
* server through the browser API.
|
||||
*
|
||||
* @author Stanley Man-Kit Ho
|
||||
*/
|
||||
public
|
||||
class BrowserHttpsOutputStream extends java.io.ByteArrayOutputStream
|
||||
{
|
||||
// URLConnection of the HTTPS connection.
|
||||
BrowserHttpsURLConnection urlConnection = null;
|
||||
|
||||
// Determine if the HTTPS output stream has been closed.
|
||||
private boolean bConnected = false;
|
||||
|
||||
/**
|
||||
* <P> Create BrowserHttpsOutputStream object.
|
||||
* </P>
|
||||
*
|
||||
* @param url URL of the HTTPS connection.
|
||||
*/
|
||||
public BrowserHttpsOutputStream(BrowserHttpsURLConnection urlConnection)
|
||||
{
|
||||
super();
|
||||
this.urlConnection = urlConnection;
|
||||
this.bConnected = true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* <P> Create BrowserHttpsOutputStream object.
|
||||
* </P>
|
||||
*
|
||||
* @param url URL of the HTTPS connection.
|
||||
* @param size Size of the output stream buffer.
|
||||
*/
|
||||
public BrowserHttpsOutputStream(BrowserHttpsURLConnection urlConnection, int size)
|
||||
{
|
||||
super(size);
|
||||
this.urlConnection = urlConnection;
|
||||
this.bConnected = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* <P> Closes this output stream.
|
||||
* </P>
|
||||
*/
|
||||
public synchronized void close() throws IOException
|
||||
{
|
||||
// Make sure the stream has not been closed multiple times
|
||||
if (bConnected)
|
||||
{
|
||||
bConnected = false;
|
||||
super.close();
|
||||
|
||||
byte[] postResponse;
|
||||
byte[] buf = toByteArray();
|
||||
|
||||
if (buf == null)
|
||||
postResponse = postHttpsURL(urlConnection, urlConnection.getURL().toString(), null, 0);
|
||||
else
|
||||
postResponse = postHttpsURL(urlConnection, urlConnection.getURL().toString(), buf, buf.length);
|
||||
|
||||
if (urlConnection.getDoInput()) {
|
||||
urlConnection.postResponse = postResponse;
|
||||
urlConnection.postResponseReady = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* <P> Native code to call back into the browser to do a POST.
|
||||
* </P>
|
||||
*
|
||||
* @param url URL of the HTTPS connection
|
||||
* @param buf Data to post.
|
||||
*/
|
||||
private native byte[] postHttpsURL(URLConnection urlConnection, String url, byte[] buf, int length);
|
||||
}
|
|
@ -1,378 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is The Waterfall Java Plugin Module
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* $Id: BrowserHttpsURLConnection.java,v 1.1 2001/05/09 17:30:00 edburns%acm.org Exp $
|
||||
*
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
*/
|
||||
|
||||
package sun.jvmp.jpav.protocol.jdk12.https;
|
||||
|
||||
import java.net.*;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.PrintStream;
|
||||
import sun.net.www.http.*;
|
||||
import sun.net.www.MessageHeader;
|
||||
import sun.net.www.protocol.http.*;
|
||||
import java.util.Date;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.TimeZone;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.BufferedInputStream;
|
||||
import java.security.*;
|
||||
import java.security.Permission;
|
||||
import java.net.SocketPermission;
|
||||
|
||||
|
||||
public
|
||||
class BrowserHttpsURLConnection extends java.net.URLConnection
|
||||
{
|
||||
/*
|
||||
* Message Headers hold the request and response headers send along
|
||||
* this HTTP request. This is currently available only in all IE version
|
||||
*/
|
||||
private MessageHeader responseHeaders = null;
|
||||
private MessageHeader requestHeaders = null;
|
||||
|
||||
/*
|
||||
* Native object reference
|
||||
*/
|
||||
private long nativeConnection = 0;
|
||||
|
||||
/*
|
||||
* Initialize an HTTPS URLConnection ... could check that the URL
|
||||
* is an "https" URL, and that the handler is also an HTTPS one,
|
||||
* but that's established by other code in this package.
|
||||
*/
|
||||
|
||||
public Permission getPermission() throws IOException {
|
||||
int port = url.getPort();
|
||||
port = port < 0 ? 80 : port;
|
||||
String host = url.getHost() + ":" + port;
|
||||
Permission permission = new SocketPermission(host, "connect");
|
||||
return permission;
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize an HTTPS URLConnection ... could check that the URL
|
||||
* is an "https" URL, and that the handler is also an HTTPS one,
|
||||
* but that's established by other code in this package.
|
||||
*/
|
||||
public BrowserHttpsURLConnection (URL url) throws IOException {
|
||||
super (url);
|
||||
}
|
||||
/**
|
||||
* Implements the HTTP protocol handler's "connect" method,
|
||||
* establishing an SSL connection to the server as necessary.
|
||||
*/
|
||||
public synchronized void connect () throws IOException {
|
||||
if (connected)
|
||||
return;
|
||||
|
||||
// Check whether the applet is allowed to connect to the host.
|
||||
// This is necessary because we will enable privilege to
|
||||
// connect to the proxy
|
||||
SecurityManager m = System.getSecurityManager();
|
||||
if (m != null) {
|
||||
m.checkConnect(url.getHost(), url.getPort());
|
||||
}
|
||||
|
||||
// Add the necessary headers if necessary
|
||||
java.security.AccessController.doPrivileged(new PrivilegedAction() {
|
||||
public Object run() {
|
||||
packageRequestHeaders();
|
||||
return null;
|
||||
}
|
||||
});
|
||||
connected = true;
|
||||
}
|
||||
|
||||
/*
|
||||
* @return the raw request headers for this URL connection
|
||||
*
|
||||
*/
|
||||
private byte[] getRequestHeaders() {
|
||||
|
||||
// Send the request headers
|
||||
byte[] rawRequestHeaders = null;
|
||||
if (requestHeaders!=null) {
|
||||
ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
||||
PrintStream ps = new PrintStream(bos);
|
||||
requestHeaders.print(ps);
|
||||
ps.flush();
|
||||
rawRequestHeaders = bos.toByteArray();
|
||||
}
|
||||
return rawRequestHeaders;
|
||||
}
|
||||
|
||||
/*
|
||||
* <p>
|
||||
* Sets the response headers from this URLConnection
|
||||
* </p>
|
||||
*
|
||||
* @param rawResponseHeaders Response headers
|
||||
*/
|
||||
private void setResponseHeaders(byte[] rawResponseHeaders) {
|
||||
|
||||
// Extract the response headers
|
||||
if (rawResponseHeaders!=null) {
|
||||
ByteArrayInputStream bis =
|
||||
new ByteArrayInputStream(rawResponseHeaders);
|
||||
try {
|
||||
responseHeaders = new MessageHeader(bis);
|
||||
} catch(IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Package the necessary request headers for this connection
|
||||
* </p>
|
||||
*
|
||||
* @param mh MessageHeader that will contain all the request headers
|
||||
*
|
||||
*/
|
||||
protected void packageRequestHeaders() {
|
||||
|
||||
// Set the if modified since flag
|
||||
if (getIfModifiedSince()!=0) {
|
||||
TimeZone tz = TimeZone.getTimeZone("GMT");
|
||||
Date modTime = new Date(getIfModifiedSince());
|
||||
SimpleDateFormat df = new SimpleDateFormat();
|
||||
df.setTimeZone(tz);
|
||||
setRequestProperty("If-Modified-Since", df.format(modTime));
|
||||
}
|
||||
setRequestPropertyIfNotSet("Content-Type", "application/x-www-form-urlencoded");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value of the specified header field. Names of
|
||||
* header fields to pass to this method can be obtained from
|
||||
* getHeaderFieldKey.
|
||||
*
|
||||
* @param name the name of a header field.
|
||||
* @return the value of the named header field, or <code>null</code>
|
||||
* if there is no such field in the header.
|
||||
* @see java.net.URLConnection#getHeaderFieldKey(int)
|
||||
* @since JDK1.0
|
||||
*/
|
||||
public String getHeaderField(String name) {
|
||||
if (responseHeaders!=null)
|
||||
return responseHeaders.findValue(name);
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the key for the <code>n</code><sup>th</sup> header field.
|
||||
*
|
||||
* @param n an index.
|
||||
* @return the key for the <code>n</code><sup>th</sup> header field,
|
||||
* or <code>null</code> if there are fewer than <code>n</code>
|
||||
* fields.
|
||||
* @since JDK1.0
|
||||
*/
|
||||
public String getHeaderFieldKey(int n) {
|
||||
if (responseHeaders!=null)
|
||||
return responseHeaders.getKey(n);
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value for the <code>n</code><sup>th</sup> header field.
|
||||
* It returns <code>null</code> if there are fewer than
|
||||
* <code>n</code> fields.
|
||||
* <p>
|
||||
* This method can be used in conjunction with the
|
||||
* <code>getHeaderFieldKey</code> method to iterate through all
|
||||
* the headers in the message.
|
||||
*
|
||||
* @param n an index.
|
||||
* @return the value of the <code>n</code><sup>th</sup> header field.
|
||||
* @see java.net.URLConnection#getHeaderFieldKey(int)
|
||||
* @since JDK1.0
|
||||
*/
|
||||
public String getHeaderField(int n) {
|
||||
if (responseHeaders!=null)
|
||||
return responseHeaders.getValue(n);
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the general request property.
|
||||
*
|
||||
* @param key the keyword by which the request is known
|
||||
* (e.g., "<code>accept</code>").
|
||||
* @param value the value associated with it.
|
||||
*/
|
||||
public synchronized void setRequestProperty(String key, String value) {
|
||||
if (connected)
|
||||
throw new IllegalAccessError("Already connected");
|
||||
// Create the requests holder if necessary
|
||||
if (requestHeaders==null) {
|
||||
requestHeaders= new MessageHeader();
|
||||
}
|
||||
requestHeaders.set(key, value);
|
||||
}
|
||||
|
||||
public synchronized void setRequestPropertyIfNotSet(String key, String value
|
||||
) {
|
||||
if (connected)
|
||||
throw new IllegalAccessError("Already connected");
|
||||
|
||||
// Create the requests holder if necessary
|
||||
if (requestHeaders==null) {
|
||||
requestHeaders= new MessageHeader();
|
||||
}
|
||||
requestHeaders.setIfNotSet(key, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value of the named general request property for this
|
||||
* connection.
|
||||
*
|
||||
* @return the value of the named general request property for this
|
||||
* connection.
|
||||
*/
|
||||
public String getRequestProperty(String key) {
|
||||
if (connected)
|
||||
throw new IllegalAccessError("Already connected");
|
||||
|
||||
if (requestHeaders!=null)
|
||||
return requestHeaders.findValue(key);
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an input stream that reads from this open connection.
|
||||
*
|
||||
* @return an input stream that reads from this open connection.
|
||||
* @exception IOException if an I/O error occurs while
|
||||
* creating the input stream.
|
||||
* @exception UnknownServiceException if the protocol does not support
|
||||
* input.
|
||||
* @since JDK1.0
|
||||
*/
|
||||
public InputStream getInputStream() throws IOException
|
||||
{
|
||||
if (!doInput)
|
||||
throw new ProtocolException("Cannot read from URLConnection"
|
||||
+ " if doInput=false (call setDoInput(true))");
|
||||
|
||||
if (!connected)
|
||||
connect();
|
||||
|
||||
if (ins == null)
|
||||
{
|
||||
byte buffer[] = null;
|
||||
|
||||
// If we are in input/output mode, we might just want the response
|
||||
// from a POST.
|
||||
if (doOutput) {
|
||||
if (!postResponseReady)
|
||||
throw new UnknownServiceException("Input from HTTPS not expected until OutputStream is closed");
|
||||
|
||||
buffer = postResponse;
|
||||
postResponse=null;
|
||||
|
||||
// If null comes back then probably the URL wasn't found.
|
||||
|
||||
if ( null == buffer )
|
||||
throw new FileNotFoundException( getURL().toString() );
|
||||
|
||||
ins = new ByteArrayInputStream( buffer );
|
||||
} else {
|
||||
ins = new BufferedInputStream( new BrowserHttpsInputStream( this
|
||||
) );
|
||||
}
|
||||
|
||||
// Check if we have response headers, if we don't we are going to
|
||||
// enter some heuristic values for the headers we can
|
||||
if (responseHeaders == null)
|
||||
responseHeaders = new MessageHeader();
|
||||
|
||||
String contentType= getHeaderField("Content-Type");
|
||||
|
||||
if (contentType==null) {
|
||||
try {
|
||||
contentType = guessContentTypeFromStream(ins);
|
||||
} catch(java.io.IOException e) {
|
||||
}
|
||||
if (contentType == null) {
|
||||
if (url.getFile().endsWith("/")) {
|
||||
contentType = "text/html";
|
||||
} else {
|
||||
contentType = guessContentTypeFromName(url.getFile());
|
||||
}
|
||||
if (contentType == null)
|
||||
contentType = "content/unknown";
|
||||
}
|
||||
responseHeaders.add("Content-Type", contentType);
|
||||
}
|
||||
|
||||
if ( null != buffer )
|
||||
responseHeaders.setIfNotSet("Content-Length",String.valueOf(buffer.length));
|
||||
}
|
||||
|
||||
return ins;
|
||||
}
|
||||
|
||||
InputStream ins = null;
|
||||
|
||||
OutputStream outs = null;
|
||||
|
||||
/**
|
||||
* Returns an output stream that writes to this connection.
|
||||
*
|
||||
* @return an output stream that writes to this connection.
|
||||
* @exception IOException if an I/O error occurs while
|
||||
* creating the output stream.
|
||||
* @exception UnknownServiceException if the protocol does not support
|
||||
* output.
|
||||
* @since JDK1.0
|
||||
*/
|
||||
public OutputStream getOutputStream() throws IOException {
|
||||
|
||||
if (!doOutput)
|
||||
throw new ProtocolException("cannot write to a URLConnection"
|
||||
+ " if doOutput=false - call setDoOutput(true)");
|
||||
|
||||
if (ins!=null)
|
||||
throw new ProtocolException("Cannot write output after reading input.");
|
||||
|
||||
if (!connected)
|
||||
connect();
|
||||
|
||||
if (outs == null)
|
||||
outs = new BrowserHttpsOutputStream(this);
|
||||
|
||||
return outs;
|
||||
}
|
||||
|
||||
|
||||
byte[] postResponse = null;
|
||||
boolean postResponseReady = false;
|
||||
}
|
|
@ -1,84 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is The Waterfall Java Plugin Module
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* $Id: Handler.java,v 1.1 2001/05/09 17:30:00 edburns%acm.org Exp $
|
||||
*
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
*/
|
||||
|
||||
/*
|
||||
* @(#)Handler.java 1.44 96/11/24
|
||||
*
|
||||
* Copyright (c) 1995, 1996 Sun Microsystems, Inc. All Rights Reserved.
|
||||
*
|
||||
* This software is the confidential and proprietary information of Sun
|
||||
* Microsystems, Inc. ("Confidential Information"). You shall not
|
||||
* disclose such Confidential Information and shall use it only in
|
||||
* accordance with the terms of the license agreement you entered into
|
||||
* with Sun.
|
||||
*
|
||||
* SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
|
||||
* SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES
|
||||
* SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
|
||||
* THIS SOFTWARE OR ITS DERIVATIVES.
|
||||
*
|
||||
* CopyrightVersion 1.3
|
||||
*
|
||||
* Java Plug-in
|
||||
*
|
||||
* @author Jerome Dochez
|
||||
*/
|
||||
|
||||
/*-
|
||||
* HTTP stream opener
|
||||
*/
|
||||
|
||||
package sun.jvmp.jpav.protocol.jdk12.https;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
|
||||
/** open an http input stream given a URL */
|
||||
public class Handler extends sun.jvmp.jpav.protocol.jdk12.http.Handler {
|
||||
|
||||
/*
|
||||
* <p>
|
||||
* Delegate to the Https connection
|
||||
* </p>
|
||||
*/
|
||||
public java.net.URLConnection openConnection(URL u) throws IOException {
|
||||
|
||||
/* for now, SSL export is legal, so this extension can be presented */
|
||||
/*
|
||||
try {
|
||||
// Try if SSL extension is installed.
|
||||
Class sslSession = Class.forName("javax.net.ssl.SSLSession");
|
||||
return new HttpsURLConnection(u, this);
|
||||
}
|
||||
catch (Throwable e) {
|
||||
// else use browser HTTPS support.
|
||||
return new BrowserHttpsURLConnection(u);
|
||||
} */
|
||||
return new BrowserHttpsURLConnection(u);
|
||||
}
|
||||
}
|
|
@ -1,47 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is The Waterfall Java Plugin Module
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* $Id: Handler.java,v 1.1 2001/05/09 17:30:00 edburns%acm.org Exp $
|
||||
*
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
*/
|
||||
|
||||
/*
|
||||
* @(#)Handler.java 1.1 99/08/17
|
||||
*
|
||||
* Copyright © 1999 by Sun Microsystems, Inc.,
|
||||
* 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is the confidential and proprietary information
|
||||
* of Sun Microsystems, Inc. ("Confidential Information"). You
|
||||
* shall not disclose such Confidential Information and shall use
|
||||
* it only in accordance with the terms of the license agreement
|
||||
* you entered into with Sun.
|
||||
*/
|
||||
|
||||
package sun.jvmp.jpav.protocol.jdk12.jar;
|
||||
|
||||
/*
|
||||
* Jar URL Handler for plugin
|
||||
*/
|
||||
public class Handler extends sun.net.www.protocol.jar.Handler {
|
||||
}
|
|
@ -1,265 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is The Waterfall Java Plugin Module
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* $Id: MozillaAppletPeer.java,v 1.1 2001/05/09 17:30:00 edburns%acm.org Exp $
|
||||
*
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
*/
|
||||
|
||||
package sun.jvmp.mozilla;
|
||||
|
||||
import sun.jvmp.*;
|
||||
import sun.jvmp.security.*;
|
||||
import sun.jvmp.applet.*;
|
||||
import java.util.Hashtable;
|
||||
import java.net.URL;
|
||||
import java.net.MalformedURLException;
|
||||
import java.applet.*;
|
||||
import java.awt.Frame;
|
||||
|
||||
public class MozillaAppletPeer extends WFAppletContext
|
||||
implements HostObjectPeer, sun.jvmp.javascript.JSContext
|
||||
{
|
||||
private int m_id;
|
||||
private int m_winid;
|
||||
private long m_params = 0;
|
||||
MozillaPeerFactory m_factory;
|
||||
WFAppletViewer m_viewer = null;
|
||||
private boolean m_stopped = true;
|
||||
protected JSObject m_js = null;
|
||||
PluggableJVM jvm;
|
||||
|
||||
MozillaAppletPeer(MozillaHostObjectPeer fake, int id)
|
||||
{
|
||||
m_factory = fake.m_factory;;
|
||||
jvm = m_factory.m_jvm;
|
||||
jvm.trace("CREATED APPLET OBJECT: "+this,
|
||||
PluggableJVM.LOG_DEBUG);
|
||||
m_id = id;
|
||||
m_winid = 0;
|
||||
}
|
||||
|
||||
public int getID()
|
||||
{
|
||||
return m_id;
|
||||
}
|
||||
|
||||
public void setID(int id)
|
||||
{
|
||||
if (m_id != 0) return;
|
||||
m_id = id;
|
||||
}
|
||||
public int handleEvent(SecurityCaps caps, int eventID, long eventData)
|
||||
{
|
||||
int retval = 0;
|
||||
//jvm.trace("GOT EVENT "+eventID+"!!!");
|
||||
switch (eventID)
|
||||
{
|
||||
case PE_CREATE:
|
||||
retval = 1;
|
||||
break;
|
||||
case PE_SETTYPE:
|
||||
jvm.trace("SETTYPE called twice - IGNORED",
|
||||
PluggableJVM.LOG_WARNING);
|
||||
retval = 1;
|
||||
break;
|
||||
case PE_SETWINDOW:
|
||||
jvm.trace("PE_SETWINDOW", PluggableJVM.LOG_DEBUG);
|
||||
m_winid = (int)eventData;
|
||||
retval = handleSetWindow();
|
||||
break;
|
||||
case PE_NEWPARAMS:
|
||||
m_params = eventData;
|
||||
retval = handleNewParams();
|
||||
break;
|
||||
case PE_DESTROY:
|
||||
retval = destroy(caps);
|
||||
break;
|
||||
case PE_STOP:
|
||||
retval = 1;
|
||||
// do it before stop, as after we can't be sure
|
||||
// our browser peer is still alive
|
||||
m_stopped = true;
|
||||
if (m_viewer != null) m_viewer.stopApplet();
|
||||
break;
|
||||
case PE_START:
|
||||
retval = 1;
|
||||
m_stopped = false;
|
||||
m_viewer.startApplet();
|
||||
break;
|
||||
case PE_GETPEER:
|
||||
// this call is handled in both ways - direct and
|
||||
// queued as policy on place where to handle
|
||||
// JS calls can be changed on Mozilla side
|
||||
// At least for now it works OK with both cases
|
||||
retval = handleCall(caps, PE_GETPEER, eventData);
|
||||
break;
|
||||
default:
|
||||
retval = 0;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
public int handleCall(SecurityCaps caps, int arg1, long arg2)
|
||||
{
|
||||
int retval = 0;
|
||||
switch (arg1)
|
||||
{
|
||||
case PE_GETPEER:
|
||||
if (m_viewer == null) break;
|
||||
Object o = null;
|
||||
switch (m_viewer.getLoadingStatus())
|
||||
{
|
||||
case sun.applet.AppletPanel.APPLET_START:
|
||||
o = m_viewer.getApplet();
|
||||
break;
|
||||
case sun.applet.AppletPanel.APPLET_ERROR:
|
||||
o = null;
|
||||
break;
|
||||
default:
|
||||
jvm.trace("XXX: Applet loading in progress....",
|
||||
PluggableJVM.LOG_WARNING);
|
||||
// here we just return NULL, as for the moment no valid
|
||||
// applet object exist - if someone really needs this
|
||||
// object - call later
|
||||
break;
|
||||
}
|
||||
nativeReturnJObject(o, arg2);
|
||||
retval = 1;
|
||||
break;
|
||||
default:
|
||||
retval = 0;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
public int destroy(SecurityCaps caps)
|
||||
{
|
||||
jvm.trace("DESTROY", PluggableJVM.LOG_DEBUG);
|
||||
finalizeParams();
|
||||
m_params = 0;
|
||||
m_stopped = true;
|
||||
if (m_viewer != null) {
|
||||
m_viewer.destroyApplet(2500);
|
||||
m_viewer = null;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
public HostObjectPeerFactory getFactory()
|
||||
{
|
||||
return m_factory;
|
||||
}
|
||||
|
||||
private int handleNewParams()
|
||||
{
|
||||
String[][] params = getParams();
|
||||
String[] keys = params[0];
|
||||
String[] vals = params[1];
|
||||
URL docbase;
|
||||
Hashtable hparams = new Hashtable();
|
||||
for (int i=0; i < keys.length; i++)
|
||||
hparams.put(keys[i].toLowerCase(), vals[i]);
|
||||
//hparams.put("OWNER", this);
|
||||
//hparams.put("ID", new Integer(m_id));
|
||||
try
|
||||
{
|
||||
docbase = new URL((String)hparams.get("docbase"));
|
||||
}
|
||||
catch (MalformedURLException e)
|
||||
{
|
||||
jvm.trace("invalid docbase due "+e,
|
||||
PluggableJVM.LOG_ERROR);
|
||||
return 0;
|
||||
}
|
||||
m_viewer = m_factory.m_mgr.createAppletViewer(this,
|
||||
m_factory,
|
||||
hparams);
|
||||
m_viewer.setDocumentBase(docbase);
|
||||
return handleSetWindow();
|
||||
}
|
||||
|
||||
private int handleSetWindow()
|
||||
{
|
||||
if (m_stopped) return 0;
|
||||
if (m_winid != 0) {
|
||||
Frame f = jvm.getFrameWithId(m_winid);
|
||||
if (f != null) m_viewer.setWindow(f);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
/**
|
||||
* From AppletContext
|
||||
*/
|
||||
public void showStatus(String string)
|
||||
{
|
||||
//PluggableJVM.trace("Status: "+string);
|
||||
// calls back peer in Mozilla
|
||||
if (m_stopped) return;
|
||||
nativeShowStatus(string);
|
||||
}
|
||||
|
||||
public void showDocument(URL url, String target)
|
||||
{
|
||||
// never pass events after stop() - otherwise
|
||||
// we'll crash the browser
|
||||
if (m_stopped) return;
|
||||
// calls back peer in Mozilla
|
||||
nativeShowDocument(url.toString(), target);
|
||||
}
|
||||
|
||||
public void showDocument(URL url)
|
||||
{
|
||||
showDocument(url, "_top");
|
||||
}
|
||||
|
||||
/**
|
||||
* From JSContext
|
||||
*/
|
||||
public netscape.javascript.JSObject getJSObject()
|
||||
{
|
||||
// check if we got params from browser - fail otherwise
|
||||
if (m_params == 0) return null;
|
||||
if (m_js == null)
|
||||
m_js = new sun.jvmp.mozilla.JSObject(m_params);
|
||||
return m_js;
|
||||
}
|
||||
// duplicates of nsIJavaObjectInfo methods
|
||||
// funny way to return 2 arrays of strings
|
||||
native protected String[][] getParams();
|
||||
native protected void finalizeParams();
|
||||
native protected boolean nativeShowStatus(String status);
|
||||
native protected boolean nativeShowDocument(String url,
|
||||
String target);
|
||||
// method to write jobject ret to native pointer ptr
|
||||
native protected void nativeReturnJObject(Object ret, long ptr);
|
||||
// XXX: add others
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,107 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is The Waterfall Java Plugin Module
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* $Id: MozillaHostObjectPeer.java,v 1.1 2001/05/09 17:30:00 edburns%acm.org Exp $
|
||||
*
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
*/
|
||||
|
||||
package sun.jvmp.mozilla;
|
||||
|
||||
import sun.jvmp.*;
|
||||
import sun.jvmp.security.*;
|
||||
|
||||
public class MozillaHostObjectPeer implements HostObjectPeer
|
||||
{
|
||||
private int m_id = 0;
|
||||
private long m_data = 0;
|
||||
private HostObjectPeer m_realPeer = null;
|
||||
MozillaPeerFactory m_factory = null;
|
||||
|
||||
public MozillaHostObjectPeer(MozillaPeerFactory factory, int version)
|
||||
{
|
||||
m_factory = factory;
|
||||
}
|
||||
|
||||
public int getID()
|
||||
{
|
||||
return m_id;
|
||||
}
|
||||
|
||||
public void setID(int id)
|
||||
{
|
||||
if (m_id != 0) return;
|
||||
m_id = id;
|
||||
}
|
||||
|
||||
public int handleEvent(SecurityCaps caps, int eventID, long eventData)
|
||||
{
|
||||
int retval = 0;
|
||||
// forward functionality to the real peer
|
||||
if (m_realPeer != null)
|
||||
return m_realPeer.handleEvent(caps, eventID, eventData);
|
||||
switch (eventID)
|
||||
{
|
||||
case PE_CREATE:
|
||||
retval = 1;
|
||||
break;
|
||||
case PE_SETTYPE:
|
||||
switch((int)eventData)
|
||||
{
|
||||
case PT_APPLET:
|
||||
case PT_OBJECT:
|
||||
m_realPeer = new MozillaAppletPeer(this, m_id);
|
||||
// maybe send CREATE event from here?
|
||||
retval = 1;
|
||||
break;
|
||||
default:
|
||||
m_factory.m_jvm.trace("Unknown tag type",
|
||||
PluggableJVM.LOG_WARNING);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
retval = 0;
|
||||
break;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
public int destroy(SecurityCaps caps)
|
||||
{
|
||||
if (m_realPeer != null)
|
||||
return m_realPeer.destroy(caps);
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int handleCall(SecurityCaps caps, int arg1, long arg2)
|
||||
{
|
||||
if (m_realPeer != null)
|
||||
return m_realPeer.handleCall(caps, arg1, arg2);
|
||||
return 0;
|
||||
}
|
||||
|
||||
public HostObjectPeerFactory getFactory()
|
||||
{
|
||||
return m_factory;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -1,237 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is The Waterfall Java Plugin Module
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* $Id: MozillaPeerFactory.java,v 1.1 2001/05/09 17:30:00 edburns%acm.org Exp $
|
||||
*
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
*/
|
||||
|
||||
package sun.jvmp.mozilla;
|
||||
|
||||
import sun.jvmp.*;
|
||||
import sun.jvmp.security.*;
|
||||
import sun.jvmp.applet.*;
|
||||
import java.net.*;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.*;
|
||||
import java.security.*;
|
||||
|
||||
public class MozillaPeerFactory implements HostObjectPeerFactory,
|
||||
AccessControlDecider,
|
||||
BrowserSupport
|
||||
{
|
||||
protected final String cid = "@sun.com/wf/mozilla/appletpeer;1";
|
||||
protected final int version = 1;
|
||||
PluggableJVM m_jvm = null;
|
||||
protected long m_params = 0;
|
||||
protected int m_id;
|
||||
private static boolean initialized = false;
|
||||
protected URL[] m_codebase;
|
||||
AppletManager m_mgr;
|
||||
|
||||
protected MozillaPeerFactory(PluggableJVM jvm, long data)
|
||||
throws Exception
|
||||
{
|
||||
loadLibrary();
|
||||
m_jvm = jvm;
|
||||
m_params = data;
|
||||
/* as we could load only one factory, this will allow
|
||||
generic operations, like JS evaluation, to be performed without
|
||||
any applets at all */
|
||||
JSObject.m_evaluator = data;
|
||||
m_mgr = new AppletManager(jvm);
|
||||
try {
|
||||
m_codebase = null;
|
||||
URLClassLoader cl =
|
||||
(URLClassLoader)this.getClass().getClassLoader();
|
||||
if (cl != null) m_codebase = cl.getURLs();
|
||||
} catch (ClassCastException e) {
|
||||
// do nothing here
|
||||
}
|
||||
System.setSecurityManager(new MozillaSecurityManager());
|
||||
}
|
||||
|
||||
public static HostObjectPeerFactory start(PluggableJVM jvm, Long data)
|
||||
{
|
||||
MozillaPeerFactory factory = null;
|
||||
try {
|
||||
factory = new MozillaPeerFactory(jvm, data.longValue());
|
||||
} catch (Exception e) {
|
||||
jvm.trace("MOZILLA FACTORY NOT CREATED", PluggableJVM.LOG_ERROR);
|
||||
return null;
|
||||
}
|
||||
return factory;
|
||||
}
|
||||
|
||||
public String getCID()
|
||||
{
|
||||
return cid;
|
||||
}
|
||||
|
||||
public HostObjectPeer create(int version)
|
||||
{
|
||||
return new MozillaHostObjectPeer(this, version);
|
||||
}
|
||||
|
||||
public int handleEvent(SecurityCaps caps,
|
||||
int eventID,
|
||||
long eventData)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
private native int nativeHandleCall(int arg1, long arg2);
|
||||
|
||||
public int handleCall(SecurityCaps caps, int arg1, long arg2)
|
||||
{
|
||||
int rv = 0;
|
||||
if (arg1 > 0)
|
||||
rv = nativeHandleCall(arg1, arg2);
|
||||
else
|
||||
rv = 1;
|
||||
return rv;
|
||||
}
|
||||
|
||||
public int destroy(SecurityCaps caps)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
public PermissionCollection getPermissions(CodeSource codesource)
|
||||
{
|
||||
Permissions perms = new Permissions();
|
||||
URL location = codesource.getLocation();
|
||||
if (m_codebase != null && location != null) {
|
||||
for (int i=0; i<m_codebase.length; i++)
|
||||
{
|
||||
// XXX: maybe I'm totally wrong here
|
||||
if (location.equals(m_codebase[i]))
|
||||
{
|
||||
PluggableJVM.trace("extension granted all permissions to own codesource "+codesource,
|
||||
PluggableJVM.LOG_WARNING);
|
||||
perms.add(new java.security.AllPermission());
|
||||
return perms;
|
||||
}
|
||||
}
|
||||
}
|
||||
perms.add(new RuntimePermission("accessClassInPackage.sun.jvmp.mozilla"));
|
||||
return perms;
|
||||
}
|
||||
|
||||
private void loadLibrary() throws UnsatisfiedLinkError
|
||||
{
|
||||
String libname = "wf_moz6";
|
||||
try
|
||||
{
|
||||
System.loadLibrary(libname);
|
||||
}
|
||||
catch (UnsatisfiedLinkError ex)
|
||||
{
|
||||
PluggableJVM.trace("System could not load DLL: " + libname,
|
||||
PluggableJVM.LOG_ERROR);
|
||||
PluggableJVM.trace("Path is:" +
|
||||
System.getProperty("java.library.path"),
|
||||
PluggableJVM.LOG_WARNING);
|
||||
PluggableJVM.trace(ex.toString(),
|
||||
PluggableJVM.LOG_WARNING);
|
||||
throw ex;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* AccessControlDecider methods
|
||||
*/
|
||||
public int decide(CallingContext ctx, String principal, int cap_no)
|
||||
{
|
||||
return NA;
|
||||
}
|
||||
|
||||
public boolean belongs(int cap_no)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* BrowserSupport methods
|
||||
*/
|
||||
public ProxyInfo getProxyInfoForURL(URL url)
|
||||
{
|
||||
String s = nativeGetProxyInfoForURL(url.toString());
|
||||
//m_jvm.trace("Proxy string for:\""+
|
||||
//url.toString() +"\" is \""+s+"\"",
|
||||
//PluggableJVM.LOG_DEBUG);
|
||||
ProxyInfo info = extractAutoProxySetting(s);
|
||||
return info;
|
||||
}
|
||||
|
||||
public URLConnection getConnectionForURL(URL url)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
private native String nativeGetProxyInfoForURL(String s);
|
||||
private ProxyInfo extractAutoProxySetting(String s)
|
||||
{
|
||||
if (s != null)
|
||||
{
|
||||
StringTokenizer st = new StringTokenizer(s, ";", false);
|
||||
if (st.hasMoreTokens())
|
||||
{
|
||||
String pattern = st.nextToken();
|
||||
|
||||
int i = pattern.indexOf("PROXY");
|
||||
|
||||
if (i != -1) {
|
||||
// "PROXY" is specified
|
||||
return new ProxyInfo(pattern.substring(i + 6));
|
||||
}
|
||||
|
||||
i = pattern.indexOf("SOCKS");
|
||||
|
||||
if (i != -1)
|
||||
{
|
||||
// "SOCKS" is specified
|
||||
return new ProxyInfo(null, pattern.substring(i + 6));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// proxy string contains 'DIRECT' or unrecognized text
|
||||
return new ProxyInfo(null, -1);
|
||||
}
|
||||
|
||||
public int getID()
|
||||
{
|
||||
return m_id;
|
||||
}
|
||||
|
||||
public void setID(int id)
|
||||
{
|
||||
if (m_id != 0) return;
|
||||
m_id = id;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,54 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is The Waterfall Java Plugin Module
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* $Id: MozillaSecurityManager.java,v 1.1 2001/05/09 17:30:01 edburns%acm.org Exp $
|
||||
*
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
*/
|
||||
|
||||
package sun.jvmp.mozilla;
|
||||
|
||||
import sun.jvmp.*;
|
||||
import sun.jvmp.security.*;
|
||||
import sun.jvmp.applet.*;
|
||||
import java.security.*;
|
||||
|
||||
public class MozillaSecurityManager extends WFAppletSecurityManager
|
||||
{
|
||||
public void checkPackageAccess(final String p)
|
||||
{
|
||||
//System.err.println("checkPackageAccesss: "+p);
|
||||
// this check used to prevent infinite recursion when calling implies()
|
||||
// in JavaScriptProtectionDomain,, as it has to load some classes
|
||||
if (p.equals("sun.jvmp.mozilla"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
super.checkPackageAccess(p);
|
||||
}
|
||||
|
||||
public void checkPermission(Permission p)
|
||||
{
|
||||
//System.err.println("checkPermission: "+p);
|
||||
super.checkPermission(p);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,248 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is The Waterfall Java Plugin Module
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* $Id: MozillaAppletPeer.java,v 1.1 2001/05/09 17:30:02 edburns%acm.org Exp $
|
||||
*
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
*/
|
||||
|
||||
package sun.jvmp.netscape4;
|
||||
|
||||
import sun.jvmp.*;
|
||||
import sun.jvmp.security.*;
|
||||
import sun.jvmp.applet.*;
|
||||
import java.util.Hashtable;
|
||||
import java.net.URL;
|
||||
import java.net.MalformedURLException;
|
||||
import java.lang.reflect.*;
|
||||
|
||||
public class MozillaAppletPeer extends WFAppletContext
|
||||
implements HostObjectPeer
|
||||
{
|
||||
private int m_id;
|
||||
private int m_winid;
|
||||
//private long m_params;
|
||||
NetscapePeerFactory m_factory;
|
||||
AppletViewer m_viewer = null;
|
||||
private boolean m_stopped = true;
|
||||
|
||||
MozillaAppletPeer(MozillaHostObjectPeer fake, int id)
|
||||
{
|
||||
//PluggableJVM.trace("CREATED APPLET OBJECT");
|
||||
m_factory = fake.m_factory;
|
||||
m_id = id;
|
||||
m_winid = 0;
|
||||
// XXX: get it from browser
|
||||
/*
|
||||
ActivatorAppletPanel.initEnvironment(ActivatorAppletPanel.PROXY_TYPE_MANUAL,
|
||||
"http=webcache-cup:8080",
|
||||
"dubhe1",
|
||||
null);
|
||||
*/
|
||||
}
|
||||
|
||||
public int getID()
|
||||
{
|
||||
return m_id;
|
||||
}
|
||||
|
||||
public void setID(int id)
|
||||
{
|
||||
if (m_id != 0) return;
|
||||
m_id = id;
|
||||
}
|
||||
public int handleEvent(SecurityCaps caps, int eventID, long eventData)
|
||||
{
|
||||
int retval = 0;
|
||||
PluggableJVM jvm = m_factory.m_jvm;
|
||||
jvm.trace("GOT EVENT "+eventID+"!!!", PluggableJVM.LOG_DEBUG);
|
||||
switch (eventID)
|
||||
{
|
||||
case PE_CREATE:
|
||||
retval = 1;
|
||||
break;
|
||||
case PE_SETTYPE:
|
||||
jvm.trace("SETTYPE called twice - IGNORED",
|
||||
PluggableJVM.LOG_WARNING);
|
||||
retval = 1;
|
||||
break;
|
||||
case PE_SETWINDOW:
|
||||
jvm.trace("PE_SETWINDOW", PluggableJVM.LOG_DEBUG);
|
||||
m_winid = (int)eventData;
|
||||
retval = handleSetWindow();
|
||||
break;
|
||||
case PE_NEWPARAMS:
|
||||
jvm.trace("PE_NEWPARAMS", PluggableJVM.LOG_DEBUG);
|
||||
//m_params = eventData;
|
||||
// execute it async
|
||||
retval = handleNewParams(this, caps);
|
||||
//retval = 1;
|
||||
break;
|
||||
case PE_DESTROY:
|
||||
retval = destroy(caps);
|
||||
break;
|
||||
case PE_STOP:
|
||||
retval = 1;
|
||||
// do it before stop, as after we can't be sure
|
||||
// our browser peer is still alive
|
||||
m_stopped = true;
|
||||
if (m_viewer != null) m_viewer.stopApplet();
|
||||
break;
|
||||
case PE_START:
|
||||
retval = 1;
|
||||
m_stopped = false;
|
||||
m_viewer.startApplet();
|
||||
break;
|
||||
default:
|
||||
retval = 0;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
public int handleCall(SecurityCaps caps, int arg1, long arg2)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
public int destroy(SecurityCaps caps)
|
||||
{
|
||||
m_factory.m_jvm.trace("DESTROY", PluggableJVM.LOG_DEBUG);
|
||||
m_stopped = true;
|
||||
if (m_viewer != null) {
|
||||
m_viewer.destroyApplet(5000);
|
||||
m_viewer = null;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int handleNewParams(Object arg, SecurityCaps caps)
|
||||
{
|
||||
if (arg != null)
|
||||
{
|
||||
Method m;
|
||||
try {
|
||||
m = arg.getClass().getDeclaredMethod("handleNewParams",
|
||||
new Class[] {Object.class});
|
||||
} catch (Exception e) {
|
||||
m_factory.m_jvm.trace("No handleNewParams: "+e,
|
||||
PluggableJVM.LOG_ERROR);
|
||||
return 0;
|
||||
}
|
||||
AsyncExecutor ex =
|
||||
new AsyncExecutor(arg, m, new Object[] {null});
|
||||
ex.start();
|
||||
return 1;
|
||||
}
|
||||
String[][] params = getParams();
|
||||
String[] keys = params[0];
|
||||
String[] vals = params[1];
|
||||
URL docbase;
|
||||
Hashtable hparams = new Hashtable();
|
||||
for (int i=0; i < keys.length; i++)
|
||||
hparams.put(keys[i].toLowerCase(), vals[i]);
|
||||
//hparams.put("OWNER", this);
|
||||
//hparams.put("ID", new Integer(m_id));
|
||||
try
|
||||
{
|
||||
docbase = new URL((String)hparams.get("docbase"));
|
||||
}
|
||||
catch (MalformedURLException e)
|
||||
{
|
||||
m_factory.m_jvm.trace("invalid docbase due "+e,
|
||||
PluggableJVM.LOG_WARNING);
|
||||
return 0;
|
||||
}
|
||||
m_viewer = m_factory.m_mgr.createAppletViewer(this,
|
||||
m_factory,
|
||||
hparams);
|
||||
m_viewer.setDocumentBase(docbase);
|
||||
handleEvent(caps, PE_START, 0);
|
||||
return handleSetWindow();
|
||||
}
|
||||
|
||||
private int handleSetWindow()
|
||||
{
|
||||
if (m_stopped) return 0;
|
||||
if (m_winid != 0) {
|
||||
Frame f = jvm.getFrameWithId(m_winid);
|
||||
if (f != null) m_viewer.setWindow(f);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
public void showStatus(String string)
|
||||
{
|
||||
// calls back peer in Mozilla
|
||||
if (m_stopped) return;
|
||||
nativeShowStatus(string);
|
||||
}
|
||||
|
||||
public void showDocument(URL url, String target)
|
||||
{
|
||||
// never pass events after stop() - otherwise
|
||||
// we'll crash the browser
|
||||
if (m_stopped) return;
|
||||
// calls back peer in Mozilla
|
||||
//PluggableJVM.trace("showDocument: "+url);
|
||||
nativeShowDocument(url.toString(), target);
|
||||
}
|
||||
|
||||
public void showDocument(URL url)
|
||||
{
|
||||
showDocument(url, "_top");
|
||||
}
|
||||
|
||||
public HostObjectPeerFactory getFactory()
|
||||
{
|
||||
return m_factory;
|
||||
}
|
||||
|
||||
// duplicates of nsIJavaObjectInfo methods
|
||||
// funny way to return 2 arrays of strings
|
||||
native protected String[][] getParams();
|
||||
native protected boolean nativeShowStatus(String status);
|
||||
native protected boolean nativeShowDocument(String url,
|
||||
String target);
|
||||
// XXX: add others
|
||||
};
|
||||
|
||||
|
||||
class AsyncExecutor extends Thread
|
||||
{
|
||||
Object o;
|
||||
Method m;
|
||||
Object[] args;
|
||||
AsyncExecutor(Object o, Method m, Object[] args)
|
||||
{
|
||||
this.o = o; this.m = m; this.args = args;
|
||||
}
|
||||
public void run()
|
||||
{
|
||||
try {
|
||||
m.invoke(o, args);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1,109 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is The Waterfall Java Plugin Module
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* $Id: MozillaHostObjectPeer.java,v 1.1 2001/05/09 17:30:02 edburns%acm.org Exp $
|
||||
*
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
*/
|
||||
|
||||
package sun.jvmp.netscape4;
|
||||
|
||||
import sun.jvmp.*;
|
||||
import sun.jvmp.security.*;
|
||||
|
||||
public class MozillaHostObjectPeer implements HostObjectPeer
|
||||
{
|
||||
private int m_id = 0;
|
||||
private long m_data = 0;
|
||||
private HostObjectPeer m_realPeer = null;
|
||||
NetscapePeerFactory m_factory;
|
||||
|
||||
public MozillaHostObjectPeer(NetscapePeerFactory factory,
|
||||
int version)
|
||||
{
|
||||
m_factory = factory;
|
||||
}
|
||||
|
||||
public int getID()
|
||||
{
|
||||
return m_id;
|
||||
}
|
||||
|
||||
public void setID(int id)
|
||||
{
|
||||
if (m_id != 0) return;
|
||||
m_id = id;
|
||||
}
|
||||
|
||||
|
||||
public int handleEvent(SecurityCaps caps, int eventID, long eventData)
|
||||
{
|
||||
int retval = 0;
|
||||
//Plugin.trace("MozillaHostObjectPeer.handleEvent: "+eventID);
|
||||
// forward functionality to the real peer
|
||||
if (m_realPeer != null)
|
||||
return m_realPeer.handleEvent(caps, eventID, eventData);
|
||||
switch (eventID)
|
||||
{
|
||||
case PE_CREATE:
|
||||
retval = 1;
|
||||
break;
|
||||
case PE_SETTYPE:
|
||||
switch((int)eventData)
|
||||
{
|
||||
case PT_APPLET:
|
||||
case PT_OBJECT:
|
||||
m_realPeer = new MozillaAppletPeer(this, m_id);
|
||||
// maybe send CREATE event from here?
|
||||
retval = 1;
|
||||
break;
|
||||
default:
|
||||
m_factory.m_jvm.trace("Unknown tag type",
|
||||
PluggableJVM.LOG_WARNING);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
retval = 0;
|
||||
break;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
public int handleCall(SecurityCaps caps, int arg1, long arg2)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
public int destroy(SecurityCaps caps)
|
||||
{
|
||||
if (m_realPeer != null)
|
||||
return m_realPeer.destroy(caps);
|
||||
return 0;
|
||||
}
|
||||
|
||||
public HostObjectPeerFactory getFactory()
|
||||
{
|
||||
return m_factory;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -1,141 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is The Waterfall Java Plugin Module
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* $Id: NetscapePeerFactory.java,v 1.1 2001/05/09 17:30:03 edburns%acm.org Exp $
|
||||
*
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
*/
|
||||
|
||||
package sun.jvmp.netscape4;
|
||||
|
||||
import sun.jvmp.*;
|
||||
import sun.jvmp.security.*;
|
||||
import java.security.*;
|
||||
|
||||
public class NetscapePeerFactory implements HostObjectPeerFactory,
|
||||
AccessControlDecider
|
||||
{
|
||||
protected final String cid = "@sun.com/wf/netscape4/appletpeer;1";
|
||||
protected final int version = 1;
|
||||
protected int m_id;
|
||||
PluggableJVM m_jvm;
|
||||
|
||||
protected NetscapePeerFactory(PluggableJVM jvm)
|
||||
throws Exception
|
||||
{
|
||||
m_jvm = jvm;
|
||||
loadLibrary();
|
||||
}
|
||||
|
||||
public static HostObjectPeerFactory start(PluggableJVM jvm)
|
||||
{
|
||||
NetscapePeerFactory factory = null;
|
||||
try
|
||||
{
|
||||
factory = new NetscapePeerFactory(jvm);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
jvm.trace("NETSCAPE 4 FACTORY NOT CREATED",
|
||||
PluggableJVM.LOG_ERROR);
|
||||
return null;
|
||||
}
|
||||
return factory;
|
||||
}
|
||||
public String getCID()
|
||||
{
|
||||
return cid;
|
||||
}
|
||||
public HostObjectPeer create(int version)
|
||||
{
|
||||
return new MozillaHostObjectPeer(this, version);
|
||||
}
|
||||
|
||||
public int handleEvent(SecurityCaps caps,
|
||||
int eventID,
|
||||
long eventData)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
public int handleCall(SecurityCaps caps, int arg1, long arg2)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
public int destroy(SecurityCaps caps)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
public PermissionCollection getPermissions(CodeSource codesource)
|
||||
{
|
||||
Permissions perms = new Permissions();
|
||||
perms.add(new RuntimePermission("accessClassInPackage.sun.jvmp.netscape4"));
|
||||
return perms;
|
||||
}
|
||||
|
||||
public int decide(CallingContext ctx, String principal, int cap_no)
|
||||
{
|
||||
return NA;
|
||||
}
|
||||
|
||||
public boolean belongs(int cap_no)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
private void loadLibrary() throws UnsatisfiedLinkError
|
||||
{
|
||||
String libname = "wf_netscape4";
|
||||
try
|
||||
{
|
||||
System.loadLibrary(libname);
|
||||
}
|
||||
catch (UnsatisfiedLinkError ex)
|
||||
{
|
||||
m_jvm.trace("System could not load DLL: " + libname,
|
||||
PluggableJVM.LOG_ERROR);
|
||||
m_jvm.trace("Path is:" +
|
||||
System.getProperty("java.library.path"),
|
||||
PluggableJVM.LOG_WARNING);
|
||||
m_jvm.trace(ex.toString(),
|
||||
PluggableJVM.LOG_WARNING);
|
||||
throw ex;
|
||||
};
|
||||
}
|
||||
public int getID()
|
||||
{
|
||||
return m_id;
|
||||
}
|
||||
|
||||
public void setID(int id)
|
||||
{
|
||||
if (m_id != 0) return;
|
||||
m_id = id;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,49 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is The Waterfall Java Plugin Module
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* $Id: AccessControlDecider.java,v 1.1 2001/05/09 17:30:03 edburns%acm.org Exp $
|
||||
*
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
*/
|
||||
|
||||
package sun.jvmp.security;
|
||||
|
||||
public interface AccessControlDecider
|
||||
{
|
||||
final int NA = 0; /* N/A */
|
||||
final int AC = 1; /* allow chained */
|
||||
final int AF = 2; /* allow final */
|
||||
final int FC = 3; /* forbid chained */
|
||||
final int FF = 4; /* forbid final */
|
||||
|
||||
/**
|
||||
* check this decider decision on this capability, using this
|
||||
* calling context and principal
|
||||
*/
|
||||
int decide(CallingContext ctx, String principal,
|
||||
int cap_no);
|
||||
|
||||
/**
|
||||
* check if this capablity belongs to the area of decision of
|
||||
* this checker
|
||||
*/
|
||||
boolean belongs(int cap_no);
|
||||
}
|
|
@ -1,48 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is The Waterfall Java Plugin Module
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* $Id: CallingContext.java,v 1.1 2001/05/09 17:30:03 edburns%acm.org Exp $
|
||||
*
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
*/
|
||||
|
||||
package sun.jvmp.security;
|
||||
|
||||
import java.security.*;
|
||||
|
||||
public class CallingContext
|
||||
{
|
||||
private AccessControlContext acc;
|
||||
private SecurityCaps caps;
|
||||
private ProtectionDomain domain;
|
||||
|
||||
public CallingContext(ProtectionDomain domain, byte[] raw_caps)
|
||||
{
|
||||
acc = AccessController.getContext();
|
||||
this.domain = domain;
|
||||
caps = new SecurityCaps(raw_caps);
|
||||
}
|
||||
|
||||
public CallingContext(SecurityCaps caps)
|
||||
{
|
||||
this.caps = caps;
|
||||
}
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is The Waterfall Java Plugin Module
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* $Id: ExtSecurityManager.java,v 1.1 2001/05/09 17:30:03 edburns%acm.org Exp $
|
||||
*
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
*/
|
||||
|
||||
package sun.jvmp.security;
|
||||
import java.util.*;
|
||||
import sun.jvmp.*;
|
||||
|
||||
public class ExtSecurityManager
|
||||
{
|
||||
protected Vector checkers;
|
||||
PluggableJVM jvm;
|
||||
|
||||
public ExtSecurityManager(PluggableJVM owner)
|
||||
{
|
||||
checkers = new Vector();
|
||||
jvm = owner;
|
||||
}
|
||||
|
||||
public void registerDecider(AccessControlDecider decider,
|
||||
SecurityCaps caps,
|
||||
SecurityCaps mask)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void unregisterCapsChecker(AccessControlDecider decider)
|
||||
{
|
||||
}
|
||||
}
|
|
@ -1,103 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is The Waterfall Java Plugin Module
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* $Id: SecurityCaps.java,v 1.1 2001/05/09 17:30:04 edburns%acm.org Exp $
|
||||
*
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
*/
|
||||
|
||||
package sun.jvmp.security;
|
||||
|
||||
import sun.jvmp.PluggableJVM;
|
||||
|
||||
public class SecurityCaps
|
||||
{
|
||||
// keep in sync with jvmp_caps.h
|
||||
final int JVMP_MAX_CAPS_BYTES = 128;
|
||||
final int JVMP_MAX_CAPS = JVMP_MAX_CAPS_BYTES * 8;
|
||||
final int JVMP_MAX_SYS_CAP_BYTES = 2;
|
||||
final int JVMP_MAX_SYS_CAP = JVMP_MAX_SYS_CAP_BYTES * 8;
|
||||
|
||||
byte bits[];
|
||||
|
||||
public SecurityCaps()
|
||||
{
|
||||
bits = new byte[JVMP_MAX_CAPS_BYTES];
|
||||
for (int i=0; i<JVMP_MAX_CAPS_BYTES; i++)
|
||||
bits[i] = 0;
|
||||
}
|
||||
|
||||
public SecurityCaps(byte raw[])
|
||||
{
|
||||
bits = new byte[JVMP_MAX_CAPS_BYTES];
|
||||
System.arraycopy(raw, 0, bits, 0, JVMP_MAX_CAPS_BYTES);
|
||||
}
|
||||
|
||||
public boolean isPureSystem()
|
||||
{
|
||||
boolean res = true;
|
||||
for (int i=JVMP_MAX_SYS_CAP_BYTES; i<JVMP_MAX_CAPS_BYTES; i++)
|
||||
{
|
||||
res &= (bits[i] == 0);
|
||||
if (!res) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean isPureUser()
|
||||
{
|
||||
boolean res = true;
|
||||
for (int i=0; i<JVMP_MAX_SYS_CAP_BYTES; i++)
|
||||
{
|
||||
res &= (bits[i] == 0);
|
||||
if (!res) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public boolean isAllowed(int action_no)
|
||||
{
|
||||
if (action_no < 0 || action_no >= JVMP_MAX_CAPS) return false;
|
||||
return
|
||||
(((bits[action_no >> 3]) & (1 << (action_no & 0x7))) != 0) ? true : false;
|
||||
}
|
||||
|
||||
public boolean isForbidden(int action_no)
|
||||
{
|
||||
return !isAllowed(action_no);
|
||||
}
|
||||
|
||||
public boolean permits(SecurityCaps act)
|
||||
{
|
||||
// boolean res = true;
|
||||
// for (int i=0; i<JVMP_MAX_CAPS_BYTES; i++)
|
||||
// res &=
|
||||
return true;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,83 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is The Waterfall Java Plugin Module
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* $Id: WFPolicy.java,v 1.1 2001/05/09 17:30:04 edburns%acm.org Exp $
|
||||
*
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
*/
|
||||
|
||||
package sun.jvmp.security;
|
||||
|
||||
import sun.jvmp.*;
|
||||
import java.security.*;
|
||||
import java.net.*;
|
||||
import java.util.*;
|
||||
|
||||
public class WFPolicy extends sun.security.provider.PolicyFile
|
||||
{
|
||||
URL wfcodebase;
|
||||
PluggableJVM jvm;
|
||||
String wfextpath;
|
||||
public WFPolicy(PluggableJVM jvm, URL wfcodebase)
|
||||
{
|
||||
this.wfcodebase = wfcodebase;
|
||||
wfextpath = wfcodebase.getPath()+"ext";
|
||||
this.jvm = jvm;
|
||||
}
|
||||
|
||||
protected boolean isAllPermissionGranted(CodeSource codesource)
|
||||
{
|
||||
URL codebase = codesource.getLocation();
|
||||
if (codebase == null) return false;
|
||||
if (wfcodebase.equals(codebase)) return true;
|
||||
//System.out.println("path="+codebase.getPath()+" extpath="+wfextpath+" proto="+codebase.getProtocol());
|
||||
String path = codebase.getPath();
|
||||
if ("file".equals(codebase.getProtocol()) && path != null
|
||||
&& path.startsWith(wfextpath)) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public PermissionCollection getPermissions(CodeSource codesource)
|
||||
{
|
||||
jvm.trace("asked perms for: "+codesource, PluggableJVM.LOG_DEBUG);
|
||||
Permissions perms = new Permissions();
|
||||
if (isAllPermissionGranted(codesource))
|
||||
{
|
||||
perms.add(new java.security.AllPermission());
|
||||
jvm.trace("all perms granted to "+codesource,
|
||||
PluggableJVM.LOG_DEBUG);
|
||||
return perms;
|
||||
}
|
||||
PermissionCollection p = super.getPermissions(codesource);
|
||||
if (p != null)
|
||||
{
|
||||
for (Enumeration e=p.elements(); e.hasMoreElements(); )
|
||||
perms.add((Permission)e.nextElement());
|
||||
}
|
||||
p = jvm.getExtensionsPermissions(codesource);
|
||||
if (p != null)
|
||||
{
|
||||
for (Enumeration e=p.elements(); e.hasMoreElements(); )
|
||||
perms.add((Permission)e.nextElement());
|
||||
}
|
||||
return perms;
|
||||
}
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is The Waterfall Java Plugin Module
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* $Id: MyActionListener.java,v 1.1 2001/05/09 17:30:04 edburns%acm.org Exp $
|
||||
*
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
*/
|
||||
|
||||
package sun.jvmp.test;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
|
||||
class MyActionListener implements ActionListener
|
||||
{
|
||||
private String m_string = null;
|
||||
public MyActionListener(String s)
|
||||
{
|
||||
m_string = s;
|
||||
}
|
||||
public void actionPerformed(ActionEvent e)
|
||||
{
|
||||
MyDialog dlg = new MyDialog(m_string);
|
||||
System.out.println("Message is "+m_string);
|
||||
}
|
||||
};
|
|
@ -1,54 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is The Waterfall Java Plugin Module
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* $Id: MyDialog.java,v 1.1 2001/05/09 17:30:04 edburns%acm.org Exp $
|
||||
*
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
*/
|
||||
|
||||
package sun.jvmp.test;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
|
||||
class MyDialog extends Frame
|
||||
{
|
||||
private Button b;
|
||||
public MyDialog(String text)
|
||||
{
|
||||
b = new Button(text);
|
||||
b.setBounds(0, 0, 40, 40);
|
||||
setLayout(new FlowLayout(FlowLayout.CENTER));
|
||||
b.addActionListener(new ActionListener()
|
||||
{
|
||||
public void actionPerformed(ActionEvent e)
|
||||
{
|
||||
dispose();
|
||||
}
|
||||
|
||||
});
|
||||
setSize(200,150);
|
||||
add(b);
|
||||
setLocation(200, 200);
|
||||
pack();
|
||||
show();
|
||||
}
|
||||
}
|
|
@ -1,251 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is The Waterfall Java Plugin Module
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* $Id: TestPeerFactory.java,v 1.1 2001/05/09 17:30:04 edburns%acm.org Exp $
|
||||
*
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
*/
|
||||
|
||||
package sun.jvmp.test;
|
||||
|
||||
import java.awt.*;
|
||||
import java.security.*;
|
||||
import sun.jvmp.*;
|
||||
import sun.jvmp.security.*;
|
||||
|
||||
class TestObjectPeer implements HostObjectPeer
|
||||
{
|
||||
private int m_id = 0;
|
||||
private long m_data = 0;
|
||||
private HostObjectPeer m_realPeer = null;
|
||||
TestPeerFactory m_factory = null;
|
||||
SynchroObject so = null;
|
||||
|
||||
public TestObjectPeer(TestPeerFactory factory, int version)
|
||||
{
|
||||
m_factory = factory;
|
||||
}
|
||||
|
||||
public int getID()
|
||||
{
|
||||
return m_id;
|
||||
}
|
||||
|
||||
public void setID(int id)
|
||||
{
|
||||
if (m_id != 0) return;
|
||||
m_id = id;
|
||||
}
|
||||
|
||||
public HostObjectPeerFactory getFactory()
|
||||
{
|
||||
return m_factory;
|
||||
}
|
||||
|
||||
protected void performTest(int id)
|
||||
{
|
||||
Frame frame = null;
|
||||
MyActionListener l1 = new MyActionListener("First button");
|
||||
MyActionListener l2 = new MyActionListener("Second button");
|
||||
frame = m_factory.m_jvm.getFrameWithId(id);
|
||||
if (frame == null) return;
|
||||
frame.setLayout(new FlowLayout(FlowLayout.CENTER));
|
||||
Button b1 = new Button("Test 1");
|
||||
Button b2 = new Button("Test 2");
|
||||
b1.setBounds(0, 0, 40, 40);
|
||||
b2.setBounds(50, 50, 40, 40);
|
||||
b1.addActionListener(l1);
|
||||
b2.addActionListener(l2);
|
||||
frame.add(b1);
|
||||
frame.add(b2);
|
||||
frame.show();
|
||||
}
|
||||
protected void performThreadTest(int id)
|
||||
{
|
||||
so = m_factory.m_jvm.getSynchroObjectWithID(id);
|
||||
if (so == null) {
|
||||
m_factory.m_jvm.trace("no such synchro object: "+id,
|
||||
PluggableJVM.LOG_WARNING);
|
||||
return;
|
||||
}
|
||||
Thread t = new Thread(new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
int millis = 7000;
|
||||
PluggableJVM jvm = m_factory.m_jvm;
|
||||
jvm.trace("New thread started. Trying to get lock.",
|
||||
PluggableJVM.LOG_INFO);
|
||||
if (millis > 0)
|
||||
{
|
||||
so._lock();
|
||||
jvm.trace("Lock acquired, sleeping "+millis+" millis...",
|
||||
PluggableJVM.LOG_INFO);
|
||||
try {
|
||||
Thread.sleep(millis);
|
||||
} catch (InterruptedException e) {}
|
||||
jvm.trace("notifying sleeping thread",
|
||||
PluggableJVM.LOG_INFO);
|
||||
so._notifyAll();
|
||||
so._unlock();
|
||||
jvm.trace("Unlock and done",
|
||||
PluggableJVM.LOG_INFO);
|
||||
}
|
||||
}
|
||||
});
|
||||
t.start();
|
||||
}
|
||||
|
||||
public int handleEvent(SecurityCaps caps, int eventID, long eventData)
|
||||
{
|
||||
int retval = 0;
|
||||
m_factory.m_jvm.trace("TestObjectPeer.handleEvent: "+eventID,
|
||||
PluggableJVM.LOG_DEBUG);
|
||||
switch (eventID)
|
||||
{
|
||||
case PE_CREATE:
|
||||
retval = 1;
|
||||
break;
|
||||
case 20:
|
||||
performTest((int)eventData);
|
||||
retval = 1;
|
||||
break;
|
||||
case 666:
|
||||
performThreadTest((int)eventData);
|
||||
retval = 1;
|
||||
break;
|
||||
default:
|
||||
retval = 0;
|
||||
break;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
public int handleCall(SecurityCaps caps, int arg1, long arg2)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
public int destroy(SecurityCaps caps)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
|
||||
public class TestPeerFactory implements HostObjectPeerFactory,
|
||||
AccessControlDecider
|
||||
{
|
||||
protected final String cid = "@sun.com/wf/tests/testextension;1";
|
||||
protected final int version = 1;
|
||||
protected PluggableJVM m_jvm = null;
|
||||
protected int m_id;
|
||||
protected long m_params = 0;
|
||||
|
||||
protected TestPeerFactory(PluggableJVM jvm, long data)
|
||||
throws Exception
|
||||
{
|
||||
m_jvm = jvm;
|
||||
m_params = data;
|
||||
}
|
||||
|
||||
public static HostObjectPeerFactory start(PluggableJVM jvm, Long data)
|
||||
{
|
||||
TestPeerFactory factory = null;
|
||||
try
|
||||
{
|
||||
factory = new TestPeerFactory(jvm, data.longValue());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
jvm.trace("FACTORY NOT CREATED", PluggableJVM.LOG_ERROR);
|
||||
return null;
|
||||
}
|
||||
factory.m_jvm = jvm;
|
||||
return factory;
|
||||
}
|
||||
|
||||
public String getCID()
|
||||
{
|
||||
return cid;
|
||||
}
|
||||
|
||||
public HostObjectPeer create(int version)
|
||||
{
|
||||
return new TestObjectPeer(this, version);
|
||||
}
|
||||
|
||||
public int handleEvent(SecurityCaps caps,
|
||||
int eventID,
|
||||
long eventData)
|
||||
{
|
||||
m_jvm.trace("Event "+eventID+" come to extension "+m_id,
|
||||
PluggableJVM.LOG_DEBUG);
|
||||
return 1;
|
||||
}
|
||||
|
||||
public int handleCall(SecurityCaps caps, int arg1, long arg2)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
public int destroy(SecurityCaps caps)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
public PermissionCollection getPermissions(CodeSource codesource)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public int decide(CallingContext ctx, String principal, int cap_no)
|
||||
{
|
||||
return NA;
|
||||
}
|
||||
|
||||
public boolean belongs(int cap_no)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getID()
|
||||
{
|
||||
return m_id;
|
||||
}
|
||||
|
||||
public void setID(int id)
|
||||
{
|
||||
if (m_id != 0) return;
|
||||
m_id = id;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,314 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is The Waterfall Java Plugin Module
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* $Id: jvmp.h,v 1.1 2001/05/09 17:30:04 edburns%acm.org Exp $
|
||||
*
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
*/
|
||||
|
||||
#ifndef _JVMP_H
|
||||
#define _JVMP_H
|
||||
/* temporary include to fix subtle problem with includes on WIn32 with VC6.0 */
|
||||
#include <jni_md.h>
|
||||
#include <jni.h>
|
||||
|
||||
#ifdef _JVMP_IMPLEMENTATION
|
||||
#define _JVMP_IMPORT_OR_EXPORT JNIEXPORT
|
||||
#else
|
||||
#define _JVMP_IMPORT_OR_EXPORT JNIIMPORT
|
||||
#endif
|
||||
|
||||
#include "jvmp_md.h"
|
||||
#include "jvmp_drawing.h"
|
||||
#include "jvmp_threading.h"
|
||||
#include "jvmp_security.h"
|
||||
#include "jvmp_vendor.h"
|
||||
#include "jvmp_extension.h"
|
||||
#include "jvmp_event.h"
|
||||
#include "jvmp_errors.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct JVMP_RuntimeContext {
|
||||
/**
|
||||
* JVM assostiated with this JVMP object - in some implementations
|
||||
* may be zero, so you shouldn't rely on this value heavily.
|
||||
*/
|
||||
JavaVM* jvm;
|
||||
/**
|
||||
* Returns description of this plugin, including:
|
||||
* underlying JVM version, underlying JVM vendor, vendor-dependent data,
|
||||
* JVMP version - for details see jvmp_vendor.h. You shouldn't do memory
|
||||
* management on returned value - it's statically allocated.
|
||||
*/
|
||||
jint (JNICALL *JVMP_GetDescription)(JVMP_PluginDescription* *pdesc);
|
||||
/**
|
||||
* Does all dirty work on loading and starting Java VM
|
||||
* with correct arguments. args can be used to pass JVM-specific arguments,
|
||||
* usually NULL is OK.
|
||||
* Argument allow_reuse, if JNI_TRUE allow to use
|
||||
* already running JVM for plugin purposes. May be dangerous,
|
||||
* if running JVM is not the same that plugin is compiled for.
|
||||
* Also plugin system classes must be in classpath of this JVM, as current
|
||||
* JVM specification doesn't allow change classpath after running JVM.
|
||||
* As additional effect, sets jvm field in JVMP_PluginContext to
|
||||
* currently running JVM.
|
||||
*/
|
||||
jint (JNICALL *JVMP_GetRunningJVM)(JVMP_CallingContext* *pctx,
|
||||
void* args,
|
||||
jint allow_reuse);
|
||||
/**
|
||||
* Send generic event directly to PluggableJVM. Can be used to
|
||||
* extend Waterfall API without changing ABI, like ioctl() syscall on Unix.
|
||||
* Exact time of call execution depends on "priority"
|
||||
* and current state of event queue. At this point I would like to freeze
|
||||
* jvmp.h, and all further API extensions should be done using those
|
||||
* two calls.
|
||||
* Every WF implementation can have its own set of commands, but suggetsed
|
||||
* minimum can be found in jvmp_event.h, see JVMP_CMD_*.
|
||||
* Note - returned value, if != 0 is result of event handling,
|
||||
* so for all JVMP_Send* calls you should test returned value == JNI_FALSE,
|
||||
* and avoid returning 0 from custom event handlers, like extension,
|
||||
* as such return values means that call failed.
|
||||
*/
|
||||
jint (JNICALL *JVMP_SendSysEvent)(JVMP_CallingContext* ctx,
|
||||
jint event,
|
||||
jlong data,
|
||||
jint priority);
|
||||
/**
|
||||
* Async system call. Exact time of call execution depends on "priority"
|
||||
* and current state of event queue.
|
||||
*/
|
||||
jint (JNICALL *JVMP_PostSysEvent)(JVMP_CallingContext* ctx,
|
||||
jint event,
|
||||
jlong data,
|
||||
jint priority);
|
||||
/**
|
||||
* Should stop and unload Java VM - not well implemented in JDK1.3 yet.
|
||||
* Doesn't stop JVM, if there are unregistered extensions, so unregister
|
||||
* it first.
|
||||
*/
|
||||
jint (JNICALL *JVMP_StopJVM)(JVMP_CallingContext* ctx);
|
||||
/**
|
||||
* Registers native window handle (OS dependent, see jvmp_drawing.h) in
|
||||
* AWT, if succeed you can use PluggableJVM getFrameWithId() method with
|
||||
* returned id (>0) to obtain this frame on Java side
|
||||
*/
|
||||
jint (JNICALL *JVMP_RegisterWindow)(JVMP_CallingContext* ctx,
|
||||
JVMP_DrawingSurfaceInfo* win,
|
||||
jint *pID);
|
||||
/**
|
||||
* Unregisters native window, ID is invalid after this call.
|
||||
*/
|
||||
jint (JNICALL *JVMP_UnregisterWindow)(JVMP_CallingContext* ctx,
|
||||
jint ID);
|
||||
/**
|
||||
* Thread synchronization primitives
|
||||
*/
|
||||
/**
|
||||
* Registers native monitor object (OS dependent, see jvmp_threading.h) in JVM
|
||||
* if succeed you can use PluggableJVM.getSynchroObjectWithID()
|
||||
* to obtain SynchroObject, calling _wait(), _notify(),
|
||||
* _notifyAll() on this object will perform those operation on monitor you
|
||||
* passed. It leads to obvious granularity problems, but all operations
|
||||
* must be pretty fast, and it works reasonable.
|
||||
* In the future, JVM could provide hooks, so it will be possible to use
|
||||
* JVMP_MonitorInfo to construct java.lang.Object with passed locks and
|
||||
* monitors, and so Java code shouldn't care about source of synchroobject.
|
||||
* Now it would require too much JDK work, so using easiest solution.
|
||||
*/
|
||||
jint (JNICALL *JVMP_RegisterMonitorObject)(JVMP_CallingContext* ctx,
|
||||
JVMP_MonitorInfo* monitor,
|
||||
jint *pID);
|
||||
/**
|
||||
* Unregister monitor and destroy assotiated objects.
|
||||
*/
|
||||
jint (JNICALL *JVMP_UnregisterMonitorObject)(JVMP_CallingContext* ctx,
|
||||
jint ID);
|
||||
|
||||
/**
|
||||
* Attaches current thread to JVM. Creates java.lang.Thread for given thread,
|
||||
* and register this thread in PluggableJVM, so you can reference it using
|
||||
* method getThreadWithId().
|
||||
* All synchrooperations must happen only after JVMP_AttachThread call
|
||||
* otherwise error is returned. Really, JVMP_GetRunningJVM and JVMP_GetCallingContext
|
||||
* call JVMP_AttachCurrentThread, so usually you shouldn't care.
|
||||
*/
|
||||
jint (JNICALL *JVMP_AttachCurrentThread)(JVMP_CallingContext* ctx,
|
||||
jint *pID);
|
||||
/**
|
||||
* Detaches current thread from JVM.
|
||||
* This function must be called by native thread before
|
||||
* finishing all JVMP operations, as there's no generic way to register
|
||||
* listener on thread exit - pthread_cleanup_push() is a stupid macros working
|
||||
* in one block only.
|
||||
* Also this call frees memory consumed by ctx, so ctx is invalid after this call.
|
||||
*/
|
||||
jint (JNICALL *JVMP_DetachCurrentThread)(JVMP_CallingContext* ctx);
|
||||
|
||||
/**
|
||||
* Gets calling context for further JVMP_* operation - also can be obtained from
|
||||
* GetRunningJVM call.
|
||||
*/
|
||||
jint (JNICALL *JVMP_GetCallingContext)(JVMP_CallingContext* *pctx);
|
||||
/**
|
||||
* Extensible event passing(invocation) API.
|
||||
*/
|
||||
/**
|
||||
* Create peer (Java object) as event target.
|
||||
* vendorID - is unique for application number,
|
||||
* version should be desired version, or 0 if doesn't matter
|
||||
* Usually created object is just a wrapper, able to mimic
|
||||
* more specific HA-dependent objects. Way of object negotiation
|
||||
* is HA-specific.
|
||||
* ID returned back can be considered as opaque handle
|
||||
* for further sync/async events and destroy.
|
||||
*/
|
||||
jint (JNICALL *JVMP_CreatePeer)(JVMP_CallingContext* ctx,
|
||||
const char* cid,
|
||||
jint version,
|
||||
jint *target);
|
||||
/**
|
||||
* Send an synchronous event to Java peer with some data.
|
||||
* Waterfall protocol doesn't specify protocol of event passing,
|
||||
* and format of passed data, it just provides transport.
|
||||
*/
|
||||
jint (JNICALL *JVMP_SendEvent)(JVMP_CallingContext* ctx,
|
||||
jint target,
|
||||
jint event,
|
||||
jlong data,
|
||||
jint priority);
|
||||
/**
|
||||
* Send an asynchronous event to Java peer with some data.
|
||||
* Waterfall protocol doesn't specify protocol of event passing,
|
||||
* lifetime and format of passed data, it just provides transport.
|
||||
*/
|
||||
jint (JNICALL *JVMP_PostEvent)(JVMP_CallingContext* ctx,
|
||||
jint target,
|
||||
jint event,
|
||||
jlong data,
|
||||
jint priority);
|
||||
/**
|
||||
* Destroy Java peer with given ID.
|
||||
* All pending events will be lost (XXX: or not?).
|
||||
*/
|
||||
jint (JNICALL *JVMP_DestroyPeer)(JVMP_CallingContext* ctx,
|
||||
jint target);
|
||||
|
||||
/**
|
||||
* Register Waterfall extension DLL (see jvmp_extension.h).
|
||||
* If succeed, after this call, you can use JVMP_CreatePeer
|
||||
* with vendorID provided by this extension DLL.
|
||||
* Maybe Unicode string is better, but not sure yet.
|
||||
* "data" is arbitrary assotiated with this extension, passed
|
||||
* to the start() method of extension.
|
||||
*/
|
||||
jint (JNICALL *JVMP_RegisterExtension)(JVMP_CallingContext* ctx,
|
||||
const char* extPath,
|
||||
jint *pID,
|
||||
jlong data);
|
||||
/**
|
||||
* Send/post event to extension-wide bootstrap class - see
|
||||
* JVMPExt_GetBootstrapClass() in jvmp_extension.h.
|
||||
* Could be useful, if ones wish to cooperate with whole extension,
|
||||
* not only any given peer. "target" is extension ID returned
|
||||
* by JVMP_RegisterExtension.
|
||||
*/
|
||||
jint (JNICALL *JVMP_SendExtensionEvent)(JVMP_CallingContext* ctx,
|
||||
jint target,
|
||||
jint event,
|
||||
jlong data,
|
||||
jint priority);
|
||||
jint (JNICALL *JVMP_PostExtensionEvent)(JVMP_CallingContext* ctx,
|
||||
jint target,
|
||||
jint event,
|
||||
jlong data,
|
||||
jint priority);
|
||||
/**
|
||||
* Unregister Waterfall extension DLL. Really it does
|
||||
* nothing yet. XXX: lifetime
|
||||
*/
|
||||
jint (JNICALL *JVMP_UnregisterExtension)(JVMP_CallingContext* ctx,
|
||||
jint ID);
|
||||
/**
|
||||
* Capabilities handling. To perform priveledged actions,
|
||||
* application must have capability to do it. Those calls intended
|
||||
* to change capabilities of current calling context.
|
||||
* It's up to HA extension and JVMP to permit/forbid capability changing,
|
||||
* using provided pricipal.
|
||||
* ctx and principal much like username/password pair.
|
||||
*/
|
||||
/**
|
||||
* Tries to enable caps, authenticating with principals.
|
||||
* On success ctx updated with asked caps, otherwise nothing happens
|
||||
* and JNI_FALSE returned. Arbitrary set of byte arrays can be used as
|
||||
* principal.
|
||||
*/
|
||||
jint (JNICALL *JVMP_EnableCapabilities)(JVMP_CallingContext* ctx,
|
||||
JVMP_SecurityCap* caps,
|
||||
jint num_principals,
|
||||
jint* principals_len,
|
||||
jbyte* *principals);
|
||||
/**
|
||||
* Drop some capabilities. Some system caps (like JVMP_CAP_SYS_PARITY)
|
||||
* cannot be dropped.
|
||||
*/
|
||||
jint (JNICALL *JVMP_DisableCapabilities)(JVMP_CallingContext* ctx,
|
||||
JVMP_SecurityCap* caps);
|
||||
/**
|
||||
* those methods are useful, if some application needs thread mapping
|
||||
* "1 -> 1" (not "many -> 1", provided by JVMP_Send* methods).
|
||||
* Generally using of those calls isn't recommended,
|
||||
* as it could introduce complicated threading issues in situations,
|
||||
* where you don't have direct native->Java threads mapping, like
|
||||
* "green" threads, or remote calls.
|
||||
**/
|
||||
jint (JNICALL *JVMP_DirectPeerCall)(JVMP_CallingContext* ctx,
|
||||
jint target,
|
||||
jint arg1,
|
||||
jlong arg2);
|
||||
jint (JNICALL *JVMP_DirectExtCall)(JVMP_CallingContext* ctx,
|
||||
jint target,
|
||||
jint arg1,
|
||||
jlong arg2);
|
||||
jint (JNICALL *JVMP_DirectJVMCall)(JVMP_CallingContext* ctx,
|
||||
jint arg1,
|
||||
jlong arg2);
|
||||
/* buf must be big enough to keep JVMP_MAXERRORLENGTH symbols */
|
||||
jint (JNICALL *JVMP_GetLastErrorString)(JVMP_CallingContext* ctx,
|
||||
char* buf);
|
||||
/**
|
||||
* to keep ABI fixed - if adding new methods, decrement number in []
|
||||
**/
|
||||
void* reserved[10];
|
||||
};
|
||||
|
||||
typedef struct JVMP_RuntimeContext JVMP_RuntimeContext;
|
||||
|
||||
typedef _JVMP_IMPORT_OR_EXPORT jint (JNICALL *JVMP_GetPlugin_t)
|
||||
(JVMP_RuntimeContext** cx);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
#endif /* _JVMP_H */
|
|
@ -1,38 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is The Waterfall Java Plugin Module
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems Inc
|
||||
* Portions created by Sun Microsystems Inc are Copyright (C) 2001
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* $Id: jvmp_cap_vals.h,v 1.1 2001/05/09 17:30:04 edburns%acm.org Exp $
|
||||
*
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Nikolay N. Igotti <inn@sparc.spb.su>
|
||||
*/
|
||||
|
||||
#ifndef _JVMP_CAP_VALS_H
|
||||
#define _JVMP_CAP_VALS_H
|
||||
#define JVMP_CAP_SYS_PARITY 0
|
||||
#define JVMP_CAP_SYS_SYSTEM 1
|
||||
#define JVMP_CAP_SYS_CHCAP 3
|
||||
#define JVMP_CAP_SYS_EVENT 2
|
||||
#define JVMP_CAP_SYS_SYSEVENT 4
|
||||
#define JVMP_CAP_SYS_CALL 5
|
||||
#define JVMP_CAP_SYS_SYSCALL 6
|
||||
#endif
|
||||
|
||||
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче