Applet i zapisanie pliku

0

Witam
Mam nastepujacy problem.. musze napisac formularz w javie w formia apletu na stronie. I tu pojawia sie problem bo z sama aplikacja sobie poradze ale normalnie applet nie ma pozwolenia na zapisywanie pikow... Szukalem troche po internecie i dowiedzialem sie ze niby mozna podpisac applet i sie wtedy zapytac uzytkownika czy nadac prawa, ale jakos mi nie wyszlo :( Moze moglby mi ktos powiedziec krok po kroku jak nadac appletowi uprawnienia.. albo moze ktos ma jakis inny pomysl jak wyeksportowac informacje o tym co ktos na formularzu zaznaczył??

Bardzo prosze o jakieś rady bo naprawde nie wiem jak ugrysc ten problem...

0
Paul234 napisał(a)

uzytkownika czy nadac prawa, ale jakos mi nie wyszlo :( Moze moglby mi ktos powiedziec krok po kroku jak nadac appletowi uprawnienia.. albo moze ktos ma jakis inny pomysl jak wyeksportowac informacje o tym co ktos na formularzu zaznaczył??

Tu jest jak trzeba podpisywać applety i generować pliki uprawnień .
http://java.sun.com/developer/onlineTraining/Programming/JDCBook/signed.html
A dla tych co lubią gimnastykę zawsze można prócz zapisu plików u klienta :
a)zapisać te informacje w bazie danych
b)wysłać za pomocą metody POST poprzez połącznie Http do Serwera WWW .
e)jeśli jest to mało informacji to skorzystać z dostępu do zdalnego serwera RMI,WebServices lub CORBA

0

Tu jest jak trzeba podpisywać applety i generować pliki uprawnień .
http://java.sun.com/developer[...]ogramming/JDCBook/signed.html

Zrobiłem tak jak jest napisane na tej stronie ale w przegladarce dalej nie mam uprawnien i o nic sie nie pyta :(
jedyne co mi to dalo to to ze moge odpalic z w appletwiever'ze
appletviewer -J-Djava.security.policy=Write.jp http://aURL.com/SignedApplet.html ta komenda (oczywiscie zmodyfikownna do moich plikow) Ma ktos jakis pomysl jak wytlumaczyc przegladarce zeby uzyla mojego pliku uprawnien ??

0

1)Na serwerze WWW utwórz katalog (który będzie osiągalny przez przeglądarkę)
2)Wstaw do niego podpisany przez siebie applet
3)Umieść w tym katalogu swój plik uprawnień . Jego nazwa to : java.policy.applet
4)Umieść tam też plik ze stronką HTML w której osadzasz applet
5)Odpal przeglądarkę i sprawdź czy działa .

0

Probuje i probuje i nie dziala ;-(
w konsoli java mi wypluwa cos takiego
liveconnect: Invoking JS method: document
liveconnect: Invoking JS method: URL
basic: Referencing classloader: [email protected], refcount=1
basic: Added progress listener: [email protected]
basic: Loading applet ...
basic: Initializing applet ...
basic: Starting applet ...
basic: completed perf rollup
network: Connecting ftp://paul121.w.interia.pl/build/classes/SSignedApplet.jar with proxy=DIRECT
network: Connecting ftp://paul121:[email protected]paul121.w.interia.pl/build/cl[...]application6/NewApplet1.class with proxy=DIRECT
network: Connecting ftp://paul121:[email protected]paul121.w.interia.pl/build/cl[...]application6/NewApplet1.class with proxy=DIRECT
network: Connecting ftp://paul121:[email protected]paul121.w.interia.pl/build/cl[...]plication6/NewApplet1$1.class with proxy=DIRECT
network: Connecting ftp://paul121:[email protected]paul121.w.interia.pl/build/cl[...]plication6/NewApplet1$2.class with proxy=DIRECT
network: Connecting ftp://paul121:[email protected]paul121.w.interia.pl/build/cl[...]plication6/NewApplet1$3.class with proxy=DIRECT
network: Connecting ftp://paul121:[email protected]paul121.w.interia.pl/build/cl[...]plication6/NewApplet1$4.class with proxy=DIRECT
security: Loading Root CA certificates from C:\PROGRA~1\Java\JRE16~1.0_0\lib\security\cacerts
security: Loaded Root CA certificates from C:\PROGRA~1\Java\JRE16~1.0_0\lib\security\cacerts
security: Loading Deployment certificates from C:\Documents and Settings\Paul\Dane aplikacji\Sun\Java\Deployment\security\trusted.certs
security: Loaded Deployment certificates from C:\Documents and Settings\Paul\Dane aplikacji\Sun\Java\Deployment\security\trusted.certs
security: Loading certificates from Deployment session certificate store
security: Loaded certificates from Deployment session certificate store
security: Loading certificates from Internet Explorer ROOT certificate store
security: Loaded certificates from Internet Explorer ROOT certificate store
security: Loading certificates from Internet Explorer TrustedPublisher certificate store
security: Loaded certificates from Internet Explorer TrustedPublisher certificate store
security: Validate the certificate chain using CertPath API
security: Obtain certificate collection in Root CA certificate store
security: Obtain certificate collection in Root CA certificate store
security: The CRL support is enabled
security: sun microsystems, inc
security: ObjectId: 2.5.29.31 Criticality=false
CRLDistributionPoints [
[DistributionPoint:
[URIName: http://CSC3-2004-crl.verisign.com/CSC3-2004.crl]
]]

security: VeriSign Class 3 Code Signing 2004 CA
security: ObjectId: 2.5.29.31 Criticality=false
CRLDistributionPoints [
[DistributionPoint:
[URIName: http://crl.verisign.com/pca3.crl]
]]

security: This certificate does not have CRL extension
security: Use CRL setting from certificate
security: The OCSP support is enabled
security: sun microsystems, inc
security: ObjectId: 1.3.6.1.5.5.7.1.1 Criticality=false
AuthorityInfoAccess [
[accessMethod: 1.3.6.1.5.5.7.48.1
accessLocation: URIName: http://ocsp.verisign.com, accessMethod: 1.3.6.1.5.5.7.48.2
accessLocation: URIName: http://CSC3-2004-aia.verisign.com/CSC3-2004-aia.cer]
]

security: This certificate does not have AIA extension
security: This certificate does not have AIA extension
security: Use OCSP setting from certificate
network: Connecting http://crl.verisign.com/pca3.crl with proxy=DIRECT
network: Connecting http://CSC3-2004-crl.verisign.com/CSC3-2004.crl with proxy=DIRECT
security: Certificate validation succeeded using CRL
security: Certificate validation succeeded using OCSP
security: No timestamping info available
security: Checking if certificate is in Deployment denied certificate store
security: Checking if certificate is in Deployment permanent certificate store
network: Connecting ftp://paul121:[email protected]paul121.w.interia.pl/build/cl[...]cation6/MyAuthenticator.class with proxy=DIRECT
network: Connecting ftp://paul121:[email protected]paul121.w.interia.pl/build/cl[...]META-INF/javamail.charset.map with proxy=DIRECT
security: Loading certificates from Deployment session certificate store
security: Loaded certificates from Deployment session certificate store
security: Loading certificates from Internet Explorer TrustedPublisher certificate store
security: Loaded certificates from Internet Explorer TrustedPublisher certificate store
security: Validate the certificate chain using CertPath API
security: Obtain certificate collection in Root CA certificate store
security: Obtain certificate collection in Root CA certificate store
security: The CRL support is enabled
security: sun microsystems, inc
security: ObjectId: 2.5.29.31 Criticality=false
CRLDistributionPoints [
[DistributionPoint:
[URIName: http://CSC3-2004-crl.verisign.com/CSC3-2004.crl]
]]

security: VeriSign Class 3 Code Signing 2004 CA
security: ObjectId: 2.5.29.31 Criticality=false
CRLDistributionPoints [
[DistributionPoint:
[URIName: http://crl.verisign.com/pca3.crl]
]]

security: This certificate does not have CRL extension
security: Use CRL setting from certificate
security: The OCSP support is enabled
security: sun microsystems, inc
security: ObjectId: 1.3.6.1.5.5.7.1.1 Criticality=false
AuthorityInfoAccess [
[accessMethod: 1.3.6.1.5.5.7.48.1
accessLocation: URIName: http://ocsp.verisign.com, accessMethod: 1.3.6.1.5.5.7.48.2
accessLocation: URIName: http://CSC3-2004-aia.verisign.com/CSC3-2004-aia.cer]
]

security: This certificate does not have AIA extension
security: This certificate does not have AIA extension
security: Use OCSP setting from certificate
security: Certificate validation succeeded using CRL
security: Certificate validation succeeded using OCSP
security: No timestamping info available
security: Checking if certificate is in Deployment denied certificate store
security: Checking if certificate is in Deployment permanent certificate store
java.security.AccessControlException: access denied (java.net.SocketPermission poczta.interia.pl resolve)
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkConnect(Unknown Source)
at java.net.InetAddress.getAllByName0(Unknown Source)
at java.net.InetAddress.getAllByName0(Unknown Source)
at java.net.InetAddress.getAllByName(Unknown Source)
at java.net.InetAddress.getByName(Unknown Source)
at java.net.InetSocketAddress.<init>(Unknown Source)
at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:232)
at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:189)
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1250)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:370)
at javax.mail.Service.connect(Service.java:275)
at javax.mail.Service.connect(Service.java:156)
at javaapplication6.NewApplet1$4.run(NewApplet1.java:127)
at java.security.AccessController.doPrivileged(Native Method)
at javaapplication6.NewApplet1.button1ActionPerformed(NewApplet1.java:102)
at javaapplication6.NewApplet1.access$100(NewApplet1.java:26)
at javaapplication6.NewApplet1$2.actionPerformed(NewApplet1.java:54)
at java.awt.Button.processActionEvent(Unknown Source)
at java.awt.Button.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

aha tutaj podalem cos sie stanie jak wcisne przycisk do wyslania maila... ale jak probuje zapisac plik gdzies na dysku to to samo sie dzieje (z drobna roznica ze nie dostal praw zapisu) ...

moj plik bezpieczenstwa wyglada :

keystore "ftp://paul121.w.interia.pl/build/classes/";

// A sample policy file that lets a program
// create demo.ini in user's home directory
// Satya N Dodda

grant SignedBy "company" {
permission java.security.AllPermission;
};

w pliku html mam wpisane:

<applet codebase="classes" code="javaapplication6/NewApplet1.class" archive="SSignedApplet.jar" width="350" height="200"><param name="file" value="/etc/inet/hosts"></applet>

a zamiast "/etc/inet/hosts" probowalem tez wpisywac "classes" choc w ogole nie wiem o co chodzi z tym parametrem :(
W ogole jakos tak jak mi netbeans wygenerowal tego html to jak go przesniose gdzies indziej to nawet jak poprzestawiam sciezki to i tak mi nie dziala... tylko jak jest katalog classes w tym katalogu co html to to sie applet odpala...

chyba nasalem juz tu wszystko co sie moze przydac przeanalizowania problemu

no i ja nie wiem jak to zrobic zeby ta przegladarka dala mi prawa dostepu [glowa]

1 użytkowników online, w tym zalogowanych: 0, gości: 1, botów: 0