If we agree to move to servlet-api-2.5 we can use getContextPath()

http://java.sun.com/javaee/5/docs/api/javax/servlet/ServletContext.html#getContextPath()

On Apr 21, 2010, at 5:12 PM, Ziv Horesh wrote:

> On Wed, Apr 21, 2010 at 3:47 PM, <[email protected]> wrote:
> 
>> 
>> http://codereview.appspot.com/969041/diff/1/3
>> File
>> 
>> 
>> java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/HtmlAccelServlet.java
>> (right):
>> 
>> http://codereview.appspot.com/969041/diff/1/3#newcode237
>> 
>> java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/HtmlAccelServlet.java:237:
>> String path = req.getRequestURI();
>> slight preference to use the UriBuilder(HttpServletRequest) mechanism to
>> build a Uri, then pull it apart. Avoids split logic dealing w/ HSR <->
>> URI parsing.
>> 
>> http://codereview.appspot.com/969041/diff/1/3#newcode241
>> 
>> java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/HtmlAccelServlet.java:241:
>> if (path.startsWith(accelServletPrefix + "/")) {
>> it's been a while since I've used this, so I'd defer to others with more
>> recent experience as to the reliability of this method -- but it seems:
>> 
>> http://java.sun.com/products/servlet/2.2/javadoc/javax/servlet/http/HttpServletRequest.html#getServletPath()<http://java.sun.com/products/servlet/2.2/javadoc/javax/servlet/http/HttpServletRequest.html#getServletPath%28%29>
>> 
>> ..may provide accelServletPrefix without any additional configuration.
>> 
> I am not crazy about this either, but I didn't find a better way.
> Basically I need the full path here not just the servlet part in order to
> figure out if it is parametrized or chained.
> I will try to see if it work or there is a better way.
> 
> 
>> http://codereview.appspot.com/969041/diff/1/3#newcode250
>> 
>> java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/HtmlAccelServlet.java:250:
>> if (accelUrl == null){
>> s/null check/!StringUtils.isEmptyOrWhitespace(...)/
>> 
>> 
>> http://codereview.appspot.com/969041/show
>> 

Reply via email to