Add OPTION=rewrite to your ${jetty.home/start.ini

--
Joakim Erdfelt <[email protected]>
webtide.com <http://www.webtide.com/>
Developer advice, services and support
from the Jetty & CometD experts
eclipse.org/jetty - cometd.org


On Wed, Jun 5, 2013 at 8:06 AM, O. Olson <[email protected]> wrote:

>
>
> Hi,
>
>             I did not
> notice this before, but I get an exception when I started Jetty on the
> Commandline. I did not notice this before because I thought the exception
> should have been redirected to the log file.
>
> 2013-06-05 09:37:03.279:WARN:oejx.XmlConfiguration:main:
> Config error at <New id
> ="Rewrite"
> class="org.eclipse.jetty.rewrite.handler.RewriteHandler"><Set
> name="r
> ewriteRequestURI">true</Set><Set
> name="rewritePathInfo">false</Set><Set name="or
> iginalPathAttribute">requestedPath</Set><Call
> name="addRule"><Arg>|          <Ne
> w
> class="org.eclipse.jetty.rewrite.handler.RedirectPatternRule"><Set
> name="patte
> rn">^$</Set><Set
> name="replacement">/solr</Set></New>|        </Arg></Call></New
> > java.lang.ClassNotFoundException:
> org.eclipse.jetty.rewrite.handler.RewriteHan
> dler in file:/C:/Users/<<MyUserName>>/Documents/Jetty/Jetty9/etc/jetty.xml
> java.lang.reflect.InvocationTargetException
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>         at
> java.lang.reflect.Method.invoke(Unknown Source)
>         at
> org.eclipse.jetty.start.Main.invokeMain(Main.java:509)
>         at
> org.eclipse.jetty.start.Main.start(Main.java:651)
>         at
> org.eclipse.jetty.start.Main.main(Main.java:99)
> Caused by: java.lang.ClassNotFoundException:
> org.eclipse.jetty.rewrite.handler.R
> ewriteHandler
>         at
> java.net.URLClassLoader$1.run(Unknown Source)
>         at
> java.net.URLClassLoader$1.run(Unknown Source)
>         at
> java.security.AccessController.doPrivileged(Native Method)
>         at
> java.net.URLClassLoader.findClass(Unknown Source)
>         at
> java.lang.ClassLoader.loadClass(Unknown Source)
>         at
> java.lang.ClassLoader.loadClass(Unknown Source)
>         at
> org.eclipse.jetty.util.Loader.loadClass(Loader.java:100)
>         at
> org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.nodeClas
> s(XmlConfiguration.java:354)
>         at
> org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.newObj(X
> mlConfiguration.java:743)
>         at
> org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configur
> e(XmlConfiguration.java:413)
>         at
> org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configur
> e(XmlConfiguration.java:344)
>         at
> org.eclipse.jetty.xml.XmlConfiguration.configure(XmlConfiguration.jav
> a:262)
>         at
> org.eclipse.jetty.xml.XmlConfiguration$1.run(XmlConfiguration.java:12
> 24)
>         at
> java.security.AccessController.doPrivileged(Native Method)
>         at
> org.eclipse.jetty.xml.XmlConfiguration.main(XmlConfiguration.java:116
> 0)
>         ... 7 more
>
> Usage: java -jar start.jar [options] [properties] [configs]
>        java -jar
> start.jar --help  # for more information
>
>
> I think this may be the reason it is failing to redirect.
> O. O.
>
>
>
> ________________________________
> De: O. Olson <[email protected]>
> Para: "[email protected]" <[email protected]>
> Enviado: MiƩrcoles, 5 de junio, 2013 9:30 A.M.
> Asunto: Jetty 9 Redirect from Root to Sub-Directory.
>
>
>
> Hi,
>
>             I have
> downloaded Jetty 9, and I am curious how to do a redirect from the root to
> a
> particular sub directory. I basically want to redirect from
> http://localhost:7070/ to http://localhost:7070/solr/. I looked at
> http://www.eclipse.org/jetty/documentation/current/jetty-handlers.html#rewrite-handlerand
>  I added the following to the bottom of my jetty.xml.
>
> <!-- create and configure the rewrite handler -->
>     <New
> id="Rewrite"
> class="org.eclipse.jetty.rewrite.handler.RewriteHandler">
>       <Set
> name="rewriteRequestURI">true</Set>
>       <Set
> name="rewritePathInfo">false</Set>
>       <Set
> name="originalPathAttribute">requestedPath</Set>
>
>       <!-- redirect
> the response. This is a redirect which is visible to the browser.
>            After the
> redirect, the browser address bar will show /redirected -->
>       <Call name="addRule">
>         <Arg>
>           <New
> class="org.eclipse.jetty.rewrite.handler.RedirectPatternRule">
>             <Set
> name="pattern">^$</Set>
>             <Set
> name="replacement">/solr</Set>
>           </New>
>         </Arg>
>       </Call>
>     </New>
>
>             <!-- add
> the rewrite handler to the server -->
>     <Set
> name="handler"><Ref id="Rewrite" /></Set>
>
>  Is this pattern "^$"
> correct for my situation? Thank you for all your help.
>
> O. O.
> _______________________________________________
> jetty-users mailing list
> [email protected]
> https://dev.eclipse.org/mailman/listinfo/jetty-users
>
_______________________________________________
jetty-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/jetty-users

Reply via email to