Hi Alaska,
here is output I see on my console [1]. So seems request passes at
least to RequestControllerFilter.
Do you see different behavior?
Thanks.
WBR,
Alexey.
[1] run:
truststore file has been set
keystoreUrl file has been set
Aug 18, 2009 5:07:01 PM com.sun.grizzly.Controller start
INFO: Starting Grizzly Framework 1.9.18-SNAPSHOT - Tue Aug 18 17:07:00
CEST 2009
startBuffer
startBuffer
request GET / HTTP/1.1
Host: localhost:1080
RequestControllerFilter request GET / HTTP/1.1
Host: localhost:1080
Aug 18, 2009 5:12:46 PM com.sun.grizzly.DefaultProtocolChain
executeProtocolFilter
SEVERE: ProtocolChain exception
java.lang.SecurityException: /root/loginConfig.conf (No such file or
directory)
at
com.sun.security.auth.login.ConfigFile.<init>(ConfigFile.java:93)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at
sun
.reflect
.NativeConstructorAccessorImpl
.newInstance(NativeConstructorAccessorImpl.java:39)
at
sun
.reflect
.DelegatingConstructorAccessorImpl
.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:
513)
at java.lang.Class.newInstance0(Class.java:355)
at java.lang.Class.newInstance(Class.java:308)
at javax.security.auth.login.Configuration
$3.run(Configuration.java:246)
at java.security.AccessController.doPrivileged(Native Method)
at
javax
.security.auth.login.Configuration.getConfiguration(Configuration.java:
241)
at javax.security.auth.login.LoginContext
$1.run(LoginContext.java:237)
at java.security.AccessController.doPrivileged(Native Method)
at
javax.security.auth.login.LoginContext.init(LoginContext.java:234)
at
javax.security.auth.login.LoginContext.<init>(LoginContext.java:334)
at
GrizzlySSL
.RequestControllerFilter.initializeLogin(RequestControllerFilter.java:
94)
at
GrizzlySSL
.RequestControllerFilter.execute(RequestControllerFilter.java:45)
at
com
.sun
.grizzly
.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:
135)
at
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:
102)
at
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:
88)
at
com
.sun
.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:
53)
at
com
.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:
57)
at com.sun.grizzly.NIOContext.execute(NIOContext.java:510)
at
com
.sun
.grizzly
.SelectorHandlerRunner.handleSelectedKey(SelectorHandlerRunner.java:357)
at
com
.sun
.grizzly
.SelectorHandlerRunner.handleSelectedKeys(SelectorHandlerRunner.java:
257)
at
com
.sun.grizzly.SelectorHandlerRunner.doSelect(SelectorHandlerRunner.java:
194)
at
com.sun.grizzly.SelectorHandlerRunner.run(SelectorHandlerRunner.java:
129)
at com.sun.grizzly.util.FixedThreadPool
$BasicWorker.dowork(FixedThreadPool.java:379)
at com.sun.grizzly.util.FixedThreadPool
$BasicWorker.run(FixedThreadPool.java:360)
at java.lang.Thread.run(Thread.java:637)
Caused by: java.io.FileNotFoundException: /root/loginConfig.conf (No
such file or directory)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:106)
at java.io.FileInputStream.<init>(FileInputStream.java:66)
at
com.sun.security.auth.login.ConfigFile.getInputStream(ConfigFile.java:
591)
at
com.sun.security.auth.login.ConfigFile.init(ConfigFile.java:260)
at
com.sun.security.auth.login.ConfigFile.init(ConfigFile.java:202)
at
com.sun.security.auth.login.ConfigFile.<init>(ConfigFile.java:91)
... 28 more
On Aug 17, 2009, at 11:25 , Alaska wrote:
>
> Hello Alexey,
>
> the sample is in the attachement.
>
> Thank you,
> alaska. http://www.nabble.com/file/p25003689/GrizzlySSL.zip
> GrizzlySSL.zip
>
>
>
> Oleksiy Stashok wrote:
>>
>> Ok,
>> can you pls. send me the sample, so I can reproduce the issue?
>>
>> Thanks.
>>
>> WBR,
>> Alexey.
>>
>> On Aug 14, 2009, at 17:10 , Alaska wrote:
>>
>>>
>>> Hello Alexey,
>>>
>>> I added to my ParserProtovolFilter the method you suggested.
>>> But it didn"t solve the problem yet.
>>>
>>> alaska
>>>
>>> ++++++++++++++++++++++++++++++++++
>>>
>>> import com.sun.grizzly.ProtocolParser;
>>> import com.sun.grizzly.filter.ParserProtocolFilter;
>>>
>>> public class AsciiCommandProtocolParserFilter extends
>>> ParserProtocolFilter
>>> {
>>>
>>>
>>>
>>> + public AsciiCommandProtocolParserFilter() {
>>> + this.setSkipRead(true);
>>> + }
>>>
>>> @Override
>>> public ProtocolParser newProtocolParser() {
>>>
>>> return new HttpStreamReader();
>>>
>>> }
>>> }
>>>
>>>
>>> Oleksiy Stashok wrote:
>>>>
>>>> Hi Alaska,
>>>>
>>>> pls. try to set setSkipRead(true); on your ParserProtocolFilters.
>>>> Please let me know if it helped.
>>>>
>>>> WBR,
>>>> Alexey.
>>>>
>>>> On Aug 14, 2009, at 15:57 , Alaska wrote:
>>>>
>>>>>
>>>>> Dear Alexey,
>>>>>
>>>>> I"ve just found the mistake with the controller.
>>>>> I removed the SSLConnectorHandler, the SSLCallbackHandler and the
>>>>> line
>>>>> sslConnector.connect(new InetSocketAddress("localhost", PORT),
>>>>> callbackSSL);
>>>>>
>>>>> Now it seems that the connection was etablished...
>>>>>
>>>>> But I have a problem that I cannot get the request... The
>>>>> ParserFilter is
>>>>> not being invoked.
>>>>>
>>>>> The browser message is: Data Transfer Interrupted
>>>>> The connection to localhost:1080 was interrupted while the page
>>>>> was
>>>>> loading.
>>>>> The browser connected successfully, but the connection was
>>>>> interrupted while
>>>>> transferring information.
>>>>>
>>>>> Do you have an idea what is still wrong?
>>>>>
>>>>> thank you!
>>>>> alaska
>>>>>
>>>>>
>>>>> ++++++++++++++++++++++++++++++++++++++++
>>>>> The SSLConnectionTest.java looks like:
>>>>>
>>>>> package Grizzly2httpSSL;
>>>>>
>>>>>
>>>>> import
>>>>> Grizzly2httpSSL.Protocols.Http.AsciiCommandProtocolParserFilter;
>>>>> import com.sun.grizzly.Context;
>>>>> import com.sun.grizzly.Controller;
>>>>> import com.sun.grizzly.DefaultProtocolChain;
>>>>> import com.sun.grizzly.DefaultProtocolChainInstanceHandler;
>>>>> import com.sun.grizzly.IOEvent;
>>>>> import com.sun.grizzly.ProtocolChain;
>>>>> import com.sun.grizzly.ProtocolChainInstanceHandler;
>>>>> import com.sun.grizzly.ProtocolFilter;
>>>>> import com.sun.grizzly.SSLCallbackHandler;
>>>>> import com.sun.grizzly.SSLConfig;
>>>>> import com.sun.grizzly.SSLConnectorHandler;
>>>>> import com.sun.grizzly.SSLSelectorHandler;
>>>>> import com.sun.grizzly.filter.SSLReadFilter;
>>>>> import com.sun.grizzly.filter.SSLEchoFilter;
>>>>> import java.io.File;
>>>>> import java.io.IOException;
>>>>> import java.net.InetSocketAddress;
>>>>> import java.net.URL;
>>>>> import java.nio.ByteBuffer;
>>>>> import java.nio.channels.SelectionKey;
>>>>> import java.util.Arrays;
>>>>> import java.util.concurrent.CountDownLatch;
>>>>> import java.util.concurrent.TimeUnit;
>>>>> import java.util.logging.Level;
>>>>> import java.util.logging.Logger;
>>>>> import javax.net.ssl.SSLContext;
>>>>>
>>>>>
>>>>> public class SSLConnectionTest {
>>>>>
>>>>>
>>>>> String TRUST_STORE_PROP = "truststoreSSLtest.jks";
>>>>> String KEY_STORE_PROP = "serverkey.jks";
>>>>> public static final int PORT = 1080;
>>>>> public static final int PACKETS_COUNT = 10;
>>>>> public static final int CLIENTS_COUNT = 10;
>>>>> /**
>>>>> * A <code>SSLCallbackHandler</code> handler invoked by the
>>>>> TCPSelectorHandler
>>>>> * when a non blocking operation is ready to be processed.
>>>>> */
>>>>> private SSLCallbackHandler callbackHandler;
>>>>> private SSLConfig sslConfig;
>>>>>
>>>>> public void setUp() {
>>>>> sslConfig = new SSLConfig();
>>>>>
>>>>> File file = new File(TRUST_STORE_PROP);
>>>>>
>>>>> if (file != null) {
>>>>> sslConfig.setTrustStoreFile(file.getAbsolutePath());
>>>>> System.out.println("truststore file has been set");
>>>>>
>>>>> } else {
>>>>> System.out.println("Couldn't find the truststore file");
>>>>>
>>>>> }
>>>>>
>>>>> File file1 = new File(KEY_STORE_PROP);
>>>>>
>>>>>
>>>>> //the keystore will be used for encrypting/signing some thing
>>>>> with
>>>>> your private key
>>>>> // URL keystoreUrl =
>>>>> getClass().getClassLoader().getResource("serverkey.jks");
>>>>> if (file1 != null) {
>>>>> sslConfig.setKeyStoreFile(file1.getAbsolutePath());
>>>>> System.out.println("keystoreUrl file has been set");
>>>>>
>>>>> } else {
>>>>> System.out.println("Couldn't find the keystore");
>>>>>
>>>>> }
>>>>> SSLConfig.DEFAULT_CONFIG = sslConfig;
>>>>> final Controller controller =
>>>>> createSSLController(SSLConfig.DEFAULT_CONFIG.createSSLContext());
>>>>> try {
>>>>> controller.start();
>>>>> } catch (IOException ex) {
>>>>>
>>>>> Logger
>>>>> .getLogger(SSLConnectionTest.class.getName()).log(Level.SEVERE,
>>>>> "the
>>>>> SSL controller couldn't not been started", ex);
>>>>> }
>>>>> }
>>>>>
>>>>>
>>>>>
>>>>> private Controller createSSLController(SSLContext sslContext) {
>>>>>
>>>>>
>>>>> final SSLReadFilter readFilter = new SSLReadFilter();
>>>>> readFilter.setSSLContext(sslContext);
>>>>> readFilter.isNeedClientAuth();
>>>>>
>>>>> final ProtocolFilter asciiCommandParser = new
>>>>> AsciiCommandProtocolParserFilter();
>>>>>
>>>>> final ProtocolFilter genericProtocolFilter = new
>>>>> RequestControllerFilter();
>>>>>
>>>>> final ProtocolFilter genericDoor = new GenericDoor();
>>>>>
>>>>> SSLSelectorHandler selectorHandler = new
>>>>> SSLSelectorHandler();
>>>>> selectorHandler.setPort(PORT);
>>>>>
>>>>> final Controller controller = new Controller();
>>>>>
>>>>> controller.setSelectorHandler(selectorHandler);
>>>>> controller.setHandleReadWriteConcurrently(false);
>>>>>
>>>>> final ProtocolChain protocolChain = new
>>>>> DefaultProtocolChain();
>>>>>
>>>>> protocolChain.addFilter(readFilter);
>>>>> protocolChain.addFilter(asciiCommandParser);
>>>>> protocolChain.addFilter(genericProtocolFilter);
>>>>> protocolChain.addFilter(genericDoor);
>>>>>
>>>>> ((DefaultProtocolChain)
>>>>> protocolChain).setContinuousExecution(true);
>>>>>
>>>>>
>>>>> ProtocolChainInstanceHandler pciHandler = new
>>>>> DefaultProtocolChainInstanceHandler() {
>>>>>
>>>>> @Override
>>>>> public ProtocolChain poll() {
>>>>> return protocolChain;
>>>>> }
>>>>>
>>>>> @Override
>>>>> public boolean offer(ProtocolChain pc) {
>>>>> return false;
>>>>> }
>>>>> };
>>>>>
>>>>> controller.setProtocolChainInstanceHandler(pciHandler);
>>>>>
>>>>> controller.setReadThreadsCount(5); //
>>>>>
>>>>> return controller;
>>>>> }
>>>>>
>>>>>
>>>>> }
>>>>>
>>>>> --
>>>>> View this message in context:
>>>>> http://www.nabble.com/SSL-Layer-tp24954939p24972156.html
>>>>> Sent from the Grizzly - Users mailing list archive at Nabble.com.
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
>>>>> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
>>>> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>>>>
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/SSL-Layer-tp24954939p24973322.html
>>> Sent from the Grizzly - Users mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
>>> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
>> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/SSL-Layer-tp24954939p25003689.html
> Sent from the Grizzly - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>