Archive for December, 2010

h1

Get a file request to jetty maven web project via web.xml

December 17, 2010

When using a maven managed POM project which has an embedded jetty server, I wanted to be able to direct some requests straight to a file in the webapp directory rather than being handled by the servlet code. I found that adding the following to src/main/scala/webapp/WEB-INF/web.xml allowed me to do this.

        <servlet-mapping>
         <servlet-name>default</servlet-name>
         <url-pattern>filename.ext</url-pattern>
        </servlet-mapping>
Advertisements
h1

Making a field unique after creating a table

December 15, 2010

The MySQL browser on Linux doesn’t appear to let you add unique column indexes to a table in retrospect after the table has been created. There are mysql commands though which allow this:

ALTER TABLE tablename ADD UNIQUE name_of_index (col1,col2...);

Statement to make unique columns without altering table:

CREATE UNIQUE INDEX name_of_index ON tablename (col1,col2,col3...);