You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by sk...@apache.org on 2014/05/23 09:33:39 UTC
[1/3] git commit: [OLINGO-266] timestamp support for tecsvc
Repository: olingo-odata4
Updated Branches:
refs/heads/olingo-266-tecsvc 92a4404dd -> 44e0c6495
[OLINGO-266] timestamp support for tecsvc
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/df5ce63a
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/df5ce63a
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/df5ce63a
Branch: refs/heads/olingo-266-tecsvc
Commit: df5ce63af6fb993524a9046cc093dda15e2c1432
Parents: 92a4404
Author: Stephan Klevenz <st...@sap.com>
Authored: Thu May 22 13:19:40 2014 +0200
Committer: Stephan Klevenz <st...@sap.com>
Committed: Thu May 22 13:19:40 2014 +0200
----------------------------------------------------------------------
lib/server-tecsvc/pom.xml | 15 +
lib/server-tecsvc/src/main/version/version.html | 7 +-
.../src/main/webapp/css/olingo.css | 9 +-
lib/server-tecsvc/src/main/webapp/index.jsp | 12 +-
pom.xml | 989 ++++++++++---------
5 files changed, 529 insertions(+), 503 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/df5ce63a/lib/server-tecsvc/pom.xml
----------------------------------------------------------------------
diff --git a/lib/server-tecsvc/pom.xml b/lib/server-tecsvc/pom.xml
index cf367d7..1371a00 100644
--- a/lib/server-tecsvc/pom.xml
+++ b/lib/server-tecsvc/pom.xml
@@ -83,6 +83,21 @@
</execution>
</executions>
</plugin>
+ <plugin>
+ <groupId>com.keyboardsamurais.maven</groupId>
+ <artifactId>maven-timestamp-plugin</artifactId>
+ <configuration>
+ <propertyName>timestamp</propertyName>
+ <timestampPattern>dd.MM.yyyy HH:mm</timestampPattern>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>create</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/df5ce63a/lib/server-tecsvc/src/main/version/version.html
----------------------------------------------------------------------
diff --git a/lib/server-tecsvc/src/main/version/version.html b/lib/server-tecsvc/src/main/version/version.html
index 1537389..a7d74f4 100644
--- a/lib/server-tecsvc/src/main/version/version.html
+++ b/lib/server-tecsvc/src/main/version/version.html
@@ -26,7 +26,8 @@
<tfoot>
<tr>
- <td colspan=2><a href="http://olingo.apache.org" target="self">Apache
+ <td>Home</td>
+ <td><a href="http://olingo.apache.org" target="self">Apache
Olingo</a></td>
</tr>
</tfoot>
@@ -39,5 +40,9 @@
<td>version</td>
<td>${version}</td>
</tr>
+ <tr>
+ <td>timestamp</td>
+ <td>${timestamp}</td>
+ </tr>
</tbody>
</table>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/df5ce63a/lib/server-tecsvc/src/main/webapp/css/olingo.css
----------------------------------------------------------------------
diff --git a/lib/server-tecsvc/src/main/webapp/css/olingo.css b/lib/server-tecsvc/src/main/webapp/css/olingo.css
index c2323fc..b71723b 100644
--- a/lib/server-tecsvc/src/main/webapp/css/olingo.css
+++ b/lib/server-tecsvc/src/main/webapp/css/olingo.css
@@ -32,8 +32,8 @@ a:VISITED {
color: #D358F7;
}
-td {
- padding:5px;
+td {
+ padding: 5px;
}
h1,h2,h3,h4,h5,h6 {
@@ -83,7 +83,8 @@ hr {
border-bottom: 1px solid #8904B1;
}
+
.version {
font-family: "Courier New", monospace;
- font-size: 9px;
-}
+ font-size: 10px;
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/df5ce63a/lib/server-tecsvc/src/main/webapp/index.jsp
----------------------------------------------------------------------
diff --git a/lib/server-tecsvc/src/main/webapp/index.jsp b/lib/server-tecsvc/src/main/webapp/index.jsp
index aa3bfcf..0a72eb4 100644
--- a/lib/server-tecsvc/src/main/webapp/index.jsp
+++ b/lib/server-tecsvc/src/main/webapp/index.jsp
@@ -41,11 +41,15 @@
<hr>
</div>
<h2>Technical Service</h2>
- <lu>
- <li><a href="odata.svc/">Service Document</a></li>
- <li><a href="odata.svc/$metadata">Metadata</a></li>
- </lu>
+ <div>
+
+
+ <ul>
+ <li><a href="odata.svc/">Service Document</a></li>
+ <li><a href="odata.svc/$metadata">Metadata</a></li>
+ </ul>
+ </div>
<p>
<hr>
<p>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/df5ce63a/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 0f4af7c..bfa468f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,499 +1,500 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
-
--->
+<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor
+ license agreements. See the NOTICE file distributed with this work for additional
+ information regarding copyright ownership. The ASF licenses this file to
+ you under the Apache License, Version 2.0 (the "License"); you may not use
+ this file except in compliance with the License. You may obtain a copy of
+ the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required
+ by applicable law or agreed to in writing, software distributed under the
+ License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+ OF ANY KIND, either express or implied. See the License for the specific
+ language governing permissions and limitations under the License. -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <groupId>org.apache.olingo</groupId>
- <artifactId>olingo-parent</artifactId>
- <version>0.1.0-SNAPSHOT</version>
- <packaging>pom</packaging>
-
- <name>${project.artifactId}</name>
-
- <inceptionYear>2013</inceptionYear>
-
- <parent>
- <groupId>org.apache</groupId>
- <artifactId>apache</artifactId>
- <version>14</version>
- </parent>
-
- <licenses>
- <license>
- <name>The Apache Software License, Version 2.0</name>
- <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
- <distribution>repo</distribution>
- </license>
- </licenses>
-
- <url>http://olingo.apache.org</url>
-
- <mailingLists>
- <mailingList>
- <name>Apache Olingo Developers Mailinglist</name>
- <archive>http://mail-archives.apache.org/mod_mbox/olingo-dev/</archive>
- <post>mailto:dev@olingo.apache.org</post>
- <subscribe>mailto:dev-subscribe@olingo.apache.org</subscribe>
- </mailingList>
- </mailingLists>
-
- <modules>
- <module>lib</module>
- <module>ext</module>
- <module>fit</module>
- </modules>
-
- <properties>
- <commons.codec.version>1.9</commons.codec.version>
- <commons.io.version>2.4</commons.io.version>
- <commons.lang3.version>3.3.2</commons.lang3.version>
- <commons.beanutils.version>1.9.1</commons.beanutils.version>
-
- <commons.logging.version>1.1.3</commons.logging.version>
- <commons.vfs.version>2.0</commons.vfs.version>
- <esigate.version>4.3</esigate.version>
- <servlet.version>3.0.1</servlet.version>
- <cxf.version>2.7.11</cxf.version>
- <spring.version>4.0.3.RELEASE</spring.version>
-
- <velocity.version>1.7</velocity.version>
- <maven.plugin.api.version>3.1.0</maven.plugin.api.version>
- <maven.plugin.tools.version>3.2</maven.plugin.tools.version>
-
- <hc.client.version>4.2.6</hc.client.version>
- <jackson.version>2.3.3</jackson.version>
-
- <antlr.version>4.1</antlr.version>
-
- <sl4j.version>1.7.7</sl4j.version>
-
- <log.directory>${project.build.directory}/log</log.directory>
-
- <cargo.servlet.port>9080</cargo.servlet.port>
- <cargo.tomcat.ajp.port>9889</cargo.tomcat.ajp.port>
- <cargo.rmi.port>9805</cargo.rmi.port>
- <cargo.log>${log.directory}/cargo.log</cargo.log>
- <cargo.output>${log.directory}/cargo-output.log</cargo.output>
- <tomcat.version>7.0.53</tomcat.version>
-
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- </properties>
-
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>commons-codec</groupId>
- <artifactId>commons-codec</artifactId>
- <version>${commons.codec.version}</version>
- </dependency>
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- <version>${commons.io.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-lang3</artifactId>
- <version>${commons.lang3.version}</version>
- </dependency>
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <version>${commons.logging.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>commons-beanutils</groupId>
- <artifactId>commons-beanutils</artifactId>
- <version>${commons.beanutils.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.antlr</groupId>
- <artifactId>antlr4-runtime</artifactId>
- <version>${antlr.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.httpcomponents</groupId>
- <artifactId>httpclient</artifactId>
- <version>${hc.client.version}</version>
- </dependency>
-
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-core</artifactId>
- <version>${jackson.version}</version>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-databind</artifactId>
- <version>${jackson.version}</version>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-annotations</artifactId>
- <version>${jackson.version}</version>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.dataformat</groupId>
- <artifactId>jackson-dataformat-xml</artifactId>
- <version>${jackson.version}</version>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.jaxrs</groupId>
- <artifactId>jackson-jaxrs-json-provider</artifactId>
- <version>${jackson.version}</version>
- </dependency>
- <dependency>
- <groupId>com.fasterxml</groupId>
- <artifactId>aalto-xml</artifactId>
- <version>0.9.9</version>
- </dependency>
-
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <version>${sl4j.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-vfs2</artifactId>
- <version>${commons.vfs.version}</version>
- </dependency>
- <dependency>
- <groupId>org.esigate</groupId>
- <artifactId>esigate-core</artifactId>
- <version>${esigate.version}</version>
- </dependency>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>javax.servlet-api</artifactId>
- <version>${servlet.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.cxf</groupId>
- <artifactId>cxf-rt-frontend-jaxrs</artifactId>
- <version>${cxf.version}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-web</artifactId>
- <version>${spring.version}</version>
- </dependency>
-
- <!-- Pojogen Maven Plugin depenencies -->
- <dependency>
- <groupId>org.apache.velocity</groupId>
- <artifactId>velocity</artifactId>
- <version>${velocity.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-plugin-api</artifactId>
- <version>${maven.plugin.api.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.maven.plugin-tools</groupId>
- <artifactId>maven-plugin-annotations</artifactId>
- <version>${maven.plugin.tools.version}</version>
- </dependency>
- <!-- /Pojogen Maven Plugin depenencies -->
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.11</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-all</artifactId>
- <version>1.9.5</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>xmlunit</groupId>
- <artifactId>xmlunit</artifactId>
- <version>1.5</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-simple</artifactId>
- <version>${sl4j.version}</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
- </dependencyManagement>
-
- <build>
- <finalName>${project.artifactId}-${project.version}</finalName>
-
- <pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.apache.rat</groupId>
- <artifactId>apache-rat-plugin</artifactId>
- <version>0.10</version>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-checkstyle-plugin</artifactId>
- <version>2.12.1</version>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>3.1</version>
- <configuration>
- <showWarnings>true</showWarnings>
- <showDeprecation>true</showDeprecation>
- <compilerArgument>-Xlint:unchecked</compilerArgument>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-eclipse-plugin</artifactId>
- <version>2.9</version>
- </plugin>
-
- <plugin>
- <groupId>org.codehaus.cargo</groupId>
- <artifactId>cargo-maven2-plugin</artifactId>
- <version>1.4.8</version>
- <configuration>
- <container>
- <containerId>tomcat7x</containerId>
- <zipUrlInstaller>
- <url>http://archive.apache.org/dist/tomcat/tomcat-7/v${tomcat.version}/bin/apache-tomcat-${tomcat.version}.zip</url>
- <downloadDir>${settings.localRepository}/org/codehaus/cargo/cargo-container-archives</downloadDir>
- <extractDir>${project.build.directory}/cargo/extract</extractDir>
- </zipUrlInstaller>
- <log>${cargo.log}</log>
- <output>${cargo.output}</output>
- </container>
- </configuration>
- </plugin>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <version>2.17</version>
- <configuration>
- <redirectTestOutputToFile>true</redirectTestOutputToFile>
- <runOrder>alphabetical</runOrder>
- <encoding>UTF-8</encoding>
- <inputEncoding>UTF-8</inputEncoding>
- <outputEncoding>UTF-8</outputEncoding>
- <argLine>-Dfile.encoding=UTF-8</argLine>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-failsafe-plugin</artifactId>
- <version>2.17</version>
- <configuration>
- <redirectTestOutputToFile>true</redirectTestOutputToFile>
- <runOrder>alphabetical</runOrder>
- <encoding>UTF-8</encoding>
- <inputEncoding>UTF-8</inputEncoding>
- <outputEncoding>UTF-8</outputEncoding>
- <argLine>-Dfile.encoding=UTF-8</argLine>
- </configuration>
- <executions>
- <execution>
- <id>integration-test</id>
- <goals>
- <goal>integration-test</goal>
- <goal>verify</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-resources-plugin</artifactId>
- <version>2.6</version>
- <configuration>
- <encoding>UTF-8</encoding>
- <useDefaultDelimiters>false</useDefaultDelimiters>
- <delimiters>
- <delimiter>${*}</delimiter>
- </delimiters>
- </configuration>
- </plugin>
-
- <plugin>
- <groupId>org.sonatype.plugins</groupId>
- <artifactId>jarjar-maven-plugin</artifactId>
- <version>1.8</version>
- </plugin>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-war-plugin</artifactId>
- <version>2.4</version>
- </plugin>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-invoker-plugin</artifactId>
- <version>1.8</version>
- </plugin>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-javadoc-plugin</artifactId>
- <version>2.9.1</version>
- </plugin>
- </plugins>
- </pluginManagement>
-
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>1.6</source>
- <target>1.6</target>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-eclipse-plugin</artifactId>
- <configuration>
- <addGroupIdToProjectName>true</addGroupIdToProjectName>
- <addVersionToProjectName>true</addVersionToProjectName>
- <wtpversion>2.0</wtpversion>
- <downloadSources>true</downloadSources>
- <downloadJavadocs>true</downloadJavadocs>
-
- <sourceExcludes>
- <excludes>
- target/**
- </excludes>
- </sourceExcludes>
-
- </configuration>
- </plugin>
- <plugin>
- <artifactId>maven-checkstyle-plugin</artifactId>
- <executions>
- <execution>
- <id>checkstyle</id>
- <phase>verify</phase>
- <goals>
- <goal>check</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <outputFileFormat>xml</outputFileFormat>
- <consoleOutput>true</consoleOutput>
- <enableRSS>false</enableRSS>
- <linkXRef>false</linkXRef>
- <configLocation>src/checkstyle/config.xml</configLocation>
- <sourceDirectory>${basedir}/src</sourceDirectory>
- <encoding>UTF-8</encoding>
- <failOnViolation>true</failOnViolation>
- <violationSeverity>warning</violationSeverity>
- <!-- fit autogenerated (via pojogen plugin) resources -->
- <excludes>**/fit/proxy/v4/staticservice/**/*.java, **/fit/proxy/v3/staticservice/**/*.java, **/fit/proxy/v3/actionoverloading/**/*.java, **/fit/proxy/v3/primitivekeys/**/*.java, **/fit/proxy/v3/opentype/**/*.java, **/fit/proxy/v4/opentype/**/*.java, **/fit/proxy/v4/demo/**/*.java</excludes>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.rat</groupId>
- <artifactId>apache-rat-plugin</artifactId>
- <executions>
- <execution>
- <id>rat-check</id>
- <phase>test</phase>
- <goals>
- <goal>check</goal>
- </goals>
- <configuration>
- <excludes>
- <exclude>**/META-INF/**</exclude>
- <exclude>**/*.txt</exclude>
- <exclude>**/*.ini</exclude>
- <exclude>**/*.bin</exclude>
- <exclude>**/MANIFEST.MF</exclude>
- <exclude>.gitignore</exclude>
- <exclude>.git/**</exclude>
- <exclude>bin/**</exclude>
- <exclude>**/*.local</exclude>
- <exclude>**/*.project</exclude>
- <exclude>**/*.classpath</exclude>
- <exclude>**/*.json</exclude>
- <exclude>**/*.batch</exclude>
- <exclude>**/NOTICE</exclude>
- <exclude>**/DEPENDENCIES</exclude>
- <exclude>**/nb-configuration.xml</exclude>
- <exclude>**/.externalToolBuilders/**</exclude>
- <exclude>**/maven-eclipse.xml</exclude>
- <exclude>**/ref/**</exclude>
- <exclude>**/server-ref/**</exclude>
- </excludes>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-
- <profiles>
- <profile>
- <id>javadocs</id>
-
- <build>
- <defaultGoal>javadoc:aggregate</defaultGoal>
-
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.olingo</groupId>
+ <artifactId>olingo-parent</artifactId>
+ <version>0.1.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+
+ <name>${project.artifactId}</name>
+
+ <inceptionYear>2013</inceptionYear>
+
+ <parent>
+ <groupId>org.apache</groupId>
+ <artifactId>apache</artifactId>
+ <version>14</version>
+ </parent>
+
+ <licenses>
+ <license>
+ <name>The Apache Software License, Version 2.0</name>
+ <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
+ <distribution>repo</distribution>
+ </license>
+ </licenses>
+
+ <url>http://olingo.apache.org</url>
+
+ <mailingLists>
+ <mailingList>
+ <name>Apache Olingo Developers Mailinglist</name>
+ <archive>http://mail-archives.apache.org/mod_mbox/olingo-dev/</archive>
+ <post>mailto:dev@olingo.apache.org</post>
+ <subscribe>mailto:dev-subscribe@olingo.apache.org</subscribe>
+ </mailingList>
+ </mailingLists>
+
+ <modules>
+ <module>lib</module>
+ <module>ext</module>
+ <module>fit</module>
+ </modules>
+
+ <properties>
+ <commons.codec.version>1.9</commons.codec.version>
+ <commons.io.version>2.4</commons.io.version>
+ <commons.lang3.version>3.3.2</commons.lang3.version>
+ <commons.beanutils.version>1.9.1</commons.beanutils.version>
+
+ <commons.logging.version>1.1.3</commons.logging.version>
+ <commons.vfs.version>2.0</commons.vfs.version>
+ <esigate.version>4.3</esigate.version>
+ <servlet.version>3.0.1</servlet.version>
+ <cxf.version>2.7.11</cxf.version>
+ <spring.version>4.0.3.RELEASE</spring.version>
+
+ <velocity.version>1.7</velocity.version>
+ <maven.plugin.api.version>3.1.0</maven.plugin.api.version>
+ <maven.plugin.tools.version>3.2</maven.plugin.tools.version>
+
+ <hc.client.version>4.2.6</hc.client.version>
+ <jackson.version>2.3.3</jackson.version>
+
+ <antlr.version>4.1</antlr.version>
+
+ <sl4j.version>1.7.7</sl4j.version>
+
+ <log.directory>${project.build.directory}/log</log.directory>
+
+ <cargo.servlet.port>9080</cargo.servlet.port>
+ <cargo.tomcat.ajp.port>9889</cargo.tomcat.ajp.port>
+ <cargo.rmi.port>9805</cargo.rmi.port>
+ <cargo.log>${log.directory}/cargo.log</cargo.log>
+ <cargo.output>${log.directory}/cargo-output.log</cargo.output>
+ <tomcat.version>7.0.53</tomcat.version>
+
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>commons-codec</groupId>
+ <artifactId>commons-codec</artifactId>
+ <version>${commons.codec.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>${commons.io.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ <version>${commons.lang3.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>${commons.logging.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>commons-beanutils</groupId>
+ <artifactId>commons-beanutils</artifactId>
+ <version>${commons.beanutils.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.antlr</groupId>
+ <artifactId>antlr4-runtime</artifactId>
+ <version>${antlr.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpclient</artifactId>
+ <version>${hc.client.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-core</artifactId>
+ <version>${jackson.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-databind</artifactId>
+ <version>${jackson.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-annotations</artifactId>
+ <version>${jackson.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.dataformat</groupId>
+ <artifactId>jackson-dataformat-xml</artifactId>
+ <version>${jackson.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.jaxrs</groupId>
+ <artifactId>jackson-jaxrs-json-provider</artifactId>
+ <version>${jackson.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml</groupId>
+ <artifactId>aalto-xml</artifactId>
+ <version>0.9.9</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>${sl4j.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-vfs2</artifactId>
+ <version>${commons.vfs.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.esigate</groupId>
+ <artifactId>esigate-core</artifactId>
+ <version>${esigate.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>javax.servlet-api</artifactId>
+ <version>${servlet.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-frontend-jaxrs</artifactId>
+ <version>${cxf.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-web</artifactId>
+ <version>${spring.version}</version>
+ </dependency>
+
+ <!-- Pojogen Maven Plugin depenencies -->
+ <dependency>
+ <groupId>org.apache.velocity</groupId>
+ <artifactId>velocity</artifactId>
+ <version>${velocity.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-plugin-api</artifactId>
+ <version>${maven.plugin.api.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.plugin-tools</groupId>
+ <artifactId>maven-plugin-annotations</artifactId>
+ <version>${maven.plugin.tools.version}</version>
+ </dependency>
+ <!-- /Pojogen Maven Plugin depenencies -->
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.11</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-all</artifactId>
+ <version>1.9.5</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>xmlunit</groupId>
+ <artifactId>xmlunit</artifactId>
+ <version>1.5</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ <version>${sl4j.version}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <build>
+ <finalName>${project.artifactId}-${project.version}</finalName>
+
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.rat</groupId>
+ <artifactId>apache-rat-plugin</artifactId>
+ <version>0.10</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <version>2.12.1</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.1</version>
+ <configuration>
+ <showWarnings>true</showWarnings>
+ <showDeprecation>true</showDeprecation>
+ <compilerArgument>-Xlint:unchecked</compilerArgument>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-eclipse-plugin</artifactId>
+ <version>2.9</version>
+ </plugin>
+
+ <plugin>
+ <groupId>org.codehaus.cargo</groupId>
+ <artifactId>cargo-maven2-plugin</artifactId>
+ <version>1.4.8</version>
+ <configuration>
+ <container>
+ <containerId>tomcat7x</containerId>
+ <zipUrlInstaller>
+ <url>http://archive.apache.org/dist/tomcat/tomcat-7/v${tomcat.version}/bin/apache-tomcat-${tomcat.version}.zip</url>
+ <downloadDir>${settings.localRepository}/org/codehaus/cargo/cargo-container-archives</downloadDir>
+ <extractDir>${project.build.directory}/cargo/extract</extractDir>
+ </zipUrlInstaller>
+ <log>${cargo.log}</log>
+ <output>${cargo.output}</output>
+ </container>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.17</version>
+ <configuration>
+ <redirectTestOutputToFile>true</redirectTestOutputToFile>
+ <runOrder>alphabetical</runOrder>
+ <encoding>UTF-8</encoding>
+ <inputEncoding>UTF-8</inputEncoding>
+ <outputEncoding>UTF-8</outputEncoding>
+ <argLine>-Dfile.encoding=UTF-8</argLine>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <version>2.17</version>
+ <configuration>
+ <redirectTestOutputToFile>true</redirectTestOutputToFile>
+ <runOrder>alphabetical</runOrder>
+ <encoding>UTF-8</encoding>
+ <inputEncoding>UTF-8</inputEncoding>
+ <outputEncoding>UTF-8</outputEncoding>
+ <argLine>-Dfile.encoding=UTF-8</argLine>
+ </configuration>
+ <executions>
+ <execution>
+ <id>integration-test</id>
+ <goals>
+ <goal>integration-test</goal>
+ <goal>verify</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-resources-plugin</artifactId>
+ <version>2.6</version>
+ <configuration>
+ <encoding>UTF-8</encoding>
+ <useDefaultDelimiters>false</useDefaultDelimiters>
+ <delimiters>
+ <delimiter>${*}</delimiter>
+ </delimiters>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.sonatype.plugins</groupId>
+ <artifactId>jarjar-maven-plugin</artifactId>
+ <version>1.8</version>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-war-plugin</artifactId>
+ <version>2.4</version>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-invoker-plugin</artifactId>
+ <version>1.8</version>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>2.9.1</version>
+ </plugin>
+ <plugin>
+ <groupId>com.keyboardsamurais.maven</groupId>
+ <artifactId>maven-timestamp-plugin</artifactId>
+ <version>1.0</version>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+
<plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-javadoc-plugin</artifactId>
- <inherited>true</inherited>
- <configuration>
- <destDir>javadocs</destDir>
- <detectLinks>true</detectLinks>
- <detectJavaApiLink>true</detectJavaApiLink>
- <links>
- <link>http://docs.oracle.com/javaee/6/api/</link>
- <link>http://www.slf4j.org/api/</link>
- <link>http://commons.apache.org/proper/commons-lang/javadocs/api-release/</link>
- <link>http://commons.apache.org/proper/commons-io/javadocs/api-release/</link>
- <link>http://commons.apache.org/proper/commons-beanutils/javadocs/v1.9.1/apidocs/</link>
- <link>http://commons.apache.org/proper/commons-codec/archives/1.9/apidocs/</link>
- <link>http://www.viste.com/Java/Language/http-client/httpcomponents-client-4.2.3-bin/httpcomponents-client-4.2.3/javadoc/</link>
- <link>http://fasterxml.github.io/jackson-databind/javadoc/2.3.0/</link>
- </links>
- </configuration>
- </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-eclipse-plugin</artifactId>
+ <configuration>
+ <addGroupIdToProjectName>true</addGroupIdToProjectName>
+ <addVersionToProjectName>true</addVersionToProjectName>
+ <wtpversion>2.0</wtpversion>
+ <downloadSources>true</downloadSources>
+ <downloadJavadocs>true</downloadJavadocs>
+
+ <sourceExcludes>
+ <excludes>
+ target/**
+ </excludes>
+ </sourceExcludes>
+
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>checkstyle</id>
+ <phase>verify</phase>
+ <goals>
+ <goal>check</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <outputFileFormat>xml</outputFileFormat>
+ <consoleOutput>true</consoleOutput>
+ <enableRSS>false</enableRSS>
+ <linkXRef>false</linkXRef>
+ <configLocation>src/checkstyle/config.xml</configLocation>
+ <sourceDirectory>${basedir}/src</sourceDirectory>
+ <encoding>UTF-8</encoding>
+ <failOnViolation>true</failOnViolation>
+ <violationSeverity>warning</violationSeverity>
+ <!-- fit autogenerated (via pojogen plugin) resources -->
+ <excludes>**/fit/proxy/v4/staticservice/**/*.java,
+ **/fit/proxy/v3/staticservice/**/*.java,
+ **/fit/proxy/v3/actionoverloading/**/*.java,
+ **/fit/proxy/v3/primitivekeys/**/*.java,
+ **/fit/proxy/v3/opentype/**/*.java,
+ **/fit/proxy/v4/opentype/**/*.java,
+ **/fit/proxy/v4/demo/**/*.java</excludes>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.rat</groupId>
+ <artifactId>apache-rat-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>rat-check</id>
+ <phase>test</phase>
+ <goals>
+ <goal>check</goal>
+ </goals>
+ <configuration>
+ <excludes>
+ <exclude>**/META-INF/**</exclude>
+ <exclude>**/*.txt</exclude>
+ <exclude>**/*.ini</exclude>
+ <exclude>**/*.bin</exclude>
+ <exclude>**/MANIFEST.MF</exclude>
+ <exclude>.gitignore</exclude>
+ <exclude>.git/**</exclude>
+ <exclude>bin/**</exclude>
+ <exclude>**/*.local</exclude>
+ <exclude>**/*.project</exclude>
+ <exclude>**/*.classpath</exclude>
+ <exclude>**/*.json</exclude>
+ <exclude>**/*.batch</exclude>
+ <exclude>**/NOTICE</exclude>
+ <exclude>**/DEPENDENCIES</exclude>
+ <exclude>**/nb-configuration.xml</exclude>
+ <exclude>**/.externalToolBuilders/**</exclude>
+ <exclude>**/maven-eclipse.xml</exclude>
+ <exclude>**/ref/**</exclude>
+ <exclude>**/server-ref/**</exclude>
+ </excludes>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
- </build>
- </profile>
- </profiles>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>javadocs</id>
+
+ <build>
+ <defaultGoal>javadoc:aggregate</defaultGoal>
+
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <inherited>true</inherited>
+ <configuration>
+ <destDir>javadocs</destDir>
+ <detectLinks>true</detectLinks>
+ <detectJavaApiLink>true</detectJavaApiLink>
+ <links>
+ <link>http://docs.oracle.com/javaee/6/api/</link>
+ <link>http://www.slf4j.org/api/</link>
+ <link>http://commons.apache.org/proper/commons-lang/javadocs/api-release/</link>
+ <link>http://commons.apache.org/proper/commons-io/javadocs/api-release/</link>
+ <link>http://commons.apache.org/proper/commons-beanutils/javadocs/v1.9.1/apidocs/</link>
+ <link>http://commons.apache.org/proper/commons-codec/archives/1.9/apidocs/</link>
+ <link>http://www.viste.com/Java/Language/http-client/httpcomponents-client-4.2.3-bin/httpcomponents-client-4.2.3/javadoc/</link>
+ <link>http://fasterxml.github.io/jackson-databind/javadoc/2.3.0/</link>
+ </links>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
</project>
[3/3] git commit: [OLINGO-266] redirect support
Posted by sk...@apache.org.
[OLINGO-266] redirect support
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/44e0c649
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/44e0c649
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/44e0c649
Branch: refs/heads/olingo-266-tecsvc
Commit: 44e0c6495a81c467a463a10c01746b6042b3558c
Parents: ef5d977
Author: Stephan Klevenz <st...@sap.com>
Authored: Fri May 23 09:33:08 2014 +0200
Committer: Stephan Klevenz <st...@sap.com>
Committed: Fri May 23 09:33:08 2014 +0200
----------------------------------------------------------------------
.../apache/olingo/fit/tecsvc/PingITCase.java | 18 ++-
.../commons/api/http/HttpContentType.java | 57 +++++++
.../olingo/commons/api/http/HttpHeader.java | 155 +++++++++++++++++++
.../olingo/commons/api/http/HttpStatusCode.java | 99 ++++++++++++
.../olingo/server/core/DefaultProcessor.java | 19 ++-
.../apache/olingo/server/core/ODataHandler.java | 16 +-
.../server/core/ODataHttpHandlerImpl.java | 47 +++---
.../olingo/server/core/RedirectProcessor.java | 29 ++++
.../olingo/server/tecsvc/TechnicalServlet.java | 5 +-
.../olingo/server/core/ODataHandlerTest.java | 50 +++---
10 files changed, 437 insertions(+), 58 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/44e0c649/fit/src/test/java/org/apache/olingo/fit/tecsvc/PingITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/PingITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/PingITCase.java
index 755e087..c13de43 100644
--- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/PingITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/PingITCase.java
@@ -23,11 +23,14 @@ import static org.junit.Assert.assertEquals;
import java.net.HttpURLConnection;
import java.net.URL;
+import org.apache.olingo.commons.api.http.HttpHeader;
+import org.apache.olingo.commons.api.http.HttpStatusCode;
import org.junit.Test;
public class PingITCase {
- private static final String REF_SERVICE = "http://localhost:9080/tecsvc/odata.svc/";
+ private static final String REF_SERVICE_REDIRECT = "http://localhost:9080/tecsvc/odata.svc";
+ private static final String REF_SERVICE = REF_SERVICE_REDIRECT + "/";
@Test
public void ping() throws Exception {
@@ -41,4 +44,17 @@ public class PingITCase {
assertEquals(200, code);
}
+ @Test
+ public void redirect() throws Exception {
+ URL url = new URL(REF_SERVICE_REDIRECT);
+
+ HttpURLConnection connection = (HttpURLConnection) url.openConnection();
+ connection.setRequestMethod("GET");
+ connection.connect();
+
+ int code = connection.getResponseCode();
+
+ assertEquals(HttpStatusCode.TEMPORARY_REDIRECT, code);
+ assertEquals("/", connection.getHeaderField(HttpHeader.LOCATION));
+ }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/44e0c649/lib/commons-api/src/main/java/org/apache/olingo/commons/api/http/HttpContentType.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/http/HttpContentType.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/http/HttpContentType.java
new file mode 100644
index 0000000..6bb1081
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/http/HttpContentType.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ******************************************************************************/
+package org.apache.olingo.commons.api.http;
+
+/**
+ * Constants for <code>Http Content Type</code> definitions as specified in
+ * <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html">RFC 2616 Section 14</a>.
+ *
+ */
+public interface HttpContentType {
+
+ public static final String APPLICATION_XML = "application/xml";
+ public static final String APPLICATION_XML_UTF8 = APPLICATION_XML + ";charset=utf-8";
+
+ public static final String APPLICATION_ATOM_XML = "application/atom+xml";
+ public static final String APPLICATION_ATOM_XML_UTF8 = APPLICATION_ATOM_XML + ";charset=utf-8";
+ public static final String APPLICATION_ATOM_XML_ENTRY = APPLICATION_ATOM_XML + ";type=entry";
+ public static final String APPLICATION_ATOM_XML_ENTRY_UTF8 = APPLICATION_ATOM_XML_ENTRY + ";charset=utf-8";
+ public static final String APPLICATION_ATOM_XML_FEED = APPLICATION_ATOM_XML + ";type=feed";
+ public static final String APPLICATION_ATOM_XML_FEED_UTF8 = APPLICATION_ATOM_XML_FEED + ";charset=utf-8";
+ public static final String APPLICATION_ATOM_SVC = "application/atomsvc+xml";
+ public static final String APPLICATION_ATOM_SVC_UTF8 = APPLICATION_ATOM_SVC + ";charset=utf-8";
+
+ public static final String APPLICATION_JSON = "application/json";
+ public static final String APPLICATION_JSON_VERBOSE = APPLICATION_JSON + ";odata=verbose";
+ public static final String APPLICATION_JSON_UTF8 = APPLICATION_JSON + ";charset=utf-8";
+ public static final String APPLICATION_JSON_UTF8_VERBOSE = APPLICATION_JSON_UTF8 + ";odata=verbose";
+
+ public static final String TEXT_PLAIN = "text/plain";
+ public static final String TEXT_PLAIN_UTF8 = TEXT_PLAIN + ";charset=utf-8";
+
+ public static final String TEXT_HTML = "text/html";
+
+ public static final String APPLICATION_OCTET_STREAM = "application/octet-stream";
+
+ public static final String APPLICATION_HTTP = "application/http";
+
+ public static final String MULTIPART_MIXED = "multipart/mixed";
+
+ public static final String WILDCARD = "*/*";
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/44e0c649/lib/commons-api/src/main/java/org/apache/olingo/commons/api/http/HttpHeader.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/http/HttpHeader.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/http/HttpHeader.java
new file mode 100644
index 0000000..7d1a47d
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/http/HttpHeader.java
@@ -0,0 +1,155 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ******************************************************************************/
+package org.apache.olingo.commons.api.http;
+
+/**
+ * HTTP header constants
+ *
+ *
+ */
+public interface HttpHeader {
+
+ /**
+ * See {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1">HTTP/1.1 documentation</a>}.
+ */
+ public static final String ACCEPT = "Accept";
+ /**
+ * See {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.2">HTTP/1.1 documentation</a>}.
+ */
+ public static final String ACCEPT_CHARSET = "Accept-Charset";
+ /**
+ * See {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.3">HTTP/1.1 documentation</a>}.
+ */
+ public static final String ACCEPT_ENCODING = "Accept-Encoding";
+ /**
+ * See {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.4">HTTP/1.1 documentation</a>}.
+ */
+ public static final String ACCEPT_LANGUAGE = "Accept-Language";
+ /**
+ * See {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.7">HTTP/1.1 documentation</a>}.
+ */
+ public static final String ALLOW = "Allow";
+ /**
+ * See {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.8">HTTP/1.1 documentation</a>}.
+ */
+ public static final String AUTHORIZATION = "Authorization";
+ /**
+ * See {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9">HTTP/1.1 documentation</a>}.
+ */
+ public static final String CACHE_CONTROL = "Cache-Control";
+ /**
+ * See {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.11">HTTP/1.1 documentation</a>}.
+ */
+ public static final String CONTENT_ENCODING = "Content-Encoding";
+ /**
+ * See {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.12">HTTP/1.1 documentation</a>}.
+ */
+ public static final String CONTENT_LANGUAGE = "Content-Language";
+ /**
+ * See {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.13">HTTP/1.1 documentation</a>}.
+ */
+ public static final String CONTENT_LENGTH = "Content-Length";
+ /**
+ * See {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.14">HTTP/1.1 documentation</a>}.
+ */
+ public static final String CONTENT_LOCATION = "Content-Location";
+ /**
+ * See {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17">HTTP/1.1 documentation</a>}.
+ */
+ public static final String CONTENT_TYPE = "Content-Type";
+ /**
+ * See {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.18">HTTP/1.1 documentation</a>}.
+ */
+ public static final String DATE = "Date";
+ /**
+ * See {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.19">HTTP/1.1 documentation</a>}.
+ */
+ public static final String ETAG = "ETag";
+ /**
+ * See {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.21">HTTP/1.1 documentation</a>}.
+ */
+ public static final String EXPIRES = "Expires";
+ /**
+ * See {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.23">HTTP/1.1 documentation</a>}.
+ */
+ public static final String HOST = "Host";
+ /**
+ * See {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.24">HTTP/1.1 documentation</a>}.
+ */
+ public static final String IF_MATCH = "If-Match";
+ /**
+ * See {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.25">HTTP/1.1 documentation</a>}.
+ */
+ public static final String IF_MODIFIED_SINCE = "If-Modified-Since";
+ /**
+ * See {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.26">HTTP/1.1 documentation</a>}.
+ */
+ public static final String IF_NONE_MATCH = "If-None-Match";
+ /**
+ * See {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.28">HTTP/1.1 documentation</a>}.
+ */
+ public static final String IF_UNMODIFIED_SINCE = "If-Unmodified-Since";
+ /**
+ * See {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.29">HTTP/1.1 documentation</a>}.
+ */
+ public static final String LAST_MODIFIED = "Last-Modified";
+ /**
+ * See {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.30">HTTP/1.1 documentation</a>}.
+ */
+ public static final String LOCATION = "Location";
+ /**
+ * See {@link <a href="http://tools.ietf.org/html/rfc5988#page-6">Web Linking (IETF RFC-5988) documentation</a>}.
+ */
+ public static final String LINK = "Link";
+ /**
+ * See {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.37">HTTP/1.1 documentation</a>}.
+ */
+ public static final String RETRY_AFTER = "Retry-After";
+ /**
+ * See {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.43">HTTP/1.1 documentation</a>}.
+ */
+ public static final String USER_AGENT = "User-Agent";
+ /**
+ * See {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.44">HTTP/1.1 documentation</a>}.
+ */
+ public static final String VARY = "Vary";
+ /**
+ * See {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.47">HTTP/1.1 documentation</a>}.
+ */
+ public static final String WWW_AUTHENTICATE = "WWW-Authenticate";
+ /**
+ * See {@link <a href="http://www.ietf.org/rfc/rfc2109.txt">IETF RFC 2109</a>}.
+ */
+ public static final String COOKIE = "Cookie";
+ /**
+ * See {@link <a href="http://www.ietf.org/rfc/rfc2109.txt">IETF RFC 2109</a>}.
+ */
+ public static final String SET_COOKIE = "Set-Cookie";
+
+ /**
+ * non standard header
+ */
+ public static final String X_HTTP_METHOD = "X-HTTP-Method";
+
+ /**
+ * non standard header
+ */
+ public static final String X_HTTP_METHOD_OVERRIDE = "X-HTTP-Method-Override";
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/44e0c649/lib/commons-api/src/main/java/org/apache/olingo/commons/api/http/HttpStatusCode.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/http/HttpStatusCode.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/http/HttpStatusCode.java
new file mode 100644
index 0000000..00e2200
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/http/HttpStatusCode.java
@@ -0,0 +1,99 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ******************************************************************************/
+package org.apache.olingo.commons.api.http;
+
+/**
+ * HTTP status codes as defined in RFC2616-sec10
+ * and additional status codes as defined in RFC6585
+ *
+ */
+public enum HttpStatusCode {
+
+ OK(200, "OK"), CREATED(201, "Created"), ACCEPTED(202, "Accepted"), NO_CONTENT(204, "No Content"), RESET_CONTENT(205,
+ "Reset Content"), PARTIAL_CONTENT(206, "Partial Content"),
+
+ MOVED_PERMANENTLY(301, "Moved Permanently"), FOUND(302, "Found"), SEE_OTHER(303, "See Other"), NOT_MODIFIED(304,
+ "Not Modified"), USE_PROXY(305, "Use Proxy"), TEMPORARY_REDIRECT(307, "Temporary Redirect"),
+
+ BAD_REQUEST(400, "Bad Request"), UNAUTHORIZED(401, "Unauthorized"), PAYMENT_REQUIRED(402, "Payment Required"),
+ FORBIDDEN(
+ 403, "Forbidden"), NOT_FOUND(404, "Not Found"), METHOD_NOT_ALLOWED(405, "Method Not Allowed"), NOT_ACCEPTABLE(
+ 406, "Not Acceptable"), PROXY_AUTHENTICATION_REQUIRED(407, "Proxy Authentication Required"), REQUEST_TIMEOUT(408,
+ "Request Timeout"), CONFLICT(409, "Conflict"), GONE(410, "Gone"), LENGTH_REQUIRED(411, "Length Required"),
+ PRECONDITION_FAILED(412, "Precondition Failed"), REQUEST_ENTITY_TOO_LARGE(413, "Request Entity Too Large"),
+ REQUEST_URI_TOO_LONG(414, "Request-URI Too Long"), UNSUPPORTED_MEDIA_TYPE(415, "Unsupported Media Type"),
+ REQUESTED_RANGE_NOT_SATISFIABLE(416, "Requested Range Not Satisfiable"),
+ EXPECTATION_FAILED(417, "Expectation Failed"), PRECONDITION_REQUIRED(428, "Precondition Required"),
+
+ INTERNAL_SERVER_ERROR(500, "Internal Server Error"), NOT_IMPLEMENTED(501, "Not Implemented"), BAD_GATEWAY(502,
+ "Bad Gateway"), SERVICE_UNAVAILABLE(503, "Service Unavailable"), GATEWAY_TIMEOUT(504, "Gateway Timeout"),
+ HTTP_VERSION_NOT_SUPPORTED(505, "HTTP Version Not Supported");
+
+ private final int code;
+ private final String info;
+
+ HttpStatusCode(final int statusCode, final String info) {
+ code = statusCode;
+ this.info = info;
+ }
+
+ /**
+ * Convert a numerical status code into the corresponding status enum object.
+ *
+ * @param statusCode the numerical status code
+ * @return the matching status enum object or null if no matching enum is defined
+ */
+ public static HttpStatusCode fromStatusCode(final int statusCode) {
+ for (final HttpStatusCode s : HttpStatusCode.values()) {
+ if (s.code == statusCode) {
+ return s;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Get the associated status code.
+ *
+ * @return the status code.
+ */
+ public int getStatusCode() {
+ return code;
+ }
+
+ /**
+ * Get the status code info.
+ *
+ * @return the status code info
+ */
+ public String getInfo() {
+ return toString();
+ }
+
+ /**
+ * Get the status code info.
+ *
+ * @return the status code info
+ */
+ @Override
+ public String toString() {
+ return info;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/44e0c649/lib/server-core/src/main/java/org/apache/olingo/server/core/DefaultProcessor.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/DefaultProcessor.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/DefaultProcessor.java
index 1bf9dac..9a64b50 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/DefaultProcessor.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/DefaultProcessor.java
@@ -21,6 +21,9 @@ package org.apache.olingo.server.core;
import java.io.InputStream;
import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.http.HttpContentType;
+import org.apache.olingo.commons.api.http.HttpHeader;
+import org.apache.olingo.commons.api.http.HttpStatusCode;
import org.apache.olingo.server.api.OData;
import org.apache.olingo.server.api.ODataRequest;
import org.apache.olingo.server.api.ODataResponse;
@@ -30,8 +33,8 @@ import org.apache.olingo.server.api.serializer.ODataFormat;
import org.apache.olingo.server.api.serializer.ODataSerializer;
import org.apache.olingo.server.api.uri.UriInfo;
-public class DefaultProcessor implements MetadataProcessor, ServiceDocumentProcessor {
-
+public class DefaultProcessor implements MetadataProcessor, ServiceDocumentProcessor, RedirectProcessor {
+
private OData odata;
private Edm edm;
@@ -50,7 +53,7 @@ public class DefaultProcessor implements MetadataProcessor, ServiceDocumentProce
responseEntity = serializer.serviceDocument(edm, request.getRawBaseUri());
response.setStatusCode(200);
- response.setHeader("Content-Type", "application/json");
+ response.setHeader(HttpHeader.CONTENT_TYPE, HttpContentType.APPLICATION_JSON);
response.setContent(responseEntity);
}
@@ -63,8 +66,16 @@ public class DefaultProcessor implements MetadataProcessor, ServiceDocumentProce
serializer = odata.createSerializer(ODataFormat.XML);
responseEntity = serializer.metadataDocument(edm);
response.setStatusCode(200);
- response.setHeader("Content-Type", "application/xml");
+ response.setHeader(HttpHeader.CONTENT_TYPE, HttpContentType.APPLICATION_XML);
response.setContent(responseEntity);
}
+ @Override
+ public void redirect(ODataRequest request, ODataResponse response) {
+ response.setStatusCode(HttpStatusCode.TEMPORARY_REDIRECT.getStatusCode());
+
+ String location = request.getRawRequestUri() + "/";
+ response.setHeader(HttpHeader.LOCATION, location);
+ }
+
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/44e0c649/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHandler.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHandler.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHandler.java
index d2d9b63..5d0f09f 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHandler.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHandler.java
@@ -23,6 +23,7 @@ import java.util.Map;
import org.apache.olingo.commons.api.ODataRuntimeException;
import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.http.HttpContentType;
import org.apache.olingo.server.api.OData;
import org.apache.olingo.server.api.ODataRequest;
import org.apache.olingo.server.api.ODataResponse;
@@ -33,8 +34,6 @@ import org.apache.olingo.server.api.uri.UriInfo;
import org.apache.olingo.server.core.uri.parser.Parser;
import org.apache.olingo.server.core.uri.validator.UriValidator;
-import sun.reflect.generics.reflectiveObjects.NotImplementedException;
-
public class ODataHandler {
private final OData odata;
@@ -63,11 +62,16 @@ public class ODataHandler {
switch (uriInfo.getKind()) {
case metadata:
MetadataProcessor mp = selectProcessor(MetadataProcessor.class);
- mp.readMetadata(request, response, uriInfo, "application/xml");
+ mp.readMetadata(request, response, uriInfo, HttpContentType.APPLICATION_XML);
break;
case service:
- ServiceDocumentProcessor sdp = selectProcessor(ServiceDocumentProcessor.class);
- sdp.readServiceDocument(request, response, uriInfo, "application/json");
+ if ("".equals(request.getRawODataPath())) {
+ RedirectProcessor rdp = selectProcessor(RedirectProcessor.class);
+ rdp.redirect(request, response);
+ }else{
+ ServiceDocumentProcessor sdp = selectProcessor(ServiceDocumentProcessor.class);
+ sdp.readServiceDocument(request, response, uriInfo, HttpContentType.APPLICATION_JSON);
+ }
break;
default:
throw new ODataRuntimeException("not implemented");
@@ -85,7 +89,7 @@ public class ODataHandler {
T p = (T) processors.get(cls);
if (p == null) {
- throw new NotImplementedException();
+ throw new ODataRuntimeException("Not implemented");
}
return p;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/44e0c649/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHttpHandlerImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHttpHandlerImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHttpHandlerImpl.java
index a212ea8..3703e6b 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHttpHandlerImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHttpHandlerImpl.java
@@ -33,6 +33,7 @@ import javax.servlet.http.HttpServletResponse;
import org.apache.olingo.commons.api.ODataRuntimeException;
import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.http.HttpHeader;
import org.apache.olingo.commons.api.http.HttpMethod;
import org.apache.olingo.server.api.OData;
import org.apache.olingo.server.api.ODataHttpHandler;
@@ -46,20 +47,16 @@ public class ODataHttpHandlerImpl implements ODataHttpHandler {
private static final Logger LOG = LoggerFactory.getLogger(ODataHttpHandlerImpl.class);
-// private Edm edm;
-// private OData server;
private ODataHandler handler;
public ODataHttpHandlerImpl(final OData server, final Edm edm) {
-// this.edm = edm;
-// this.server = server;
handler = new ODataHandler(server, edm);
}
@Override
public void process(final HttpServletRequest request, final HttpServletResponse response) {
ODataRequest odRequest = createODataRequest(request, 0);
-
+
ODataResponse odResponse = handler.process(odRequest);
convertToHttp(response, odResponse);
@@ -73,23 +70,25 @@ public class ODataHttpHandlerImpl implements ODataHttpHandler {
}
InputStream input = odResponse.getContent();
- OutputStream output;
- try {
- output = response.getOutputStream();
- byte[] buffer = new byte[1024];
- int n = 0;
- while (-1 != (n = input.read(buffer))) {
- output.write(buffer, 0, n);
- }
- } catch (IOException e) {
- LOG.error(e.getMessage(), e);
- throw new ODataRuntimeException(e);
- } finally {
- if (input != null) {
- try {
- input.close();
- } catch (IOException e) {
- throw new ODataRuntimeException(e);
+ if (input != null) {
+ OutputStream output;
+ try {
+ output = response.getOutputStream();
+ byte[] buffer = new byte[1024];
+ int n = 0;
+ while (-1 != (n = input.read(buffer))) {
+ output.write(buffer, 0, n);
+ }
+ } catch (IOException e) {
+ LOG.error(e.getMessage(), e);
+ throw new ODataRuntimeException(e);
+ } finally {
+ if (input != null) {
+ try {
+ input.close();
+ } catch (IOException e) {
+ throw new ODataRuntimeException(e);
+ }
}
}
}
@@ -116,8 +115,8 @@ public class ODataHttpHandlerImpl implements ODataHttpHandler {
HttpMethod httpRequestMethod = HttpMethod.valueOf(httpRequest.getMethod());
if (httpRequestMethod == HttpMethod.POST) {
- String xHttpMethod = httpRequest.getHeader("X-HTTP-Method");
- String xHttpMethodOverride = httpRequest.getHeader("X-HTTP-Method-Override");
+ String xHttpMethod = httpRequest.getHeader(HttpHeader.X_HTTP_METHOD);
+ String xHttpMethodOverride = httpRequest.getHeader(HttpHeader.X_HTTP_METHOD_OVERRIDE);
if (xHttpMethod == null && xHttpMethodOverride == null) {
odRequest.setMethod(httpRequestMethod);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/44e0c649/lib/server-core/src/main/java/org/apache/olingo/server/core/RedirectProcessor.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/RedirectProcessor.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/RedirectProcessor.java
new file mode 100644
index 0000000..c741cac
--- /dev/null
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/RedirectProcessor.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.server.core;
+
+import org.apache.olingo.server.api.ODataRequest;
+import org.apache.olingo.server.api.ODataResponse;
+import org.apache.olingo.server.api.processor.Processor;
+
+public interface RedirectProcessor extends Processor {
+
+ void redirect(ODataRequest request, ODataResponse response);
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/44e0c649/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/TechnicalServlet.java
----------------------------------------------------------------------
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/TechnicalServlet.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/TechnicalServlet.java
index f49cd99..1daf164 100644
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/TechnicalServlet.java
+++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/TechnicalServlet.java
@@ -48,10 +48,7 @@ public class TechnicalServlet extends HttpServlet {
ODataHttpHandler handler = odata.createHandler(edm);
handler.register(new TechnicalProcessor());
-
-// handler.registerServiceDocumentProcessor(new TechnicalProcessor());
-// handler.registerMetadataProcessor(new TechnicalProcessor());
-
+
handler.process(req, resp);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/44e0c649/lib/server-test/src/test/java/org/apache/olingo/server/core/ODataHandlerTest.java
----------------------------------------------------------------------
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/ODataHandlerTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/ODataHandlerTest.java
index 3021f27..ade4245 100644
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/ODataHandlerTest.java
+++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/ODataHandlerTest.java
@@ -25,12 +25,14 @@ import static org.mockito.Mockito.mock;
import org.apache.commons.io.IOUtils;
import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.http.HttpContentType;
+import org.apache.olingo.commons.api.http.HttpHeader;
import org.apache.olingo.commons.api.http.HttpMethod;
+import org.apache.olingo.commons.api.http.HttpStatusCode;
import org.apache.olingo.server.api.OData;
import org.apache.olingo.server.api.ODataRequest;
import org.apache.olingo.server.api.ODataResponse;
import org.apache.olingo.server.api.processor.MetadataProcessor;
-import org.apache.olingo.server.api.processor.Processor;
import org.apache.olingo.server.api.processor.ServiceDocumentProcessor;
import org.apache.olingo.server.tecsvc.provider.EdmTechProvider;
import org.junit.Before;
@@ -53,34 +55,31 @@ public class ODataHandlerTest {
ODataRequest request = new ODataRequest();
request.setMethod(HttpMethod.GET);
- request.setRawBaseUri("http://localhost/odata/");
- request.setRawODataPath("");
+ request.setRawBaseUri("http://localhost/odata");
+ request.setRawODataPath("/");
ServiceDocumentProcessor processor = mock(ServiceDocumentProcessor.class);
handler.register(processor);
-
+
ODataResponse response = handler.process(request);
-
+
assertNotNull(response);
assertEquals(0, response.getStatusCode());
}
-
+
@Test
public void testServiceDocumentDefault() throws Exception {
ODataRequest request = new ODataRequest();
request.setMethod(HttpMethod.GET);
- request.setRawBaseUri("http://localhost/odata/");
- request.setRawODataPath("");
+ request.setRawBaseUri("http://localhost/odata");
+ request.setRawODataPath("/");
- Processor processor = mock(Processor.class);
- handler.register(processor);
-
ODataResponse response = handler.process(request);
-
+
assertNotNull(response);
assertEquals(200, response.getStatusCode());
- assertEquals("application/json", response.getHeaders().get("Content-Type"));
+ assertEquals(HttpContentType.APPLICATION_JSON, response.getHeaders().get(HttpHeader.CONTENT_TYPE));
assertNotNull(response.getContent());
String doc = IOUtils.toString(response.getContent());
@@ -90,6 +89,22 @@ public class ODataHandlerTest {
}
@Test
+ public void testServiceDocumentRedirect() throws Exception {
+ ODataRequest request = new ODataRequest();
+
+ request.setMethod(HttpMethod.GET);
+ request.setRawBaseUri("http://localhost/odata");
+ request.setRawRequestUri("http://localhost/odata");
+ request.setRawODataPath("");
+
+ ODataResponse response = handler.process(request);
+
+ assertNotNull(response);
+ assertEquals(HttpStatusCode.TEMPORARY_REDIRECT.getStatusCode(), response.getStatusCode());
+ assertEquals("http://localhost/odata/", response.getHeaders().get(HttpHeader.LOCATION));
+ }
+
+ @Test
public void testMetadataNonDefault() throws Exception {
ODataRequest request = new ODataRequest();
@@ -98,9 +113,9 @@ public class ODataHandlerTest {
MetadataProcessor processor = mock(MetadataProcessor.class);
handler.register(processor);
-
+
ODataResponse response = handler.process(request);
-
+
assertNotNull(response);
assertEquals(0, response.getStatusCode());
}
@@ -112,14 +127,11 @@ public class ODataHandlerTest {
request.setMethod(HttpMethod.GET);
request.setRawODataPath("$metadata");
- Processor processor = mock(Processor.class);
- handler.register(processor);
-
ODataResponse response = handler.process(request);
assertNotNull(response);
assertEquals(200, response.getStatusCode());
- assertEquals("application/xml", response.getHeaders().get("Content-Type"));
+ assertEquals(HttpContentType.APPLICATION_XML, response.getHeaders().get(HttpHeader.CONTENT_TYPE));
assertNotNull(response.getContent());
String doc = IOUtils.toString(response.getContent());
[2/3] git commit: [OLINGO-266] delete dummy
Posted by sk...@apache.org.
[OLINGO-266] delete dummy
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/ef5d9776
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/ef5d9776
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/ef5d9776
Branch: refs/heads/olingo-266-tecsvc
Commit: ef5d97762948e80969b51651b48f5fe615f544c0
Parents: df5ce63
Author: Stephan Klevenz <st...@sap.com>
Authored: Thu May 22 13:20:34 2014 +0200
Committer: Stephan Klevenz <st...@sap.com>
Committed: Thu May 22 13:20:34 2014 +0200
----------------------------------------------------------------------
.../server/api/processor/DeleteMeProcessor.java | 23 -----------
.../olingo/server/core/ODataHandlerTest.java | 41 ++++++++++++++++++--
2 files changed, 37 insertions(+), 27 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ef5d9776/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/DeleteMeProcessor.java
----------------------------------------------------------------------
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/DeleteMeProcessor.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/DeleteMeProcessor.java
deleted file mode 100644
index 783e709..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/DeleteMeProcessor.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.server.api.processor;
-
-public interface DeleteMeProcessor extends Processor {
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ef5d9776/lib/server-test/src/test/java/org/apache/olingo/server/core/ODataHandlerTest.java
----------------------------------------------------------------------
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/ODataHandlerTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/ODataHandlerTest.java
index 1b7c891..3021f27 100644
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/ODataHandlerTest.java
+++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/ODataHandlerTest.java
@@ -22,7 +22,6 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.withSettings;
import org.apache.commons.io.IOUtils;
import org.apache.olingo.commons.api.edm.Edm;
@@ -30,8 +29,9 @@ import org.apache.olingo.commons.api.http.HttpMethod;
import org.apache.olingo.server.api.OData;
import org.apache.olingo.server.api.ODataRequest;
import org.apache.olingo.server.api.ODataResponse;
-import org.apache.olingo.server.api.processor.DeleteMeProcessor;
+import org.apache.olingo.server.api.processor.MetadataProcessor;
import org.apache.olingo.server.api.processor.Processor;
+import org.apache.olingo.server.api.processor.ServiceDocumentProcessor;
import org.apache.olingo.server.tecsvc.provider.EdmTechProvider;
import org.junit.Before;
import org.junit.Test;
@@ -49,6 +49,23 @@ public class ODataHandlerTest {
}
@Test
+ public void testServiceDocumentNonDefault() throws Exception {
+ ODataRequest request = new ODataRequest();
+
+ request.setMethod(HttpMethod.GET);
+ request.setRawBaseUri("http://localhost/odata/");
+ request.setRawODataPath("");
+
+ ServiceDocumentProcessor processor = mock(ServiceDocumentProcessor.class);
+ handler.register(processor);
+
+ ODataResponse response = handler.process(request);
+
+ assertNotNull(response);
+ assertEquals(0, response.getStatusCode());
+ }
+
+ @Test
public void testServiceDocumentDefault() throws Exception {
ODataRequest request = new ODataRequest();
@@ -56,7 +73,7 @@ public class ODataHandlerTest {
request.setRawBaseUri("http://localhost/odata/");
request.setRawODataPath("");
- Processor processor = mock(Processor.class, withSettings().extraInterfaces(DeleteMeProcessor.class));
+ Processor processor = mock(Processor.class);
handler.register(processor);
ODataResponse response = handler.process(request);
@@ -73,13 +90,29 @@ public class ODataHandlerTest {
}
@Test
+ public void testMetadataNonDefault() throws Exception {
+ ODataRequest request = new ODataRequest();
+
+ request.setMethod(HttpMethod.GET);
+ request.setRawODataPath("$metadata");
+
+ MetadataProcessor processor = mock(MetadataProcessor.class);
+ handler.register(processor);
+
+ ODataResponse response = handler.process(request);
+
+ assertNotNull(response);
+ assertEquals(0, response.getStatusCode());
+ }
+
+ @Test
public void testMetadataDefault() throws Exception {
ODataRequest request = new ODataRequest();
request.setMethod(HttpMethod.GET);
request.setRawODataPath("$metadata");
- Processor processor = mock(Processor.class, withSettings().extraInterfaces(DeleteMeProcessor.class));
+ Processor processor = mock(Processor.class);
handler.register(processor);
ODataResponse response = handler.process(request);