<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">

<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>

                                <td>

                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="http://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>

                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px;  -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
    Passing a Regex to RestEasy via the URL ?
</h3>
<span style="margin-bottom: 10px;">
    created by <a href="http://community.jboss.org/people/crashmeister">Craig Horrell</a> in <i>JBoss Web Services</i> - <a href="http://community.jboss.org/message/602298#602298">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p>Hi,</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I am trying to pass a Regex via the URL to a reasteasy Web Service. In the JS I use encodeURL() to encode it. On the server side, it gets decoded before being parsed and then gets a parse error.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Encoded URL:</p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;"><a class="jive-link-external-small" href="http://localhost:8180/rest/resource/v2/weightTol/insertNew&amp;clientRef=test3&amp;client=99999&amp;forcePrint=false&amp;trackFmt=%5E420%5B0-9%5D%7B5%7D91%5B0-9%5D%7B20%7D$" target="_blank">http://localhost:8180/rest/resource/v2/weightTol/insertNew&amp;clientRef=test3&amp;client=99999&amp;forcePrint=false&amp;trackFmt=%5E420%5B0-9%5D%7B5%7D91%5B0-9%5D%7B20%7D$</a></span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Decoded URL (from stack trace):</p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;"><a class="jive-link-external-small" href="http://localhost:8180/rest/resource/v2/weightTol/insertNew?clientRef=test3&amp;client=99999&amp;forcePrint=false&amp;trackFmt=^420" target="_blank">http://localhost:8180/rest/resource/v2/weightTol/insertNew?clientRef=test3&amp;client=99999&amp;forcePrint=false&amp;trackFmt=^420</a><span>[0-9]{5}91[0-9]{20}$</span></span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Stack Trace:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;">2011-04-27 11:14:49,043 WARN&#160; [org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher] Failed to parse request.</span></p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;">java.lang.IllegalArgumentException</span></p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;">&#160;&#160;&#160; at java.net.URI.create(URI.java:842)</span></p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;">&#160;&#160;&#160; at org.jboss.resteasy.specimpl.UriInfoImpl.&lt;init&gt;(UriInfoImpl.java:70)</span></p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;">&#160;&#160;&#160; at org.jboss.resteasy.plugins.server.servlet.ServletUtil.extractUriInfo(ServletUtil.java:72)</span></p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;">&#160;&#160;&#160; at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:180)</span></p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;">&#160;&#160;&#160; at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:48)</span></p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;">&#160;&#160;&#160; at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:43)</span></p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;">&#160;&#160;&#160; at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)</span></p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;">&#160;&#160;&#160; at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)</span></p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;">&#160;&#160;&#160; at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)</span></p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;">&#160;&#160;&#160; at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)</span></p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;">&#160;&#160;&#160; at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)</span></p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;">&#160;&#160;&#160; at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)</span></p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;">&#160;&#160;&#160; at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)</span></p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;">&#160;&#160;&#160; at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)</span></p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;">&#160;&#160;&#160; at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)</span></p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;">&#160;&#160;&#160; at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525)</span></p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;">&#160;&#160;&#160; at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)</span></p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;">&#160;&#160;&#160; at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)</span></p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;">&#160;&#160;&#160; at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)</span></p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;">&#160;&#160;&#160; at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)</span></p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;">&#160;&#160;&#160; at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)</span></p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;">&#160;&#160;&#160; at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)</span></p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;">&#160;&#160;&#160; at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)</span></p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;">&#160;&#160;&#160; at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)</span></p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;">&#160;&#160;&#160; at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)</span></p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;">&#160;&#160;&#160; at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)</span></p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;">&#160;&#160;&#160; at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)</span></p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;">&#160;&#160;&#160; at java.lang.Thread.run(Thread.java:619)</span></p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;"><span>Caused by: java.net.URISyntaxException: Illegal character in query at index 115: </span><a class="jive-link-external-small" href="http://localhost:8180/rest/resource/v2/weightTol/insertNew?clientRef=test3&amp;client=300470&amp;forcePrint=false&amp;trackFmt=^420" target="_blank">http://localhost:8180/rest/resource/v2/weightTol/insertNew?clientRef=test3&amp;client=300470&amp;forcePrint=false&amp;trackFmt=^420</a><span>[0-9]{5}91[0-9]{20}$</span></span></p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;">&#160;&#160;&#160; at java.net.URI$Parser.fail(URI.java:2809)</span></p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;">&#160;&#160;&#160; at java.net.URI$Parser.checkChars(URI.java:2982)</span></p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;">&#160;&#160;&#160; at java.net.URI$Parser.parseHierarchical(URI.java:3072)</span></p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;">&#160;&#160;&#160; at java.net.URI$Parser.parse(URI.java:3014)</span></p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;">&#160;&#160;&#160; at java.net.URI.&lt;init&gt;(URI.java:578)</span></p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;">&#160;&#160;&#160; at java.net.URI.create(URI.java:840)</span></p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;">&#160;&#160;&#160; ... 27 more</span></p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;">2011-04-27 11:14:49,043 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/rest].[Resteasy]] Servlet.service() for servlet Resteasy threw exception</span></p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;">java.lang.NullPointerException</span></p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;">&#160;&#160;&#160; at org.jboss.resteasy.plugins.server.servlet.HttpServletInputMessage.&lt;init&gt;(HttpServletInputMessage.java:60)</span></p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;">&#160;&#160;&#160; at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.createHttpRequest(HttpServletDispatcher.java:64)</span></p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;">&#160;&#160;&#160; at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.createResteasyHttpRequest(HttpServletDispatcher.java:53)</span></p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;">&#160;&#160;&#160; at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:190)</span></p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;">&#160;&#160;&#160; at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:48)</span></p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;">&#160;&#160;&#160; at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:43)</span></p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;">&#160;&#160;&#160; at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)</span></p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;">&#160;&#160;&#160; at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)</span></p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;">&#160;&#160;&#160; at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)</span></p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;">&#160;&#160;&#160; at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)</span></p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;">&#160;&#160;&#160; at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)</span></p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;">&#160;&#160;&#160; at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)</span></p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;">&#160;&#160;&#160; at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)</span></p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;">&#160;&#160;&#160; at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)</span></p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;">&#160;&#160;&#160; at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)</span></p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;">&#160;&#160;&#160; at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525)</span></p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;">&#160;&#160;&#160; at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)</span></p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;">&#160;&#160;&#160; at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)</span></p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;">&#160;&#160;&#160; at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)</span></p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;">&#160;&#160;&#160; at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)</span></p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;">&#160;&#160;&#160; at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)</span></p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;">&#160;&#160;&#160; at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)</span></p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;">&#160;&#160;&#160; at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)</span></p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;">&#160;&#160;&#160; at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)</span></p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;">&#160;&#160;&#160; at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)</span></p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;">&#160;&#160;&#160; at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)</span></p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;">&#160;&#160;&#160; at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)</span></p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;">&#160;&#160;&#160; at java.lang.Thread.run(Thread.java:619)</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>My question is: How can I pass the Regex to the WS ?</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Thanks,</p><p>Craig.</p></div>

<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
    <p style="margin: 0;">Reply to this message by <a href="http://community.jboss.org/message/602298#602298">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in JBoss Web Services at <a href="http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2044">Community</a></p>
</div></td>
                        </tr>
                    </tbody>
                </table>


                </td>
            </tr>
        </tbody>
    </table>

</div>

</body>
</html>