tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pid...@pidster.com>
Subject Re: AW: AW: Permanent Redirect?
Date Thu, 30 Apr 2009 11:21:04 GMT
Alexander Diedler wrote:
> Sure, but I found only a solution to redirect folders on the same domain,
> but not to rewrite/redirect a complete domain with URL parameters.

In that case, perhaps this filter isn't what you need. YMMV.
It would be trivial to write a filter that executes a redirect of the
sort you need wouldn't it?

public void doFilter(ServletRequest req, ServletResponse res,
FilterChain chain) throws IOException, ServletException {
        //
	HttpServletRequest hreq = (HttpServletRequest) req;
        HttpServletResponse hres = (HttpServletResponse) res;

	String path = hreq.getRequestURI();
	String query = hreq.getQueryString();

	String newServer = "new.yourserver.com";
	
	hres.sendRedirect("http://" + newServer + path "?" + query);
}

(Use of reply-to-all should be banned.  Please just reply to the list so
I don't get two answers every time.)

p


> -----Urspr√ľngliche Nachricht-----
> Von: Pid [mailto:p@pidster.com] 
> Gesendet: Donnerstag, 30. April 2009 11:51
> An: Tomcat Users List
> Betreff: Re: AW: Permanent Redirect?
> 
> Alexander Diedler wrote:
>> Hmm..
>> Seems not to be work for me.... The target is a
> http://www.siteA.de/index.jsp?WERWERWERWERWER redirect to
> http://www.siteB.de/index.jsp?WERWERWERWERWER
>> I download the package, unzip and put the new content to a new, empty
> docBase folder. I edit my ROOT.xml in SiteA point to this new folder and
> create an empty web.xml that contains only 
>>   <filter>
>>            <filter-name>UrlRewriteFilter</filter-name>
>>
> <filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-cla
> ss>
>>         </filter>
>>         <filter-mapping>
>>            <filter-name>UrlRewriteFilter</filter-name>
>>            <url-pattern>/*</url-pattern>
>>         </filter-mapping>
>>
>> But where I have to define, what is the target of the redirect?
> 
> Have you read: http://tuckey.org/urlrewrite/manual/3.0/
> 
> p
> 
> 
>> My Tomcat:
>> [tomcat-base]/conf/Catalina/www.siteA.de/ROOT.xml  (Context docBase point
> to D:\Inetpub\SiteA)
>> [tomcat-base]/conf/Catalina/www.siteB.de/ROOT.xml  (Context docBase point
> to D:\Inetpub\SiteA)
>> [tomcat-base]/conf/Catalina/www.siteC.de/ROOT.xml  (Context docBase point
> to D:\Inetpub\SiteA)
>> Same DocBase because it is a CMS with the functionality to show different
> content for different domains.
>> Server.xml:
>> <Connector protocol="org.apache.coyote.http11.Http11Protocol"
>>            port="443" address="xxx.xxx.xxx.209" addressminSpareThreads="5"
> maxSpareThreads="75"
>>            enableLookups="true" disableUploadTimeout="true" 
>>            acceptCount="100"  maxThreads="200"
>>            scheme="https" secure="true" SSLEnabled="true"
>>            keystoreFile="D:/Keystore/siteA.kdb" keystorePass="changeit"
>>            clientAuth="false" sslProtocol="TLS"/>
>>
>> 	 <Connector protocol="org.apache.coyote.http11.Http11Protocol"
>>            port="443" address="xxx.xxx.xxx.210" addressminSpareThreads="5"
> maxSpareThreads="75"
>>            enableLookups="true" disableUploadTimeout="true" 
>>            acceptCount="100"  maxThreads="200"
>>            scheme="https" secure="true" SSLEnabled="true"
>>            keystoreFile="D:/Keystore/siteB.kdb" keystorePass="changeit"
>>            clientAuth="false" sslProtocol="TLS"/>
>>
>> 	 <Connector protocol="org.apache.coyote.http11.Http11Protocol"
>>            port="443" address="xxx.xxx.xxx.211" addressminSpareThreads="5"
> maxSpareThreads="75"
>>            enableLookups="true" disableUploadTimeout="true" 
>>            acceptCount="100"  maxThreads="200"
>>            scheme="https" secure="true" SSLEnabled="true"
>>            keystoreFile="D:/Keystore/www_siteC.kdb"
> keystorePass="changeit"
>>            clientAuth="false" sslProtocol="TLS"/>
>>
>> If this is a very bad configuration, I am open for any better suggestions
> of you...
>> Greetings
>> Alexander Diedler
>>
>>
>> -----Urspr√ľngliche Nachricht-----
>> Von: Pid [mailto:p@pidster.com] 
>> Gesendet: Montag, 27. April 2009 11:11
>> An: Tomcat Users List
>> Betreff: Re: Permanent Redirect?
>>
>> Alexander Diedler wrote:
>>> Hello everybody,
>>>
>>> I have a question to implement a permanent redirect for an old domain to
>>> a new domain on the Tomcat 6.0.16 Server.
>>>
>>> It is definied in the server.xml as it own connector (for SSL) and now
>>> we want, that if we fill-in www.websiteA.de <http://www.websiteA.de> we
>>> will be redirected to www.websiteB.de <http://www.websiteB.de>
>>> automatically.
>> A small webapp deployed in websiteA.de/ROOT that contains a servlet
>> Filter which is coded to issue an appropriate redirect to the new URL.
>>
>> You could avoid rolling your own and try: tuckey.org/urlrewrite/
>>
>> p
>>
>>
>>> Greetings
>>>
>>> Alexander
>>>
>>>  
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message