Deyan Sultov

Ranch Hand
+ Follow
since Jul 01, 2002
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Deyan Sultov

Hi All,

I have the following technical specification:
1. Web based system
2. Message exchange format - XML
3. Database persistence

The problem:
Can someone help me with proposal what kind of framework I can use to facilitate this project. Particularly I am interested in something that can help me to:
1. Create XML from a given XSD. Creation of the XML could be either read data already stored in DB or use data entered by the user in a series of web input forms
2. Verify XML against given XSD
3. Persist data stored in XML objects to a database

Thanks in advance.

Regards,
Deyan
Hello all,

is it possible to add custom headers before submitting a form?

[problem]
I have to implement automatic login to a site which uses Basic Authentication. I need somehow to add the following header:
Authorization Basic base64enc(user : pass)
before submiting to the protected site.

Thanks in advance,
Deyan
[ May 09, 2005: Message edited by: Deyan Sultov ]
18 years ago
You mean to try something like
RequestDispatcher rd = request.getRequestDispatcher("URL to GO");
response.setHeader("Authorization", "Basic " + encoding);
rd.forward(request, response);

Unfortunately the request.getRequestDispatcher(String path) expects a path which is not outside of the current context. In my case the path is of a completely different site.
18 years ago
Hello All,

[Background]
I have a simple JSP - Servlet application that user interacts with. There is a possibility user to define a set of URL's(as well as user/pass if they are protected) which later he can visit by pressing a button. The user should be able to log authomatically no matter whether these sites are pass protected.

[Problem]
One of these sites uses Basic Authentication. Is is possible to implement an authomatic login in this case. I tried the following mechanism but it didn't work:

String userPassword = theUsername + ":" + thePassword;
String encoding = new sun.misc.BASE64Encoder().encode (userPassword.getBytes());
response.setHeader("Authorization", "Basic " + encoding);
response.sendRedirect('URL to GO');

Please can you help me.

Thanks in advance,
Deyan
[ May 05, 2005: Message edited by: Deyan Sultov ]
18 years ago
Hi All,

I am running web application under Tomcat, using Struts. I have disabled my browser's cookies, so that I want to test the proper encoding of my url links. So far so good. The problem is that I can not figure out why this piece of code,

<html-el:link href="/editRegistration.do?action=Create">

whithin the JSP's is giving different output:



- when I start Tomcat under root context, it works and encodes the link I have passed to it (appends ;jsessionid= to the url):
<Context path=""
docBase="E:\Work\Eclipse\struts_app\web"
debug="0"
reloadable="true"
crossContext="true">
</Context>


- when I start Tomcat with some context it does not work and does not encode the link I have paases to it
<Context path="/ctx"
docBase="E:\Work\Eclipse\struts_app\web"
debug="0"
reloadable="true"
crossContext="true">
</Context>

Any hints?

Thanks in advance
[ October 19, 2004: Message edited by: Deyan Sultov ]
19 years ago
Hi there,

I have the following configuration: Tomcat, JSTL, Struts.

1. The Tomcat's server.xml contains the following context section:

<Context path="" docBase="/path-to-unpackedWAR/">
<Parameter name="some-name" value="some-value"/>
<Logger className="org.apache.catalina.logger.FileLogger" prefix="localhost_myapp_log." suffix=".txt" timestamp="true"/>
</Context>

the docBase elements points to the location where previously I have unpacked the application's war file.

2. Used is JSTL's <c:url> tag to ensure URL encoding (for disabled cookies scenario).

RESULT:
Running Tomcat went smoothly and the application has been starteed normally. Everything works fine in the case that the browser has enabled cookies.

THE PROBLEM: when cookies has been disabled in the browser, this ends up in encoding sessionid 2 times thus resulting in not available resource. I.e. when I poin to the link produced by <c:url value="some-resource"> this will produce the following link : http://mysite.com/some-resource;jsessionid=##some_id##;jsessionid=##some_id##

What I have found:
If I change the path element of the Context (i.e <Context path="/it_works") and access the site by http://mysite.com/it_works then everythink is fine. the <c:url value="some-resource"> encodes url properly and gives the following http://mysite.com/it_works/some-resource;jsessionid=##some_id##

Question: Where is the problem, is anybody can help. Is there any parameters that have to be set additionally?
19 years ago
JSP
Hi there,

I have the following configuration: Tomcat, JSTL, Struts.

1. The Tomcat's server.xml contains the following context section:

<Context path="" docBase="/path-to-unpackedWAR/">
<Parameter name="some-name" value="some-value"/>
<Logger className="org.apache.catalina.logger.FileLogger" prefix="localhost_myapp_log." suffix=".txt" timestamp="true"/>
</Context>

the docBase elements points to the location where previously I have unpacked the application's war file.

2. Used is JSTL's <c:url> tag to ensure URL encoding (for disabled cookies scenario).

RESULT:
Running Tomcat went smoothly and the application has been starteed normally. Everything works fine in the case that the browser has enabled cookies.

THE PROBLEM: when cookies has been disabled in the browser, this ends up in encoding sessionid 2 times thus resulting in not available resource. I.e. when I poin to the link produced by <c:url value="some-resource"> this will produce the following link : http://mysite.com/some-resource;jsessionid=##some_id##;jsessionid=##some_id##

What I have found:
If I change the path element of the Context (i.e <Context path="/it_works") and access the site by http://mysite.com/it_works then everythink is fine. the <c:url value="some-resource"> encodes url properly and gives the following http://mysite.com/it_works/some-resource;jsessionid=##some_id##

Question: Where is the problem, is anybody can help. Is there any parameters that have to be set additionally?
19 years ago
Hi there,

I have the following configuration:
Tomcat, JSTL, Struts.
1. The Tomcat's server.xml contains the following context section:

<Context path="" docBase="/path-to-unpackedWAR/">
<Parameter name="some-name" value="some-value"/>
<Logger className="org.apache.catalina.logger.FileLogger" prefix="localhost_myapp_log." suffix=".txt" timestamp="true"/>
</Context>

the docBase elements points to the location where previously I have unpacked the application's war file.

2. Used is JSTL's <c:url> tag to ensure URL encoding (for disabled cookies scenario).

RESULT:
Running Tomcat went smoothly and the application has been starteed normally. Everything works fine in the case that the browser has enabled cookies.

THE PROBLEM: when cookies has been disabled in the browser, this ends up in encoding sessionid 2 times thus resulting in not available resource. I.e. when I poin to the link produced by <c:url value="some-resource"> this will produce the following link : http://mysite.com/some-resource;jsessionid=##some_id##;jsessionid=##some_id##

What I have found:
If I change the path element of the Context (i.e <Context path="/it_works") and access the site by http://mysite.com/it_works then everythink is fine. the <c:url value="some-resource"> encodes url properly and gives the following http://mysite.com/it_works/some-resource;jsessionid=##some_id##

Question: Where is the problem, is anybody can help. Is there any parameters that have to be set additionally?
[ October 13, 2004: Message edited by: Deyan Sultov ]
19 years ago
I found the answer:
RewriteMap element can distribute load between them. But since Apache is not a load-balancer and no mechanisms like "sticky session" is supported (as in ajp13) each successive request can end up on a new server where session is lost. Thats why we have to implement clusterind and HTTP Session replication:
1. Ensure that jbossha-httpsession.sar is found in \all\deploy.
2. Ensure that cluster-service.xml is found in \all\deploy and properly configured.
3. Add to \all\deploy\jbossweb-jetty.sar\META-INF\jboss-service.xml
<Set name="store">
<New class="org.jboss.jetty.session.ClusterStore">
<Set name="actualMaxInactiveInterval">604800</Set>
<Set name="scavengerPeriod">3600</Set>
<Set name="scavengerExtraTime">900</Set>
</New>
</Set>
4. Add to web.xml
<web-app>
<distributable/>
.......................
<web-app>
5. Run jboss with run -c all parameter.
20 years ago
Hi,
I want to loadbalance several backend servers (JBoss - Jetty). I also have restriction not to use ajp13(because it can not support SSL protocol). Thats why I use Apache + mod_rewrite + mod_proxy. We have 3 servers:
http://server_one:8080/somecontext/
http://server_two:8080/somecontext/
http://server_tree:8080/somecontext/
The modification in httpd.conf
Listen 80
<VirtualHost _default_:80>
RewriteEngine on
RewriteLog logs/proxy_rewrite.log
RewriteLogLevel 9
RewriteMap server rnd:/conf/rproxy.conf

RewriteRule^(http|https)://.* - [F]
RewriteRule ^/$/somecontext/[R]
RewriteRule ^/(.*)$to://${server:web}/$1
RewriteRule ^to://([^/]+)/(.*) http://$1/$2 [P,L]

ProxyRequestsOn
ProxyPassReverse / http://server_one:8080/
ProxyPassReverse / http://server_two:8080/
ProxyPassReverse / http://server_tree:8080/
</VirtualHost>
the file rproxy.conf contains:
www server_one:8080|server_two:8080|server_tree:8080
So far, so good. I can access http://server/ and mod_rewrite randomly chooses one of the servers ant distributes request to it. It is reverese proxied to http://server/context, so the end user is not aware for the real name of the server. But the problem is that there is no mechanism like "sticky sessions" provided (like in ajp13), so once I log in.. i the next request I am happily distributed to other server where no session is exported. Can someone help me with any idea on how to overcome this? Is there a mechanism of Session Replication in JBoss. Any suggestions, links, literature.
Thanks in advance.
[ July 11, 2003: Message edited by: Deyan Sultov ]
20 years ago
Ok. I find solution for rewriting:
in httpd.conf
<VirtualHost _default_:80>
RewriteEngine on
RewriteLog logs/proxy_rewrite.log
RewriteLogLevel 9
RewriteMap server rnd:rproxy.conf
RewriteRule^(http|https)://.*-[F]
RewriteRule^/(.*)$to://${server:web}/$1
RewriteRule^to://([^/]+)/(.*) http:// $1/$2[P,L]
RewriteRule.*-[F]
ProxyRequestsOn
ProxyPassReverse / http://server_1:8080/
ProxyPassReverse / http://server2:8080/
</VirtualHost>
where rproxy.conf contains:
www server_1:8080|server_2:8080
but still I can not find the solutions with sessions. Each time mod_rewrite + rnd dispatches to a new server where no session received by previos login exist.Anyone can help?
Is it possible at all loadbalancing of servlet/jsp site to be done with Apache + mod_proxy + mod_rewrite?
[ July 10, 2003: Message edited by: Deyan Sultov ]
20 years ago
I have 3 tomcat servers running on different machines and Apache server running on another machine. I want to make Apache
reverseproxing and loadbalancing this backend servers.
What I have done:
=================
1. In Apache's httpd.conf:
<VirtualHost _default_:80>
ServerName www.myserver.com
RewriteEngine on
RewriteMap server rnd:/rewrite/rproxy.conf
RewriteRule ^/(.*)$ to://${server:web|tomcat_1:8080}/somecontext
RewriteRule ^to://([^/]+)/(.*) http://$1/$2 [P,L]
RewriteRule .* - [F]
#ProxyRequests On
#ProxyPassReverse / http://myserver:8080/somecontext/
#ProxyPassReverse / http://otherserver:8080/somecontext/
#ProxyPassReverse / http://someotherserver:8080/somecontext/
</VirtualHost>
2. In rproxy.conf
www myserver:8080|otherserver:8080|someotherserver:8080
What I want:
==============
1. When type in www.myserver.com to be dispatched to one of the the backend servers.
The above mention code works fine. When I type www.myserver.com I received
http://myserver:8080/somecontext or
http://otherserver:8080/somecontext or
http://someotherserver:8080/somecontext
2.The real backend server hostname to be masked to www.myserver.com.
Unfortunately I can not achive this. If uncomment the ProxyPassReverse directives Apache enters recursion.
http://www.myserver.com - > gets rewrited to http://myserver:8080/jmx-console which is ProxyPassed to http://www.myserver.com
.. and so on..

Issues:
============
What will happen if eventually I succeed with Rewriting, then sessions will be lost.
Can someone help me with this problems?
Thanks in advance
20 years ago
I have used JBoss3.2.0 with Jetty and put my app.ear under /server/default/deploy directory. Everything is fine.
I tried to do the same with jboss-3.2.0_tomcat-4.1.24 and put my ear under /server/default/deploy
and received the following HTTP Status 400 - Invalid direct reference to form login page
What's wrong?
20 years ago
Does AJP13 can supprt SSL? If yes, where can I find documents on that matter?
I have read that it supports SSL and make the following settings in Apache's httpd.conf
=========================================
httpd.conf
=========================================
LoadModule jk_module modules/mod_jk_2.0.45.dll
Listen 80
<IfModule mod_ssl.c>
Include conf/ssl/ssl.conf
</IfModule>
Include conf/jk/mod_jk.conf
<VirtualHost _default_:443>
SSLEngine on


ServerAdmin AJP13@myweb.com
ErrorLog logs/AJP13.error_log
CustomLog logs/AJP13.access_log common
</VirtualHost>
=========================================
ssl.conf
=========================================
Listen 443
SSLPassPhraseDialog builtin
SSLSessionCache none
SSLSessionCacheTimeout 300
SSLMutex none
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
SSLOptions +StdEnvVars +ExportCertData
SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
LogFormat "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b" common
CustomLog logs/ssl_request_log common
SSLCertificateFile conf/ssl/server.crt
SSLCertificateKeyFile conf/ssl/server.key

=========================================
mod_jk.conf
=========================================
JkWorkersFile conf/jk/workers.properties
JkLogFile logs/jk.log
JkLogLevel emerg
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
JkExtractSSL On
JkHTTPSIndicator HTTPS
JkSESSIONIndicator SSL_SESSION_ID
JkCIPHERIndicator SSL_CIPHER
JkCERTSIndicator SSL_CLIENT_CERT
JkMount /* loadbalancer
JkMount / loadbalancer
The problem is that Jetty throws exception that it can not recognize parameters although in mod_jk.conf Jk directives provide HTTPS, SSL_SESSION_ID, SSL_CIPHER and SSL_CLIENT_CERT
--------------------------
Console output:
11:45:30,648 WARN [jbossweb] WARNING: Unknown attr: 11=�6; jsessionid=981031052403183774
☺0 ♣ Saction=inspectMBean&name=jboss.deployment%3Atype%3DDeploymentScanner%2Cflavor%3DURL

11:45:30,648 WARN [jbossweb] WARNING:
java.lang.StringIndexOutOfBoundsException: String index out of range: 27818
at java.lang.String.checkBounds(String.java:292)
at java.lang.String.<init>(String.java:326)
at org.mortbay.http.ajp.AJP13Packet.getString(AJP13Packet.java:288)
at org.mortbay.http.ajp.AJP13Connection.handleNext(AJP13Connection.java:196)
at org.mortbay.http.HttpConnection.handle(HttpConnection.java:792)
at org.mortbay.http.ajp.AJP13Listener.handleConnection(AJP13Listener.java:204)
at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:289)
at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:455)
----------------------------

Any suggestions will be in great help
Thanks in advance
[ May 21, 2003: Message edited by: Deyan Sultov ]
[ May 22, 2003: Message edited by: Deyan Sultov ]
20 years ago
Help,
I have added the following lines in Apache's httpd.conf:
<VirtualHost *:80>
ServerName www.myserver.com
RewriteEngine on
RewriteMap server rnd:/rewrite/rproxy.conf
RewriteRule ^/(.*)$ to://${server:web|myserver:8080}/jmx-console
RewriteRule ^to://([^/]+)/(.*) http://$1/$2 [P,L]
RewriteRule .* - [F]
#ProxyRequests On
#ProxyPassReverse / http://myserver:8080/jmx-console/
#ProxyPassReverse / http://otherserver:8080/jmx-console/
#ProxyPassReverse / http://someotherserver:8080/jmx-console/
</VirtualHost>
--------------
rproxy.conf
--------------
www myserver:8080|otherserver:8080|someotherserver:8080

I want:
1. When type in www.myserver.com to be dispatched to one of the the backend servers.
The above mention code works fine. When I type www.myserver.com I received
http://myserver:8080/jmx-console or
http://otherserver:8080/jmx-console or
http://someotherserver:8080/jmx-console
2.The real backend server hostname to be masked to www.myserver.com.
Unfortunately I can not achive this. If uncomment the Proxy directives Apache enters recursion.
http://www.myserver.com - > gets rewrited to http://myserver:8080/jmx-console which is ProxyPassed to http://www.myserver.com .. and so on..
how can I solve this problem
Thanks in advance
[ May 21, 2003: Message edited by: Deyan Sultov ]
[ May 21, 2003: Message edited by: Deyan Sultov ]
20 years ago