Re: Where can I store data files in a tomcat war

2014-07-03 Thread Paul Taylor

On 03/07/2014 16:03, Christopher Schultz wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Paul,

On 7/2/14, 4:28 PM, Paul Taylor wrote:

On 02/07/2014 16:34, Christopher Schultz wrote:

The solution is that the web application, packaged in a WAR
file, needs to unpack the Lucene indexes onto the disk when it
starts up. You can do this with a ServletContextListener.

So I do within init() method of my servlet, but EB doesnt wait for
the init() method to finish before declaring the application ready,
do you think it would wait for code using a ServletContextListener
or fail in the same way it does for init() ?

Which init() are you talking about?


GenericServlet.init(), is this method not designed for what I was doing


If EB marks the cluster node as
available before the webapp has completed deploying, that sounds like
a big problem. If you are using servlet.init() without any
load-on-startup for that servlet, then I would expect the bad behavior
you describe.
I dont understand what you are getting at here when you say 
'load-on-startup'

I think you'll have better luck with
ServletContextListener, because the servlet spec guarantees those to
be complete before the webapp can receive requests.
Okay, well the good news is that I now have it working with AWS 
ebextensions and it wasn't so difficult in the end.



You want to manage the streams yourself: hook a gzip reader up to a
tar reader and then read files from the tar reader:

GzipInputStream gzin = new GzipInputStream(tgzFile);
TarInputStream tin = new TarInputStream(gzin);

InputStream fin;

while(fin = tin.getNextFile())
copy(fin, new File(localFilename));

That's oversimplified, but essentially what you want to do. There is
no need to completely expand the gzip archive before reading files out
of it.

Ok, thanks good to know

thanks for your help

Paul

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



Re: Where can I store data files in a tomcat war

2014-07-02 Thread Paul Taylor


I guess I'm a little confused as to what this means.

I have a simple WAR based web application that uses Lucene created
indexes to provide search results in a xml format.

Especially given the following context:

and supplementary question how do I modify my pom file to do this
with maven

I was under the impression that Paul was building a separate
application using Lucene during the build stage to create the
indexes, but then using an application - specific mechanism to use
those indexes.


That's what I thought, too.
Yes correct, let me explain it a bit further. I'm trying to deploy an 
application that serves results from a lucene index in response to user 
requests. Deploying it manually to my own server is fine, first of all I 
just copy the index files to a location on the disk, then I deploy my 
application, and within its web.xml I have a servlet parameter that 
defines where the indexes are, so within the servlets init() method i 
initilize the indexes. The problem is that I'm trying to deploy my 
application to Amazon Web Services using autoscaled Elastic Beanstalk, 
this means that the application has to be able to be initilized and 
created based on what is in the war because Elastic Beanstalk will 
automatically start new servers as required due to load and terminate 
those instances when not required.


I do seem to have a solution, but I detail it here because it doesn't 
seem quite right and might be useful to others.


Short Answer:
Originally I first tried putting the index files (unzipped) into the 
src/main/resources folder of my maven project, and referred to the 
WEB-INF/classes/index_dir location in my web.xml and tomcat didn't 
start. It didnt seem right for non Java classes to be in that folder 
anyway so I discarded that idea, however Ive just tried it again locally 
and it worked so if it works on EB that is the solution I'm going to use 
for now unless any better suggestions. It does mean that the resulting 
.war file is rather  large, far too large to upload from my local 
machine but as I build the code and indexes from another AWS EC2 
instance I can just dump it into S3, and deploy from S3 to EB, if I need 
to redeploy you dont seem able to redeploy from S3 but Ive realised that 
when I need to redeploy I would do it to a new EB configuration and then 
swap the dns from EB1 to EB2 to mimimize downtime so that is not really 
a problem.


A supplementary question:
Is there a system property I can use to refer to the WEB-INF as a 
relative directory rather than full path


Long Answer:
Since originally  posting this question I have looked at a few other 
possible solutions but none were satisfactory.


1. Deploy war without indexes but in my servlet init() method write code 
to grab the compressed indexes from S3 and unzip to location specified 
in web.xml. This worked with a single instance EB but unfortunately AWS 
does not wait for the init() method (which takes 20 minutes)  to finish 
before declaring it, and this meant because it was busy unzipping 
indexes and could not serve request it caused AWS monitoring to declare 
it to busy and open another two instances, once all three instances 
finished their init() method they were all up and working , then a few 
minutes two were terminated because not needed. But this means if server 
is genuinely busy the newly started instances will be declared ready by 
AWS but fail to service requests during the init() period. This seems 
like a bug with AWS but not going to change anytime soon.


2. Deploy war without indexes and use AWS .ebextensions files to grab 
and unzip the indexes. This might work but I really dislike having to 
write custom deployment code/configurations as a general rule. And 
because the size of the disk provided by the AWS instance
is limited, unzipping is not so simple. For example instead of creating 
a tar.gz file , I had to gzip the files first and then tar so when 
untarrred I could decompress one file at a time which required less 
temporaray space, this would make the eb code more complex.


3. Create a custom Amazon Image that can be used by EB, this seems 
theoretically possible but quickly got very messy and seemed very much a 
hack.


4. Use Docker, AWS now supports the docker framework. This might be a 
good solution  but having spent far too much time on understanding AWS I 
wasnt keen to spen dmore time on yet another framework to solve one problem



If the Lucene API is used, then writing a servlet context listener
that digs out the initial indexes and places them in java.io.tmpdir
in a known subdirectory is probably the way to go. This ensures
that even if a WAR file is not exploded, the Lucene DirectoryReader
API can get to the files.

That's precisely what I was suggesting.

So this is what I did with 1 but because of the AWS issue didnt work as 
well as hoped.


Paul

-
To unsubscribe, e-mail: 

Re: Where can I store data files in a tomcat war

2014-07-02 Thread Paul Taylor

On 02/07/2014 11:49, Paul Taylor wrote:


I guess I'm a little confused as to what this means.

I have a simple WAR based web application that uses Lucene created
indexes to provide search results in a xml format.

Especially given the following context:

and supplementary question how do I modify my pom file to do this
with maven

I was under the impression that Paul was building a separate
application using Lucene during the build stage to create the
indexes, but then using an application - specific mechanism to use
those indexes.


That's what I thought, too.
Yes correct, let me explain it a bit further. I'm trying to deploy an 
application that serves results from a lucene index in response to 
user requests. Deploying it manually to my own server is fine, first 
of all I just copy the index files to a location on the disk, then I 
deploy my application, and within its web.xml I have a servlet 
parameter that defines where the indexes are, so within the servlets 
init() method i initilize the indexes. The problem is that I'm trying 
to deploy my application to Amazon Web Services using autoscaled 
Elastic Beanstalk, this means that the application has to be able to 
be initilized and created based on what is in the war because Elastic 
Beanstalk will automatically start new servers as required due to load 
and terminate those instances when not required.


I do seem to have a solution, but I detail it here because it doesn't 
seem quite right and might be useful to others.


Short Answer:
Originally I first tried putting the index files (unzipped) into the 
src/main/resources folder of my maven project, and referred to the 
WEB-INF/classes/index_dir location in my web.xml and tomcat didn't 
start. It didnt seem right for non Java classes to be in that folder 
anyway so I discarded that idea, however Ive just tried it again 
locally and it worked so if it works on EB that is the solution I'm 
going to use for now unless any better suggestions. It does mean that 
the resulting .war file is rather large, far too large to upload from 
my local machine but as I build the code and indexes from another AWS 
EC2 instance I can just dump it into S3, and deploy from S3 to EB, if 
I need to redeploy you dont seem able to redeploy from S3 but Ive 
realised that when I need to redeploy I would do it to a new EB 
configuration and then swap the dns from EB1 to EB2 to mimimize 
downtime so that is not really a problem.
Bother - it doesn't work because of an arbitary limit of 524,288,000 
bytes (1/2 GB) on the size of the war that can be deployed to EB. Don't 
know why Amzon have this limit but because my war now contains the index 
files its larger than that.


Looks to me the only possibility of getting it working properly is to 
use .ebextensions or Docker


Paul

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



Re: Where can I store data files in a tomcat war

2014-07-02 Thread Paul Taylor

On 02/07/2014 15:06, Mark H. Wood wrote:

On Wed, Jul 02, 2014 at 11:49:36AM +0100, Paul Taylor wrote:

I have a simple WAR based web application that uses Lucene created
indexes to provide search results in a xml format.

Especially given the following context:

and supplementary question how do I modify my pom file to do this
with maven

I was under the impression that Paul was building a separate
application using Lucene during the build stage to create the
indexes, but then using an application - specific mechanism to use
those indexes.


That's what I thought, too.

Yes correct, let me explain it a bit further. I'm trying to deploy an
application that serves results from a lucene index in response to user
requests. Deploying it manually to my own server is fine, first of all I
just copy the index files to a location on the disk, then I deploy my
application, and within its web.xml I have a servlet parameter that
defines where the indexes are, so within the servlets init() method i
initilize the indexes. The problem is that I'm trying to deploy my
application to Amazon Web Services using autoscaled Elastic Beanstalk,
this means that the application has to be able to be initilized and
created based on what is in the war because Elastic Beanstalk will
automatically start new servers as required due to load and terminate
those instances when not required.

So it sounds like this index is static, produced somewhere else and
only consulted read-only by 1..N instances of your webapp.

Could you not just plop one uncompressed copy of the index into an EBS
snapshot in an S3 bucket, and map the snapshot to each EB instance?
Then just provide environmental information to the webapp as to where
it should find the index.  Your huge index doesn't have to live in the
WAR then.

I have *very* little experience with AWS, so it's quite possible I'm
missing something.
It is read only, but each instance of lucene would need its own copy of 
the index, Lucene does special low level io with the index using memory 
mapping and the files do need to reside locally for acceptable 
performance. So the index doesnot have to exist in the WAR but it does 
need to exist on the EC2 instance (server).





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



Re: Where can I store data files in a tomcat war

2014-07-02 Thread Paul Taylor

On 02/07/2014 16:34, Christopher Schultz wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Paul,

On 7/2/14, 6:49 AM, Paul Taylor wrote:

[L]et me explain it a bit further. I'm trying to deploy an
application that serves results from a lucene index in response to
user requests. Deploying it manually to my own server is fine,
first of all I just copy the index files to a location on the disk,
then I deploy my application, and within its web.xml I have a
servlet parameter that defines where the indexes are, so within the
servlets init() method i initilize the indexes. The problem is that
I'm trying to deploy my application to Amazon Web Services using
autoscaled Elastic Beanstalk, this means that the application has
to be able to be initilized and created based on what is in the war
because Elastic Beanstalk will automatically start new servers as
required due to load and terminate those instances when not
required.

I do seem to have a solution, but I detail it here because it
doesn't seem quite right and might be useful to others.

Short Answer: Originally I first tried putting the index files
(unzipped) into the src/main/resources folder of my maven project,
and referred to the WEB-INF/classes/index_dir location in my
web.xml and tomcat didn't start. It didnt seem right for non Java
classes to be in that folder anyway so I discarded that idea,
however Ive just tried it again locally and it worked so if it
works on EB that is the solution I'm going to use for now unless
any better suggestions. It does mean that the resulting .war file
is rather  large, far too large to upload from my local machine but
as I build the code and indexes from another AWS EC2 instance I can
just dump it into S3, and deploy from S3 to EB, if I need to
redeploy you dont seem able to redeploy from S3 but Ive realised
that when I need to redeploy I would do it to a new EB
configuration and then swap the dns from EB1 to EB2 to mimimize
downtime so that is not really a problem.

A supplementary question: Is there a system property I can use to
refer to the WEB-INF as a relative directory rather than full path

Don't use paths. Use the ClassLoader if Lucene can really load a file
in that way.

The problem is that you can't rely on EB to expand your WAR file on
the disk. If EB suddenly changes its deployment model to stop
expanding your WAR file, then you are hosed and your application won't
work at all.
Lucene works on files and does low level io memory mapping so I do need 
to use paths, but anyway it doesnt matter because as describe din my 
last post EB doesn't allow me to have a war file big enough to hold the 
index files anyway.


Instead, you need to work around the problem. Let me restate the
problem so the solution makes more sense:

1. Amazon Elastic Beanstalk requires a WAR file to deploy to a cluster
2. Lucene can't read an index out of a WAR file

The solution is that the web application, packaged in a WAR file,
needs to unpack the Lucene indexes onto the disk when it starts up.
You can do this with a ServletContextListener.
So I do within init() method of my servlet, but EB doesnt wait for the 
init() method to finish before declaring the application ready, do you 
think it would wait for code using a ServletContextListener or fail in 
the same way it does for init() ?

Since you expand the files, you decide where to put them. The servlet
spec guarantees a temporary directory available using
application.getAttribute(javax.servlet.context.tempdir). This
returns a java.io.File object pointing to the temporary directory for
the application. Dump your files in there (a subdirectory would be a
good idea) and then point Lucene at that place on the disk.


Long Answer: Since originally  posting this question I have looked
at a few other possible solutions but none were satisfactory.

1. Deploy war without indexes but in my servlet init() method write
code to grab the compressed indexes from S3 and unzip to location
specified in web.xml.

That would work, too, but you'll have to pay for download time for
each member of the cluster. If you pack the indexes in the WAR file,
they are already available when the webapp initializes.
See my later posts, it doesn't work because of problem with EB not 
respecting finish of init(), and I cant pack the indexes into WAR 
because breaks Amazons max war size of 1/2 GB





2. Deploy war without indexes and use AWS .ebextensions files to
grab and unzip the indexes. This might work but I really dislike
having to write custom deployment code/configurations as a general
rule. And because the size of the disk provided by the AWS
instance is limited, unzipping is not so simple. For example
instead of creating a tar.gz file , I had to gzip the files first
and then tar so when untarrred I could decompress one file at a
time which required less temporaray space, this would make the eb
code more complex.

Neither tar nor gzip take very much of anything: they are both
block-oriented. What

Where can I store data files in a tomcat war

2014-06-27 Thread Paul Taylor

Hi

I have a simple WAR based web application that uses lucene created 
indexes to provide search results in a xml format, the location of the 
indexes (outside of the war) are referred in the web.xml.


It works fine locally but I want to deploy it using Elastic Beanstalk 
within Amazon Webservices but for it to work I need the data files 
within the war, then I can allow EB to create new instances when load 
balancing/scaling and it will work because the data fields are included 
in the war at deployment time. I have checked that EB does unjar the war 
so that when my code comes to use the files they will be real files not 
still contained within the War.


With that in mind where could i put the data files so they not 
considered  by tomcat as java classes , and supplementary question how 
do I modify my pom file to do this with maven


much thanks Paul


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



Re: Where can I store data files in a tomcat war

2014-06-27 Thread Paul Taylor

On 27/06/2014 19:59, Christopher Schultz wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Paul,

On 6/27/14, 8:34 AM, Paul Taylor wrote:

I have a simple WAR based web application that uses lucene created
indexes to provide search results in a xml format, the location of
the indexes (outside of the war) are referred in the web.xml.

It works fine locally but I want to deploy it using Elastic
Beanstalk within Amazon Webservices but for it to work I need the
data files within the war, then I can allow EB to create new
instances when load balancing/scaling and it will work because the
data fields are included in the war at deployment time. I have
checked that EB does unjar the war so that when my code comes to
use the files they will be real files not still contained within
the War.

With that in mind where could i put the data files so they not
considered  by tomcat as java classes , and supplementary question
how do I modify my pom file to do this with maven

What?

Java won't try to load random files as .class files.
I tried putting the files into the resources directory of my maven 
project, when I deployed the resulting war it would start (did 
previously) and opening the war found the files were added under 
WEB-INF/classes, that is what I meant. So I need to put them somewhere else.



Are you launching Lucene from within the startup process of your
webapp? I don't see any support for loading Lucene indexes from within
a ZIP file (e.g. WAR, JAR) so you might have to bootstrap the
following when deploying:

1. Know where your files are within the WAR
2. In a ServletContextListener -- perhaps the one that actually
sets-up Lucene -- do the following:

   a. Unpack each file of your index into ${tmpdir}/lucene (or whatever)
   b. Configure Lucene with an IndexReader that looks at ${tmpdir}/lucene

3. Clean-up after yourself during undeploy

Actually I don't have a startup process as such, the first user request 
will just do a search which will cause the index to be accessed. But 
perhaps a startup proces is what is what I need. The data files are 
stored in amazon s3 so perhaps i could use servlet init to get the s3 
file and put it somewhere relative to the deployed app and then use.


Paul

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



Re: Where can I store data files in a tomcat war

2014-06-27 Thread Paul Taylor

On 27/06/2014 21:22, Mark Eggers wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 6/27/2014 11:59 AM, Christopher Schultz wrote:

Paul,

On 6/27/14, 8:34 AM, Paul Taylor wrote:

I have a simple WAR based web application that uses lucene
created indexes to provide search results in a xml format, the
location of the indexes (outside of the war) are referred in the
  web.xml.
It works fine locally but I want to deploy it using Elastic
Beanstalk within Amazon Webservices but for it to work I need
the data files within the war, then I can allow EB to create new
  instances when load balancing/scaling and it will work because
the data fields are included in the war at deployment time. I
have checked that EB does unjar the war so that when my code
comes to use the files they will be real files not still
contained within the War.
With that in mind where could i put the data files so they not
considered  by tomcat as java classes , and supplementary
question how do I modify my pom file to do this with maven

What?

Java won't try to load random files as .class files.

Are you launching Lucene from within the startup process of your
webapp? I don't see any support for loading Lucene indexes from
within a ZIP file (e.g. WAR, JAR) so you might have to bootstrap
the following when deploying:

1. Know where your files are within the WAR 2. In a
ServletContextListener -- perhaps the one that actually sets-up
Lucene -- do the following:

a. Unpack each file of your index into ${tmpdir}/lucene (or
whatever) b. Configure Lucene with an IndexReader that looks at
${tmpdir}/lucene

3. Clean-up after yourself during undeploy

-chris

Paul,

If you're creating the index files before or during the build, you can
place them in:

Project-src-main-resources-some-folder-files

Maven will package them up and place them in WEB-INF/classes/some-folder
Thats what Im doing and seems to prevent deployment (perhaps its some 
other reason)

In your application, you could use getResourceAsStream to load the
information from the classpath.

If you're launching Lucene from within your web application and
periodically building the files, then placing them into
${tmpdir}/lucene is probably the way to go.

Okay that sounds better, but can I do that at deploy time ?

Paul

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



Would like to extract every request to servelt except index.html

2010-04-02 Thread Paul Taylor
I would like every request to be redirected to a central servlet EXCEPT  
if the  request is simply index.html, but at the moment everything gets 
redirected to the servlet, how could I do what I want


This is extract from my web.xml

servlet-mapping
 servlet-nameSearchServerServlet/servlet-name
 url-pattern//url-pattern
/servlet-mapping
welcome-file-list
   welcome-fileindex.html/welcome-file
/welcome-file-list

thanks Paul

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



Re: Would like to extract every request to servelt except index.html

2010-04-02 Thread Paul Taylor

Pid wrote:

On 02/04/2010 09:51, Paul Taylor wrote:

I would like every request to be redirected to a central servlet EXCEPT
  if the request is simply index.html, but at the moment everything gets
redirected to the servlet, how could I do what I want

This is extract from my web.xml

servlet-mapping
servlet-nameSearchServerServlet/servlet-name
url-pattern//url-pattern
/servlet-mapping


The above makes your servlet the default servlet, so it'll handle all 
requests that aren't handled by more specific url-patterns.  The 
welcome files won't be processed.


You could employ a Servlet Filter which analyses the requestURI and 
forwards to your servlet, but that calls chain.doFilter(hreq, hres) 
otherwise.



Hmm, I know why it doesnt work but i was hoping I could add something to 
this file so that the servlet doesnt pickup index.html, is that not 
possible.


Paul


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



Re: Would like to extract every request to servelt except index.html

2010-04-02 Thread Paul Taylor

Pid wrote:

On 02/04/2010 11:09, Paul Taylor wrote:

Pid wrote:

On 02/04/2010 09:51, Paul Taylor wrote:
I would like every request to be redirected to a central servlet 
EXCEPT

if the request is simply index.html, but at the moment everything gets
redirected to the servlet, how could I do what I want

This is extract from my web.xml

servlet-mapping
servlet-nameSearchServerServlet/servlet-name
url-pattern//url-pattern
/servlet-mapping


The above makes your servlet the default servlet, so it'll handle all
requests that aren't handled by more specific url-patterns. The
welcome files won't be processed.

You could employ a Servlet Filter which analyses the requestURI and
forwards to your servlet, but that calls chain.doFilter(hreq, hres)
otherwise.



Hmm, I know why it doesnt work but i was hoping I could add something to
this file so that the servlet doesnt pickup index.html, is that not
possible.


Have you found any clues in the Servlet Spec, or the Tomcat docs that 
indicate that it _is_ possible?



p


No, I try and stay away from config files as much as possible so Ive 
just let the servlet hande it as follows:


//If they have entered nothing, redirect to them a home page (which is 
on another server, my index.html just contained a redirect)

   if(request.getParameterMap().size()==0)
   {
   response.sendRedirect(HOME_PAGE);
   return;
   }

The idea is that if they go this server without specifying any of the 
reuired options they have probably gone to the wrong server so just send 
them to the correct server


Paul


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



Re: How do you handle 'rewrite queries' ?

2009-08-13 Thread Paul Taylor

Christopher Schultz wrote:

If you're looking for URL rewriting in Java, you need go no further than
http://tuckey.org/urlrewrite/
  
So I had a look at urlrewrite, when you first mentioned it I didnt 
realise you could plug it in as a filter, and it seems to be what I need

I'm not sure you really need rewriting, since you could just map
/ws/type/ to the same servlet that handles requests to /

  

Hi, yes I do need rewrite because I need to be able to change a query like
http://localhost:8080/ws/1/release/?query=fredfmt=xml
to
http://localhost:8080/type=releasequery=fredfmt=xml

Release can also be artist,title ectera, the thing is it needs to be 
converted to the value of a parameter called type.



But I create this rule in urlrewrite.xml:

rule
   from^/ws/1/(.*)/(.*)$/from
   to type=redirect/type=$1amp;$2/to
/rule

it converts the query to
http://localhost:8080/type=release;

I enabled debugging when I look at the localhist log , it says
  Rule 0 run called with /ws/1/release/
 matched from
 needs to be redirected to /type=release

it seems it never receives anything after the the last backslash

If I pass the following query (note no ? after last backslash)
http://localhost:8080/ws/1/release/query=fredfmt=xml
it converts query to
http://localhost:8080/type=releasequery=fredfmt=xml

and debugging shows
Rule 0 run called with /ws/1/release/query=fredfmt=xml
matched from
needs to be redirected to /type=releasequery=fredfmt=xml

So, does anyone know why the ? causing an issue

thanks for your help Paul

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



Re: How do you handle 'rewrite queries' ?

2009-08-06 Thread Paul Taylor

Christopher Schultz wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Paul,

On 8/5/2009 11:30 AM, Paul Taylor wrote:
  

Thanks actually the default is not picking up the root case, I've got a
simpler related issue by war get deployed as searchserver in webapps, is
there a way I can leave it then and get it to pick up from root

i.e

http://localhost:8080?query=%22R.E.S%22type=artistfmt=xml
instead of
http://localhost:8080/searchserver?query=%22R.E.S%22type=artistfmt=xml



Deploying into the root context is easy: just name your WAR file
ROOT.war (case matters!) instead of searchserver.war.

You URL will have to be
http://localhost:8080/?query=%22R.E.S%22type=artistfmt=xml (note the
additional slash) because the host must be separated from the path by a
slash.

  

and how do i get it maps to port 80 so this will work
http://localhost/searchserver?query=%22R.E.S%22type=artistfmt=xml



If you are only using Tomcat (no web server out front), you have a few
options:

1. Just change your Connector in conf/server.xml from port=8080
   to port=80.
   - On UNIX, this requires Tomcat to run as root,
 which is highly discouraged. You can use jsvc to run as non-root
 and still bind to port 80

  
It will be on UNIX so using jsvc looks simple enough OR i could install 
Apache. IM wondering if Apache is more the more normal way to do things, 
Im trying to keep things as simple as possible for a non Java/TOmcat guy 
to install to linux.



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



Re: How do you handle 'rewrite queries' ?

2009-08-05 Thread Paul Taylor

Christopher Schultz wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Paul,

On 8/3/2009 11:03 AM, Paul Taylor wrote:
  

Hi writing web app to replace an existing open source application
(musicbrainz lucene search)  that handles queries of the form
http://host/?query=...type=...fmt=... and also the alternative form
of http://host/ws/type/?queryfmt=... using something called
lighttpd.conf ,
http://bugs.musicbrainz.org/browser/search_server/branches/lucene_server/admin/lighttpd.conf


My servlet only handles the first case at the moment how would/Should I
achieve this conversion using Apache Tomcat ( version 6)



If you're looking for URL rewriting in Java, you need go no further than
http://tuckey.org/urlrewrite/

If you're trying to rewrite URLs in a web server sitting in front of
Tomcat, you'll need to look at the documentation for that web server to
see what options are available. Apache httpd has mod_rewrite, and I have
no idea what lighttpd supports.

I'm not sure you really need rewriting, since you could just map
/ws/type/ to the same servlet that handles requests to /

Hi Chris

Im not  sure what  Im talking about when I say Url Rewriting, all I know 
is I have to support both versions of the url. The servlet is the only 
thing running so I can think I can just have a servlet engine running, 
and not even bother with a webserver at all, so could you tell me how to 
do the mapping you specify in the tomcat config



thanks Paul

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



Re: How do you handle 'rewrite queries' ?

2009-08-05 Thread Paul Taylor

Caldarale, Charles R wrote:

From: Paul Taylor [mailto:paul_t...@fastmail.fm]
Subject: Re: How do you handle 'rewrite queries' ?

could you tell me how to do the mapping you specify 
in the tomcat config



It's defined in the servlet spec, not the Tomcat config.  Read section 11 of 
the spec.

What's in your WEB-INF/web.xml file now?

 - Chuck
  

Hi , very little at the moment.

?xml version=1.0 encoding=UTF-8?
!DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 
2.3//EN http://java.sun.com/dtd/web-app_2_3.dtd;

web-app
 display-nameMusicBrainz Search Server/display-name
   servlet
   servlet-nameSearchServerServlet/servlet-name
   
servlet-classorg.musicbrainz.search.SearchServerServlet/servlet-class

/servlet
 servlet-mapping
   servlet-nameSearchServerServlet/servlet-name
   url-pattern//url-pattern
 /servlet-mapping
/web-app


Paul

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



Re: How do you handle 'rewrite queries' ?

2009-08-05 Thread Paul Taylor

Caldarale, Charles R wrote:

From: Paul Taylor [mailto:paul_t...@fastmail.fm]
Subject: Re: How do you handle 'rewrite queries' ?

  servlet-mapping
servlet-nameSearchServerServlet/servlet-name
url-pattern//url-pattern
  /servlet-mapping



The above causes the SearchServerServlet to be invoked when there's no path 
specified in the URI.  You want to add a mapping for /ws/type/ to target the 
same servlet.

  servlet-mapping
servlet-nameSearchServerServlet/servlet-name
url-pattern/ws/type/url-pattern
  /servlet-mapping

Note that you can use a wildcard character (*) if you have multiple patterns to 
match.  In fact, you may be able to simply modify the original mapping to have a 
url-pattern of /*, but I haven't tried it.

 - Chuck

  
Thanks actually the default is not picking up the root case, I've got a 
simpler related issue by war get deployed as searchserver in webapps, is 
there a way I can leave it then and get it to pick up from root


i.e

http://localhost:8080?query=%22R.E.S%22type=artistfmt=xml


instead of

http://localhost:8080/searchserver?query=%22R.E.S%22type=artistfmt=xml

and how do i get it maps to port 80 so this will work

http://localhost/searchserver?query=%22R.E.S%22type=artistfmt=xml


I know these are basic questions but every time I use Tomcat ( I last 
used it three years ago) I have real problems getting these things working


thanks Paul


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



How do you handle 'rewrite queries' ?

2009-08-03 Thread Paul Taylor
Hi writing web app to replace an existing open source application 
(musicbrainz lucene search)  that handles queries of the form 
http://host/?query=...type=...fmt=... and also the alternative form
of http://host/ws/type/?queryfmt=... using something called 
lighttpd.conf ,

http://bugs.musicbrainz.org/browser/search_server/branches/lucene_server/admin/lighttpd.conf

My servlet only handles the first case at the moment how would/Should I 
achieve this conversion using Apache Tomcat ( version 6)


thanks for any help Paul



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