Re: whitespace in TransformRepresentation text output

2007-02-20 Thread Denis Haskin

Jerome -- thanks for the info and the exposing of some of those properties.

I've been away from my computer for a couple of days, and I didn't get a 
chance to post that I did some more testing and I do get the same result 
straight from the transformer (using that same engine).  So I ended up 
switching this code to be templated via velocity instead of xsl.


One comment following that -- I couldn't use the built-in velocity 
transform either, since it seems to require its template to be in a 
file, and we're pulling ours from a database.  So I just did the 
transform myself and then delivered the output with a StringRepresentation.


Thanks,

dwh


Jerome Louvel wrote:

Hi Denis,

The TransformRepresentation relies on the JDK's bundled XSLT engine, based
on javax.xml.transform API.

There are some properties that can be set of the created Transformer that
you might want to tweak, so I've added a public getTransformer method on
the TransformRepresentation class. Change in SVN already.

You might also want to check that you have an xslt:output element in your
stylesheet, mentionning text as the output format.
http://www.w3.org/TR/xslt#output

Best regards,
Jerome  

  

-Message d'origine-
De : Denis Haskin [mailto:[EMAIL PROTECTED] 
Envoyé : lundi 19 février 2007 03:50

À : discuss@restlet.tigris.org
Objet : whitespace in TransformRepresentation text output

I have a Resource which is returning a 
TransformRepresentation; it works 
fine when the output is HTML.


However, I need to also be able to return text, for which I use an 
alternate stylesheet.  The text is fine except I am unable to use 
xsl:text to get just a newline in certain places, which I 
need.  The 
stylesheet works as expected in other contexts, but not via restlet.  
Any thoughts?  Any way I can get to the underlying xsl engine 
being used 
for the transform?


Thanks,

dwh



Find host info from Application

2007-02-20 Thread Chuck Hinson

From within an Application, how does one get hold of the VirtualHost to
which the application is attached?

--Chuck



Chuck Hinson
Gestalt LLC
phone: 610.994.2833
IM: chucking24 (Yahoo)
 


RE: Find host info from Application

2007-02-20 Thread Jerome Louvel

Hi Chuck,

As an Application is expected to be portable from one deployment environment
to another, we intentionally don't have a reference to the parent
VirtualHost. 

I would be interested to know what is the requirement leading you in the
path. For now, if you really need this reference, you should manually pass
it to the constructor of your application.

Best regards,
Jerome  

 -Message d'origine-
 De : Chuck Hinson [mailto:[EMAIL PROTECTED] 
 Envoyé : mardi 20 février 2007 18:06
 À : discuss@restlet.tigris.org
 Objet : Find host info from Application
 
 
 From within an Application, how does one get hold of the 
 VirtualHost to
 which the application is attached?
 
 --Chuck
 
 
 
 Chuck Hinson
 Gestalt LLC
 phone: 610.994.2833
 IM: chucking24 (Yahoo)
  


RE: RE: Find host info from Application

2007-02-20 Thread Jerome Louvel

Ok I see. For this you can use the Request.getRootRef() method that was
recently added.

Best regards,
Jerome  

 -Message d'origine-
 De : Chuck Hinson [mailto:[EMAIL PROTECTED] 
 Envoyé : mardi 20 février 2007 18:29
 À : discuss@restlet.tigris.org
 Objet : RE: RE: Find host info from Application
 
 I need, for example, to find out what the canonical 
 hostname/base url of my deployment environment is.
 
 For example, when creating atom:source elements, I have to be 
 able to construct a URL for a feed (that's part of my 
 application), and I can't do that if I don't know what my 
 hostname and port number are.
 
 --Chuck
 
 -Original Message-
 From: Jerome Louvel [mailto:[EMAIL PROTECTED] 
 Sent: Tuesday, February 20, 2007 12:12 PM
 To: discuss@restlet.tigris.org
 Subject: RE: Find host info from Application
 
 
 Hi Chuck,
 
 As an Application is expected to be portable from one 
 deployment environment to another, we intentionally don't 
 have a reference to the parent VirtualHost. 
 
 I would be interested to know what is the requirement leading 
 you in the path. For now, if you really need this reference, 
 you should manually pass it to the constructor of your application.
 
 Best regards,
 Jerome  
 
  -Message d'origine-
  De : Chuck Hinson [mailto:[EMAIL PROTECTED] Envoyé : 
 mardi 20 
  février 2007 18:06 À : discuss@restlet.tigris.org Objet : Find host 
  info from Application
  
  
  From within an Application, how does one get hold of the 
 VirtualHost 
  to which the application is attached?
  
  --Chuck
  
  
  
  Chuck Hinson
  Gestalt LLC
  phone: 610.994.2833
  IM: chucking24 (Yahoo)
   


RE: RE: RE: Find host info from Application

2007-02-20 Thread Chuck Hinson
Except that when I need the host info, I don't have a Request object handy.  In 
fact, when I need the host info, my application may not have even received any 
requests yet.
 
The application needs to know host info for application initialization.  There 
are data structures that need to be set up before any requests are ever handled.

--Chuck 

-Original Message-
From: Jerome Louvel [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, February 20, 2007 12:43 PM
To: discuss@restlet.tigris.org
Subject: RE: RE: Find host info from Application


Ok I see. For this you can use the Request.getRootRef() method that was 
recently added.

Best regards,
Jerome  

 -Message d'origine-
 De : Chuck Hinson [mailto:[EMAIL PROTECTED] Envoyé : mardi 20 
 février 2007 18:29 À : discuss@restlet.tigris.org Objet : RE: RE: Find 
 host info from Application
 
 I need, for example, to find out what the canonical hostname/base url 
 of my deployment environment is.
 
 For example, when creating atom:source elements, I have to be able to 
 construct a URL for a feed (that's part of my application), and I 
 can't do that if I don't know what my hostname and port number are.
 
 --Chuck
 
 -Original Message-
 From: Jerome Louvel [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, February 20, 2007 12:12 PM
 To: discuss@restlet.tigris.org
 Subject: RE: Find host info from Application
 
 
 Hi Chuck,
 
 As an Application is expected to be portable from one deployment 
 environment to another, we intentionally don't have a reference to the 
 parent VirtualHost.
 
 I would be interested to know what is the requirement leading you in 
 the path. For now, if you really need this reference, you should 
 manually pass it to the constructor of your application.
 
 Best regards,
 Jerome
 
  -Message d'origine-
  De : Chuck Hinson [mailto:[EMAIL PROTECTED] Envoyé : 
 mardi 20
  février 2007 18:06 À : discuss@restlet.tigris.org Objet : Find host 
  info from Application
  
  
  From within an Application, how does one get hold of the
 VirtualHost
  to which the application is attached?
  
  --Chuck
  
  
  
  Chuck Hinson
  Gestalt LLC
  phone: 610.994.2833
  IM: chucking24 (Yahoo)
   


RE: RE: RE: Find host info from Application

2007-02-20 Thread Jerome Louvel

That's interesting :) 

Another aspect to consider is the fact that a virtual host can
correspond/accept multiple domain names, multiple ports, etc. In addition
the sample application instance could perfectly well be attached to several
virtual hosts at the same time. 

For those reasons, I don't want to change the API. The best in your case is
to manually pass this info to your application. You can also rely on
application's context parameters to pass the host info as this will be more
portable when support WAR-style packaging in 1.1.

Best regards,
Jerome  

 -Message d'origine-
 De : Chuck Hinson [mailto:[EMAIL PROTECTED] 
 Envoyé : mardi 20 février 2007 19:01
 À : discuss@restlet.tigris.org
 Objet : RE: RE: RE: Find host info from Application
 
 Except that when I need the host info, I don't have a Request 
 object handy.  In fact, when I need the host info, my 
 application may not have even received any requests yet.
  
 The application needs to know host info for application 
 initialization.  There are data structures that need to be 
 set up before any requests are ever handled.
 
 --Chuck 
 
 -Original Message-
 From: Jerome Louvel [mailto:[EMAIL PROTECTED] 
 Sent: Tuesday, February 20, 2007 12:43 PM
 To: discuss@restlet.tigris.org
 Subject: RE: RE: Find host info from Application
 
 
 Ok I see. For this you can use the Request.getRootRef() 
 method that was recently added.
 
 Best regards,
 Jerome  
 
  -Message d'origine-
  De : Chuck Hinson [mailto:[EMAIL PROTECTED] Envoyé : 
 mardi 20 
  février 2007 18:29 À : discuss@restlet.tigris.org Objet : 
 RE: RE: Find 
  host info from Application
  
  I need, for example, to find out what the canonical 
 hostname/base url 
  of my deployment environment is.
  
  For example, when creating atom:source elements, I have to 
 be able to 
  construct a URL for a feed (that's part of my application), and I 
  can't do that if I don't know what my hostname and port number are.
  
  --Chuck
  
  -Original Message-
  From: Jerome Louvel [mailto:[EMAIL PROTECTED]
  Sent: Tuesday, February 20, 2007 12:12 PM
  To: discuss@restlet.tigris.org
  Subject: RE: Find host info from Application
  
  
  Hi Chuck,
  
  As an Application is expected to be portable from one deployment 
  environment to another, we intentionally don't have a 
 reference to the 
  parent VirtualHost.
  
  I would be interested to know what is the requirement 
 leading you in 
  the path. For now, if you really need this reference, you should 
  manually pass it to the constructor of your application.
  
  Best regards,
  Jerome
  
   -Message d'origine-
   De : Chuck Hinson [mailto:[EMAIL PROTECTED] Envoyé : 
  mardi 20
   février 2007 18:06 À : discuss@restlet.tigris.org Objet : 
 Find host 
   info from Application
   
   
   From within an Application, how does one get hold of the
  VirtualHost
   to which the application is attached?
   
   --Chuck
   
   
   
   Chuck Hinson
   Gestalt LLC
   phone: 610.994.2833
   IM: chucking24 (Yahoo)



RE: REST paper for Rails...

2007-02-20 Thread Jerome Louvel

Hi Jérôme!

Thanks for the link, it looks like a great resource! There is also a
comprehensive coverage of REST/Rails in the upcoming O'Reilly book:
http://www.crummy.com/writing/RESTful-Web-Services/

RoR indeed has an end-to-end approach, especially via their ActiveResource
concept. I hope that the JSR311 will allow us to go beyond the current
Restlet API to address the mapping between resources and business objects.
But I think that, in term of overall REST support, we compare quite well
with Rails :)

Best regards,
Jerome  

 -Message d'origine-
 De : Jérôme BERNARD [mailto:[EMAIL PROTECTED] 
 Envoyé : mardi 20 février 2007 18:18
 À : discuss@restlet.tigris.org
 Objet : REST paper for Rails...
 
 Interesting lecture on how Rails might provide REST functionalities:
 http://www.b-simple.de/documents
 
 This is more an end-to-end solution which usually developers like :-)
 
 
 I hope this helps,
 Jérôme
 
 
 -- 
 Jérôme BERNARD,
 Kalixia, SARL.
 http://weblog.kalixia.com


RE: RE: RE: RE: Find host info from Application

2007-02-20 Thread Jerome Louvel

It's not bad in itself to have access to your deployment environment. It's
more related to some design choices like the ultimate goal of hosting (think
of an ISP) multiple independent applications in the same server/JVM. In this
scenario, if you give access to the parent Component or VirtualHosts to your
deployed Applications, they could do actions that would compromise the
stability/security of other applications. Therefore we need to enforce some
clear separation of concerns.

We could also inject the environment info into the applications upon
initialization/start. For virtual hosts that would be a bit complex as they
are based on (potentially multiple) domain name/port/ip regex patterns...

Back to your concrete problem: as I suggested in the other reply, you could
rely on application's context parameters. Actually, the Servlet adapter
already supports them by copying all your Servlet parameters (from web.xml)
into this parameters list. Let me know if you have trouble with this
approach.

Best regards,
Jerome  

 -Message d'origine-
 De : Chuck Hinson [mailto:[EMAIL PROTECTED] 
 Envoyé : mardi 20 février 2007 20:09
 À : discuss@restlet.tigris.org
 Objet : RE: RE: RE: RE: Find host info from Application
 
 I really don't understand what's so bad about allowing to 
 application to figure out what its deployment environment 
 looks like.  And so what if an application is attached to 
 multiple hosts - I may want to know that and act differently.
 
 Part of the reason I'm having this problem is that my app is 
 hosted in a servlet container and it's not clear to me how I 
 would pass the host info to the constructor.
 
 --Chuck
 
  
 
 -Original Message-
 From: Jerome Louvel [mailto:[EMAIL PROTECTED] 
 Sent: Tuesday, February 20, 2007 2:01 PM
 To: discuss@restlet.tigris.org
 Subject: RE: RE: RE: Find host info from Application
 
 
 That's interesting :) 
 
 Another aspect to consider is the fact that a virtual host 
 can correspond/accept multiple domain names, multiple ports, 
 etc. In addition the sample application instance could 
 perfectly well be attached to several virtual hosts at the same time. 
 
 For those reasons, I don't want to change the API. The best 
 in your case is to manually pass this info to your 
 application. You can also rely on application's context 
 parameters to pass the host info as this will be more 
 portable when support WAR-style packaging in 1.1.
 
 Best regards,
 Jerome  
 
  -Message d'origine-
  De : Chuck Hinson [mailto:[EMAIL PROTECTED] Envoyé : 
 mardi 20 
  février 2007 19:01 À : discuss@restlet.tigris.org Objet : 
 RE: RE: RE: 
  Find host info from Application
  
  Except that when I need the host info, I don't have a 
 Request object 
  handy.  In fact, when I need the host info, my application may not 
  have even received any requests yet.
   
  The application needs to know host info for application 
  initialization.  There are data structures that need to be set up 
  before any requests are ever handled.
  
  --Chuck
  
  -Original Message-
  From: Jerome Louvel [mailto:[EMAIL PROTECTED]
  Sent: Tuesday, February 20, 2007 12:43 PM
  To: discuss@restlet.tigris.org
  Subject: RE: RE: Find host info from Application
  
  
  Ok I see. For this you can use the Request.getRootRef() method that 
  was recently added.
  
  Best regards,
  Jerome
  
   -Message d'origine-
   De : Chuck Hinson [mailto:[EMAIL PROTECTED] Envoyé : 
  mardi 20
   février 2007 18:29 À : discuss@restlet.tigris.org Objet : 
  RE: RE: Find
   host info from Application
   
   I need, for example, to find out what the canonical
  hostname/base url
   of my deployment environment is.
   
   For example, when creating atom:source elements, I have to
  be able to
   construct a URL for a feed (that's part of my application), and I 
   can't do that if I don't know what my hostname and port 
 number are.
   
   --Chuck
   
   -Original Message-
   From: Jerome Louvel [mailto:[EMAIL PROTECTED]
   Sent: Tuesday, February 20, 2007 12:12 PM
   To: discuss@restlet.tigris.org
   Subject: RE: Find host info from Application
   
   
   Hi Chuck,
   
   As an Application is expected to be portable from one deployment 
   environment to another, we intentionally don't have a
  reference to the
   parent VirtualHost.
   
   I would be interested to know what is the requirement
  leading you in
   the path. For now, if you really need this reference, you should 
   manually pass it to the constructor of your application.
   
   Best regards,
   Jerome
   
-Message d'origine-
De : Chuck Hinson [mailto:[EMAIL PROTECTED] Envoyé : 
   mardi 20
février 2007 18:06 À : discuss@restlet.tigris.org Objet : 
  Find host
info from Application


From within an Application, how does one get hold of the
   VirtualHost
to which the application is attached?

--Chuck



Chuck 

RE: RE: RE: RE: Find host info from Application

2007-02-20 Thread Chuck Hinson
The more I think about this, the more it seems that something is fundamentally 
wrong here.

According to AWWW[1], Assign distinct URIs to distinct resources.

So if an application is the thing that manages a set of resources (i.e,. a URI 
space), having it attached to multiple virtual hosts guarantees that your 
resources will not have distinct URIs.

I'm also wondering if the baby's being thrown out with the bathwater here.  
Just because some people want to attach an application to multiple virtual 
hosts doesn't rule out the case the some people will only ever attach an 
application to a single virtual host.  

Perhaps its worth revisiting the way virtual hosting is being handled.  Or 
maybe I'm misunderstanding who is repsonsible for managing an application's URI 
space.

As for using the application's context in web.xml - that's just plain ugly; 
everytime I deploy, I have to unwrap my war so I can modify web.xml to change 
hostname and port info. (Deployment-specific config info just shouldn't be in 
web.xml)

Oh well, for now web.xml will have to do for a temporary solution.


--Chuck

[1]http://www.w3.org/TR/webarch/#id-resources


-Original Message-
From: Jerome Louvel [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, February 20, 2007 2:01 PM
To: discuss@restlet.tigris.org
Subject: RE: RE: RE: Find host info from Application


That's interesting :) 

Another aspect to consider is the fact that a virtual host can 
correspond/accept multiple domain names, multiple ports, etc. In addition the 
sample application instance could perfectly well be attached to several virtual 
hosts at the same time. 

For those reasons, I don't want to change the API. The best in your case is to 
manually pass this info to your application. You can also rely on application's 
context parameters to pass the host info as this will be more portable when 
support WAR-style packaging in 1.1.

Best regards,
Jerome  

 -Message d'origine-
 De : Chuck Hinson [mailto:[EMAIL PROTECTED] Envoyé : mardi 20 
 février 2007 19:01 À : discuss@restlet.tigris.org Objet : RE: RE: RE: 
 Find host info from Application
 
 Except that when I need the host info, I don't have a Request object 
 handy.  In fact, when I need the host info, my application may not 
 have even received any requests yet.
  
 The application needs to know host info for application 
 initialization.  There are data structures that need to be set up 
 before any requests are ever handled.
 
 --Chuck
 
 -Original Message-
 From: Jerome Louvel [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, February 20, 2007 12:43 PM
 To: discuss@restlet.tigris.org
 Subject: RE: RE: Find host info from Application
 
 
 Ok I see. For this you can use the Request.getRootRef() method that 
 was recently added.
 
 Best regards,
 Jerome
 
  -Message d'origine-
  De : Chuck Hinson [mailto:[EMAIL PROTECTED] Envoyé : 
 mardi 20
  février 2007 18:29 À : discuss@restlet.tigris.org Objet : 
 RE: RE: Find
  host info from Application
  
  I need, for example, to find out what the canonical
 hostname/base url
  of my deployment environment is.
  
  For example, when creating atom:source elements, I have to
 be able to
  construct a URL for a feed (that's part of my application), and I 
  can't do that if I don't know what my hostname and port number are.
  
  --Chuck
  
  -Original Message-
  From: Jerome Louvel [mailto:[EMAIL PROTECTED]
  Sent: Tuesday, February 20, 2007 12:12 PM
  To: discuss@restlet.tigris.org
  Subject: RE: Find host info from Application
  
  
  Hi Chuck,
  
  As an Application is expected to be portable from one deployment 
  environment to another, we intentionally don't have a
 reference to the
  parent VirtualHost.
  
  I would be interested to know what is the requirement
 leading you in
  the path. For now, if you really need this reference, you should 
  manually pass it to the constructor of your application.
  
  Best regards,
  Jerome
  
   -Message d'origine-
   De : Chuck Hinson [mailto:[EMAIL PROTECTED] Envoyé : 
  mardi 20
   février 2007 18:06 À : discuss@restlet.tigris.org Objet : 
 Find host
   info from Application
   
   
   From within an Application, how does one get hold of the
  VirtualHost
   to which the application is attached?
   
   --Chuck
   
   
   
   Chuck Hinson
   Gestalt LLC
   phone: 610.994.2833
   IM: chucking24 (Yahoo)



StackOverflowError when submitting a very long string as a parameter

2007-02-20 Thread Ivan Gorgiev

Here is the StackOverflowError I get when supplying a very long string as a
request parameter. Although this particular request comes from a test case,
there is nothing that would make such a request invalid in the real world.
Certainly nothing preventing the use from submitting one.

Any suggestions for a workaround? Thanks!


7001GET 
/ws-rest/demo/displayNode/00


0011

1222

2333

3344

444
  -   400 849 -   0   http://myhost:myport  
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107
Firefox/1.0 -
Feb 20, 2007 12:04:53 PM com.noelios.restlet.StatusFilter doHandle
SEVERE: Unhandled exception or error intercepted
java.lang.StackOverflowError
at java.lang.Character.codePointAt(Character.java:2335)
at java.util.regex.Pattern$Range.match(Pattern.java:3931)
at java.util.regex.Pattern$Add.match(Pattern.java:5163)
at java.util.regex.Pattern$Add.match(Pattern.java:5163)
at java.util.regex.Pattern$Add.match(Pattern.java:5163)
at java.util.regex.Pattern$Add.match(Pattern.java:5163)
at java.util.regex.Pattern$Add.match(Pattern.java:5163)
at java.util.regex.Pattern$Add.match(Pattern.java:5163)
at java.util.regex.Pattern$Branch.match(Pattern.java:4530)
at java.util.regex.Pattern$Branch.match(Pattern.java:4530)
at java.util.regex.Pattern$Branch.match(Pattern.java:4530)
at java.util.regex.Pattern$Branch.match(Pattern.java:4530)
at java.util.regex.Pattern$GroupHead.match(Pattern.java:4570)
at java.util.regex.Pattern$Loop.match(Pattern.java:4697)
at java.util.regex.Pattern$GroupTail.match(Pattern.java:4629)
at java.util.regex.Pattern$Add.match(Pattern.java:5163)
at java.util.regex.Pattern$Branch.match(Pattern.java:4530)
at java.util.regex.Pattern$Branch.match(Pattern.java:4530)
at java.util.regex.Pattern$Branch.match(Pattern.java:4530)
at java.util.regex.Pattern$Branch.match(Pattern.java:4530)
at java.util.regex.Pattern$GroupHead.match(Pattern.java:4570)
at java.util.regex.Pattern$Loop.match(Pattern.java:4697)
at java.util.regex.Pattern$GroupTail.match(Pattern.java:4629)
at java.util.regex.Pattern$Add.match(Pattern.java:5163)
at java.util.regex.Pattern$Branch.match(Pattern.java:4530)
at java.util.regex.Pattern$Branch.match(Pattern.java:4530)
at java.util.regex.Pattern$Branch.match(Pattern.java:4530)
at java.util.regex.Pattern$Branch.match(Pattern.java:4530)
at java.util.regex.Pattern$GroupHead.match(Pattern.java:4570)
at java.util.regex.Pattern$Loop.match(Pattern.java:4697)
at java.util.regex.Pattern$GroupTail.match(Pattern.java:4629)
at java.util.regex.Pattern$Add.match(Pattern.java:5163)
Feb 20, 2007 12:04:53 PM com.noelios.restlet.LogFilter afterHandle



RE: RE: RE: RE: Find host info from Application

2007-02-20 Thread Jerome Louvel

Hi Chuck,

 The more I think about this, the more it seems that something 
 is fundamentally wrong here.
:-/

 According to AWWW[1], Assign distinct URIs to distinct resources.
 
 So if an application is the thing that manages a set of 
 resources (i.e,. a URI space), having it attached to multiple 
 virtual hosts guarantees that your resources will not have 
 distinct URIs.

REST/HTTP perfectly allows multiple URIs to point to the same resource. For
example, you could have a virtual host accepting translated domain names
like www.mysite.org and www.monsite.org. Other useful cases are when you
want to support localhost access by IP address, etc. This is useful to
flexible in these cases for development and pre-production.

 I'm also wondering if the baby's being thrown out with the 
 bathwater here.  Just because some people want to attach an 
 application to multiple virtual hosts doesn't rule out the 
 case the some people will only ever attach an application to 
 a single virtual host.  

Actually, the virtual hosting we support is even more flexible as we take
into account the following attributes when determining if a request matches
a given virtual host:
 - hostRef (hostDomain + hostPort + hostScheme)
 - resourceRef (resourceDomain + resourcePort + resourceScheme)
 - serverInfo (serverAddress + serverPort)

As a result, we are even able to properly route requests for resources with
URIs like urn:isbn:... submitted via HTTP. This is more flexible than
Apache HTTP Server's virtual hosting support, and hopefully it doesn't
compromise RESTful design.

 Perhaps its worth revisiting the way virtual hosting is being 
 handled.  Or maybe I'm misunderstanding who is repsonsible 
 for managing an application's URI space.

The URI space is managed by both the virtual hosts and then by the
applications. If the resource URIs don't match the host URI (like for the
URN example given above), then the resource URI space is entirely managed by
the application.
 
 As for using the application's context in web.xml - that's 
 just plain ugly; everytime I deploy, I have to unwrap my war 
 so I can modify web.xml to change hostname and port info. 
 (Deployment-specific config info just shouldn't be in web.xml)

Hmm, that's true.

 Oh well, for now web.xml will have to do for a temporary solution.

Another strategy would be to initialize your application upon first request.
You can override the init(Request, Response) method on your Application
class for this purpose. Just remember to check whether the application is
already started and to call super.init() when you are done with your
initialization.

Hope this helps,
Jerome