You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wink.apache.org by bl...@apache.org on 2010/05/19 17:22:17 UTC
svn commit: r946218 [2/4] - in /incubator/wink/trunk:
wink-assembly/apache-wink/binarydist/
wink-client/src/test/java/org/apache/wink/client/
wink-common/src/main/java/org/apache/wink/common/internal/contexts/
wink-common/src/main/java/org/apache/wink/...
Modified: incubator/wink/trunk/wink-component-test-support/src/main/java/org/apache/wink/logging/WinkLoggerAdapter.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-component-test-support/src/main/java/org/apache/wink/logging/WinkLoggerAdapter.java?rev=946218&r1=946217&r2=946218&view=diff
==============================================================================
--- incubator/wink/trunk/wink-component-test-support/src/main/java/org/apache/wink/logging/WinkLoggerAdapter.java (original)
+++ incubator/wink/trunk/wink-component-test-support/src/main/java/org/apache/wink/logging/WinkLoggerAdapter.java Wed May 19 15:22:13 2010
@@ -1,173 +1,173 @@
-/*******************************************************************************
- * 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.wink.logging;
-
-import java.util.logging.Level;
-import java.util.logging.LogRecord;
-
-import org.slf4j.Marker;
-import org.slf4j.helpers.MarkerIgnoringBase;
-import org.slf4j.spi.LocationAwareLogger;
-
-@SuppressWarnings("serial")
-public final class WinkLoggerAdapter extends MarkerIgnoringBase implements
- LocationAwareLogger {
-
- final java.util.logging.Logger logger;
-
- WinkLoggerAdapter(java.util.logging.Logger logger) {
- this.logger = logger;
- this.logger.setLevel(Level.FINEST);
- this.logger.addHandler(new WinkLogHandler());
- }
-
- public boolean isTraceEnabled() {
- return logger.isLoggable(Level.FINEST);
- }
-
- public void trace(String message) {
- log(Level.FINEST, message, null);
- }
-
- public void trace(String message, Object arg) {
- log(Level.FINEST, message, null);
- }
-
- public void trace(String message, Object arg1, Object arg2) {
- log(Level.FINEST, message, null);
- }
-
- public void trace(String message, Object[] argArray) {
- log(Level.FINEST, message, null);
- }
-
- public void trace(String msg, Throwable t) {
- log(Level.FINEST, msg, t);
- }
-
- public boolean isDebugEnabled() {
- return logger.isLoggable(Level.FINE);
- }
-
- public void debug(String msg) {
- log(Level.FINE, msg, null);
- }
-
- public void debug(String message, Object arg) {
- log(Level.FINE, message, null);
- }
-
- public void debug(String message, Object arg1, Object arg2) {
- log(Level.FINE, message, null);
- }
-
- public void debug(String message, Object[] argArray) {
- log(Level.FINE, message, null);
- }
-
- public void debug(String msg, Throwable t) {
- log(Level.FINE, msg, t);
- }
-
- public boolean isInfoEnabled() {
- return logger.isLoggable(Level.INFO);
- }
-
- public void info(String msg) {
- log(Level.INFO, msg, null);
- }
-
- public void info(String message, Object arg) {
- log(Level.INFO, message, null);
- }
-
- public void info(String message, Object arg1, Object arg2) {
- log(Level.INFO, message, null);
- }
-
- public void info(String message, Object[] argArray) {
- log(Level.INFO, message, null);
- }
-
- public void info(String msg, Throwable t) {
- log(Level.INFO, msg, t);
- }
-
- public boolean isWarnEnabled() {
- return logger.isLoggable(Level.WARNING);
- }
-
- public void warn(String msg) {
- log(Level.WARNING, msg, null);
- }
-
- public void warn(String message, Object arg) {
- log(Level.WARNING, message, null);
- }
-
- public void warn(String message, Object arg1, Object arg2) {
- log(Level.WARNING, message, null);
- }
-
- public void warn(String message, Object[] argArray) {
- log(Level.WARNING, message, null);
- }
-
- public void warn(String msg, Throwable t) {
- log(Level.WARNING, msg, t);
- }
-
- public boolean isErrorEnabled() {
- return logger.isLoggable(Level.SEVERE);
- }
-
- public void error(String msg) {
- log(Level.SEVERE, msg, null);
- }
-
- public void error(String message, Object arg) {
- log(Level.SEVERE, message, null);
- }
-
- public void error(String message, Object arg1, Object arg2) {
- log(Level.SEVERE, message, null);
- }
-
- public void error(String message, Object[] argArray) {
- log(Level.SEVERE, message, null);
- }
-
- public void error(String msg, Throwable t) {
- log(Level.SEVERE, msg, t);
- }
-
- private void log(Level level, String msg, Throwable t) {
- LogRecord record = new LogRecord(level, msg);
- record.setThrown(t);
- record.setLoggerName(logger.getName());
- logger.log(record);
- }
-
- public void log(Marker marker, String caller, int level, String message,
- Throwable t) {
- log(Level.FINEST, message, t);
- }
-}
+/*******************************************************************************
+ * 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.wink.logging;
+
+import java.util.logging.Level;
+import java.util.logging.LogRecord;
+
+import org.slf4j.Marker;
+import org.slf4j.helpers.MarkerIgnoringBase;
+import org.slf4j.spi.LocationAwareLogger;
+
+@SuppressWarnings("serial")
+public final class WinkLoggerAdapter extends MarkerIgnoringBase implements
+ LocationAwareLogger {
+
+ final java.util.logging.Logger logger;
+
+ WinkLoggerAdapter(java.util.logging.Logger logger) {
+ this.logger = logger;
+ this.logger.setLevel(Level.FINEST);
+ this.logger.addHandler(new WinkLogHandler());
+ }
+
+ public boolean isTraceEnabled() {
+ return logger.isLoggable(Level.FINEST);
+ }
+
+ public void trace(String message) {
+ log(Level.FINEST, message, null);
+ }
+
+ public void trace(String message, Object arg) {
+ log(Level.FINEST, message, null);
+ }
+
+ public void trace(String message, Object arg1, Object arg2) {
+ log(Level.FINEST, message, null);
+ }
+
+ public void trace(String message, Object[] argArray) {
+ log(Level.FINEST, message, null);
+ }
+
+ public void trace(String msg, Throwable t) {
+ log(Level.FINEST, msg, t);
+ }
+
+ public boolean isDebugEnabled() {
+ return logger.isLoggable(Level.FINE);
+ }
+
+ public void debug(String msg) {
+ log(Level.FINE, msg, null);
+ }
+
+ public void debug(String message, Object arg) {
+ log(Level.FINE, message, null);
+ }
+
+ public void debug(String message, Object arg1, Object arg2) {
+ log(Level.FINE, message, null);
+ }
+
+ public void debug(String message, Object[] argArray) {
+ log(Level.FINE, message, null);
+ }
+
+ public void debug(String msg, Throwable t) {
+ log(Level.FINE, msg, t);
+ }
+
+ public boolean isInfoEnabled() {
+ return logger.isLoggable(Level.INFO);
+ }
+
+ public void info(String msg) {
+ log(Level.INFO, msg, null);
+ }
+
+ public void info(String message, Object arg) {
+ log(Level.INFO, message, null);
+ }
+
+ public void info(String message, Object arg1, Object arg2) {
+ log(Level.INFO, message, null);
+ }
+
+ public void info(String message, Object[] argArray) {
+ log(Level.INFO, message, null);
+ }
+
+ public void info(String msg, Throwable t) {
+ log(Level.INFO, msg, t);
+ }
+
+ public boolean isWarnEnabled() {
+ return logger.isLoggable(Level.WARNING);
+ }
+
+ public void warn(String msg) {
+ log(Level.WARNING, msg, null);
+ }
+
+ public void warn(String message, Object arg) {
+ log(Level.WARNING, message, null);
+ }
+
+ public void warn(String message, Object arg1, Object arg2) {
+ log(Level.WARNING, message, null);
+ }
+
+ public void warn(String message, Object[] argArray) {
+ log(Level.WARNING, message, null);
+ }
+
+ public void warn(String msg, Throwable t) {
+ log(Level.WARNING, msg, t);
+ }
+
+ public boolean isErrorEnabled() {
+ return logger.isLoggable(Level.SEVERE);
+ }
+
+ public void error(String msg) {
+ log(Level.SEVERE, msg, null);
+ }
+
+ public void error(String message, Object arg) {
+ log(Level.SEVERE, message, null);
+ }
+
+ public void error(String message, Object arg1, Object arg2) {
+ log(Level.SEVERE, message, null);
+ }
+
+ public void error(String message, Object[] argArray) {
+ log(Level.SEVERE, message, null);
+ }
+
+ public void error(String msg, Throwable t) {
+ log(Level.SEVERE, msg, t);
+ }
+
+ private void log(Level level, String msg, Throwable t) {
+ LogRecord record = new LogRecord(level, msg);
+ record.setThrown(t);
+ record.setLoggerName(logger.getName());
+ logger.log(record);
+ }
+
+ public void log(Marker marker, String caller, int level, String message,
+ Throwable t) {
+ log(Level.FINEST, message, t);
+ }
+}
Propchange: incubator/wink/trunk/wink-component-test-support/src/main/java/org/apache/wink/logging/WinkLoggerAdapter.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/wink/trunk/wink-component-test-support/src/main/java/org/apache/wink/logging/WinkLoggerFactory.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-component-test-support/src/main/java/org/apache/wink/logging/WinkLoggerFactory.java?rev=946218&r1=946217&r2=946218&view=diff
==============================================================================
--- incubator/wink/trunk/wink-component-test-support/src/main/java/org/apache/wink/logging/WinkLoggerFactory.java (original)
+++ incubator/wink/trunk/wink-component-test-support/src/main/java/org/apache/wink/logging/WinkLoggerFactory.java Wed May 19 15:22:13 2010
@@ -1,46 +1,46 @@
-/*******************************************************************************
- * 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.wink.logging;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.slf4j.ILoggerFactory;
-import org.slf4j.Logger;
-
-public class WinkLoggerFactory implements ILoggerFactory {
-
- private Map<String, WinkLoggerAdapter> loggerMap;
-
- public WinkLoggerFactory() {
- loggerMap = new HashMap<String, WinkLoggerAdapter>();
- }
-
- public Logger getLogger(String name) {
- WinkLoggerAdapter utilslogger = (WinkLoggerAdapter) loggerMap.get(name);
- if (utilslogger == null) {
- java.util.logging.Logger logger = java.util.logging.Logger.getLogger(name);
- utilslogger = new WinkLoggerAdapter(logger);
- loggerMap.put(name, utilslogger);
- }
- return utilslogger;
- }
-}
+/*******************************************************************************
+ * 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.wink.logging;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.slf4j.ILoggerFactory;
+import org.slf4j.Logger;
+
+public class WinkLoggerFactory implements ILoggerFactory {
+
+ private Map<String, WinkLoggerAdapter> loggerMap;
+
+ public WinkLoggerFactory() {
+ loggerMap = new HashMap<String, WinkLoggerAdapter>();
+ }
+
+ public Logger getLogger(String name) {
+ WinkLoggerAdapter utilslogger = (WinkLoggerAdapter) loggerMap.get(name);
+ if (utilslogger == null) {
+ java.util.logging.Logger logger = java.util.logging.Logger.getLogger(name);
+ utilslogger = new WinkLoggerAdapter(logger);
+ loggerMap.put(name, utilslogger);
+ }
+ return utilslogger;
+ }
+}
Propchange: incubator/wink/trunk/wink-component-test-support/src/main/java/org/apache/wink/logging/WinkLoggerFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/wink/trunk/wink-component-test-support/src/main/java/org/slf4j/impl/StaticLoggerBinder.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-component-test-support/src/main/java/org/slf4j/impl/StaticLoggerBinder.java?rev=946218&r1=946217&r2=946218&view=diff
==============================================================================
--- incubator/wink/trunk/wink-component-test-support/src/main/java/org/slf4j/impl/StaticLoggerBinder.java (original)
+++ incubator/wink/trunk/wink-component-test-support/src/main/java/org/slf4j/impl/StaticLoggerBinder.java Wed May 19 15:22:13 2010
@@ -1,48 +1,48 @@
-/*******************************************************************************
- * 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.slf4j.impl;
-
-import org.apache.wink.logging.WinkLoggerFactory;
-import org.slf4j.ILoggerFactory;
-import org.slf4j.spi.LoggerFactoryBinder;
-
-public class StaticLoggerBinder implements LoggerFactoryBinder {
-
- private static final StaticLoggerBinder staticLoggerBinder = new StaticLoggerBinder();
-
- public static final StaticLoggerBinder getSingleton() {
- return staticLoggerBinder;
- }
-
- private final ILoggerFactory loggerFact;
-
- private StaticLoggerBinder() {
- loggerFact = new org.apache.wink.logging.WinkLoggerFactory();
- }
-
- public ILoggerFactory getLoggerFactory() {
- return loggerFact;
- }
-
- public String getLoggerFactoryClassStr() {
- return WinkLoggerFactory.class.getName();
- }
-}
+/*******************************************************************************
+ * 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.slf4j.impl;
+
+import org.apache.wink.logging.WinkLoggerFactory;
+import org.slf4j.ILoggerFactory;
+import org.slf4j.spi.LoggerFactoryBinder;
+
+public class StaticLoggerBinder implements LoggerFactoryBinder {
+
+ private static final StaticLoggerBinder staticLoggerBinder = new StaticLoggerBinder();
+
+ public static final StaticLoggerBinder getSingleton() {
+ return staticLoggerBinder;
+ }
+
+ private final ILoggerFactory loggerFact;
+
+ private StaticLoggerBinder() {
+ loggerFact = new org.apache.wink.logging.WinkLoggerFactory();
+ }
+
+ public ILoggerFactory getLoggerFactory() {
+ return loggerFact;
+ }
+
+ public String getLoggerFactoryClassStr() {
+ return WinkLoggerFactory.class.getName();
+ }
+}
Propchange: incubator/wink/trunk/wink-component-test-support/src/main/java/org/slf4j/impl/StaticLoggerBinder.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/wink/trunk/wink-component-test-support/src/main/resources/logging.properties
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/wink/trunk/wink-examples/apps/Bookmarks/build.properties
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/wink/trunk/wink-examples/apps/HelloWorld/build.properties
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/wink/trunk/wink-examples/apps/QADefect/build.properties
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/wink/trunk/wink-examples/apps/SimpleDefects/build.properties
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/wink/trunk/wink-examples/client/GoogleDocs-client/build.properties
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/wink/trunk/wink-examples/client/QADefects-client/build.properties
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/wink/trunk/wink-examples/client/ReadRSS-client/build.properties
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/wink/trunk/wink-examples/client/ReadRSS-client/src/main/java/org/apache/wink/example/ReadRssAsSyndFeed.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-examples/client/ReadRSS-client/src/main/java/org/apache/wink/example/ReadRssAsSyndFeed.java?rev=946218&r1=946217&r2=946218&view=diff
==============================================================================
--- incubator/wink/trunk/wink-examples/client/ReadRSS-client/src/main/java/org/apache/wink/example/ReadRssAsSyndFeed.java (original)
+++ incubator/wink/trunk/wink-examples/client/ReadRSS-client/src/main/java/org/apache/wink/example/ReadRssAsSyndFeed.java Wed May 19 15:22:13 2010
@@ -1,96 +1,96 @@
-/*******************************************************************************
- * 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.wink.example;
-
-import java.io.IOException;
-
-import javax.ws.rs.core.MediaType;
-import javax.xml.bind.JAXBElement;
-import javax.xml.bind.Marshaller;
-
-import org.apache.wink.client.Resource;
-import org.apache.wink.client.RestClient;
-import org.apache.wink.common.internal.model.ModelUtils;
-import org.apache.wink.common.model.atom.AtomFeed;
-import org.apache.wink.common.model.atom.ObjectFactory;
-import org.apache.wink.common.model.rss.RssFeed;
-import org.apache.wink.common.model.synd.SyndEntry;
-import org.apache.wink.common.model.synd.SyndFeed;
-
-/**
- * This is an example of reading an RSS Feed using SyndFeed APIs. (Mapping RSS
- * into Syndication Object Model)
- */
-public class ReadRssAsSyndFeed {
-
- public static void main(String[] args) {
- try {
- // create the rest client instance
- RestClient restClient = new RestClient();
-
- // create the resource instance to interact with
- String rss_url = "http://www.rssboard.org/files/rss-2.0-sample.xml";
- Resource feedResource = restClient.resource(rss_url);
-
- // perform a GET on the resource. The resource will be returned as an Rss object
- RssFeed rssFeed = feedResource.accept(MediaType.APPLICATION_XML).get(RssFeed.class);
-
- // Map RSS into SyndFeed
- SyndFeed syndFeed = new SyndFeed();
- syndFeed = rssFeed.toSynd(syndFeed);
-
- // Now access RSS using SyndFeed APIs
- if (syndFeed.getTitle() != null) {
- System.out.println("Title = " + syndFeed.getTitle().getValue());
- }
- if (syndFeed.getSubtitle() != null) {
- System.out.println("Descritpion = " + syndFeed.getSubtitle().getValue());
- }
- if (syndFeed.getLink("alternate") != null) {
- System.out.println("Link = " + syndFeed.getLink("alternate").getHref());
- }
- int itemCount = 0;
- for (SyndEntry syndEntry : syndFeed.getEntries()) {
- System.out.println("Item " + ++itemCount + ":");
- if (syndEntry.getTitle() != null) {
- System.out.println("\tTitle = " + syndEntry.getTitle().getValue());
- }
- if (syndEntry.getSummary() != null) {
- System.out.println("\tDescription = " + syndEntry.getSummary().getValue());
- }
- if (syndEntry.getLink("alternate") != null) {
- System.out.println("\tLink = " + syndEntry.getLink("alternate").getHref());
- }
- }
-
- System.out.println("\nComplete XML contents (mapped into SyndFeed / Atom format):");
- Marshaller m = AtomFeed.getMarshaller();
- JAXBElement<AtomFeed> element =
- (new ObjectFactory()).createFeed(new AtomFeed(syndFeed));
- try {
- ModelUtils.marshal(m, element, System.out);
- } catch (IOException e) {
- e.printStackTrace();
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-}
+/*******************************************************************************
+ * 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.wink.example;
+
+import java.io.IOException;
+
+import javax.ws.rs.core.MediaType;
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.Marshaller;
+
+import org.apache.wink.client.Resource;
+import org.apache.wink.client.RestClient;
+import org.apache.wink.common.internal.model.ModelUtils;
+import org.apache.wink.common.model.atom.AtomFeed;
+import org.apache.wink.common.model.atom.ObjectFactory;
+import org.apache.wink.common.model.rss.RssFeed;
+import org.apache.wink.common.model.synd.SyndEntry;
+import org.apache.wink.common.model.synd.SyndFeed;
+
+/**
+ * This is an example of reading an RSS Feed using SyndFeed APIs. (Mapping RSS
+ * into Syndication Object Model)
+ */
+public class ReadRssAsSyndFeed {
+
+ public static void main(String[] args) {
+ try {
+ // create the rest client instance
+ RestClient restClient = new RestClient();
+
+ // create the resource instance to interact with
+ String rss_url = "http://www.rssboard.org/files/rss-2.0-sample.xml";
+ Resource feedResource = restClient.resource(rss_url);
+
+ // perform a GET on the resource. The resource will be returned as an Rss object
+ RssFeed rssFeed = feedResource.accept(MediaType.APPLICATION_XML).get(RssFeed.class);
+
+ // Map RSS into SyndFeed
+ SyndFeed syndFeed = new SyndFeed();
+ syndFeed = rssFeed.toSynd(syndFeed);
+
+ // Now access RSS using SyndFeed APIs
+ if (syndFeed.getTitle() != null) {
+ System.out.println("Title = " + syndFeed.getTitle().getValue());
+ }
+ if (syndFeed.getSubtitle() != null) {
+ System.out.println("Descritpion = " + syndFeed.getSubtitle().getValue());
+ }
+ if (syndFeed.getLink("alternate") != null) {
+ System.out.println("Link = " + syndFeed.getLink("alternate").getHref());
+ }
+ int itemCount = 0;
+ for (SyndEntry syndEntry : syndFeed.getEntries()) {
+ System.out.println("Item " + ++itemCount + ":");
+ if (syndEntry.getTitle() != null) {
+ System.out.println("\tTitle = " + syndEntry.getTitle().getValue());
+ }
+ if (syndEntry.getSummary() != null) {
+ System.out.println("\tDescription = " + syndEntry.getSummary().getValue());
+ }
+ if (syndEntry.getLink("alternate") != null) {
+ System.out.println("\tLink = " + syndEntry.getLink("alternate").getHref());
+ }
+ }
+
+ System.out.println("\nComplete XML contents (mapped into SyndFeed / Atom format):");
+ Marshaller m = AtomFeed.getMarshaller();
+ JAXBElement<AtomFeed> element =
+ (new ObjectFactory()).createFeed(new AtomFeed(syndFeed));
+ try {
+ ModelUtils.marshal(m, element, System.out);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+}
Propchange: incubator/wink/trunk/wink-examples/client/ReadRSS-client/src/main/java/org/apache/wink/example/ReadRssAsSyndFeed.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/wink/trunk/wink-examples/core/CustomContext/build.properties
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/wink/trunk/wink-examples/core/CustomExceptionMapper/build.properties
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/wink/trunk/wink-examples/core/Jaxb/build.properties
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/wink/trunk/wink-examples/core/Jaxb/src/test/java/org/apache/wink/example/jaxb/FormattingOptionsContextResolver.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-examples/core/Jaxb/src/test/java/org/apache/wink/example/jaxb/FormattingOptionsContextResolver.java?rev=946218&r1=946217&r2=946218&view=diff
==============================================================================
--- incubator/wink/trunk/wink-examples/core/Jaxb/src/test/java/org/apache/wink/example/jaxb/FormattingOptionsContextResolver.java (original)
+++ incubator/wink/trunk/wink-examples/core/Jaxb/src/test/java/org/apache/wink/example/jaxb/FormattingOptionsContextResolver.java Wed May 19 15:22:13 2010
@@ -1,21 +1,21 @@
-/*******************************************************************************
- * 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.
+ *******************************************************************************/
package org.apache.wink.example.jaxb;
import javax.ws.rs.ext.ContextResolver;
Propchange: incubator/wink/trunk/wink-examples/core/Jaxb/src/test/java/org/apache/wink/example/jaxb/FormattingOptionsContextResolver.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/wink/trunk/wink-examples/core/Preconditions/build.properties
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/wink/trunk/wink-examples/core/Preconditions/src/test/java/org/apache/wink/example/locking/FormattingOptionsContextResolver.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-examples/core/Preconditions/src/test/java/org/apache/wink/example/locking/FormattingOptionsContextResolver.java?rev=946218&r1=946217&r2=946218&view=diff
==============================================================================
--- incubator/wink/trunk/wink-examples/core/Preconditions/src/test/java/org/apache/wink/example/locking/FormattingOptionsContextResolver.java (original)
+++ incubator/wink/trunk/wink-examples/core/Preconditions/src/test/java/org/apache/wink/example/locking/FormattingOptionsContextResolver.java Wed May 19 15:22:13 2010
@@ -1,21 +1,21 @@
-/*******************************************************************************
- * 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.
+ *******************************************************************************/
package org.apache.wink.example.locking;
import javax.ws.rs.ext.ContextResolver;
Propchange: incubator/wink/trunk/wink-examples/core/Preconditions/src/test/java/org/apache/wink/example/locking/FormattingOptionsContextResolver.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/wink/trunk/wink-examples/ext/Asset/build.properties
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/wink/trunk/wink-examples/ext/DynamicResource/build.properties
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/wink/trunk/wink-examples/ext/History/build.properties
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/wink/trunk/wink-examples/ext/LinkBuilders/build.properties
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/wink/trunk/wink-examples/ext/MultiPart/build.properties
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/wink/trunk/wink-examples/ext/RuntimeRegistration/build.properties
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/wink/trunk/wink-examples/ext/Scope/build.properties
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/wink/trunk/wink-examples/ext/Spring/build.properties
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/wink/trunk/wink-examples/ext/WebDAV/build.properties
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-client-timeout/pom.xml
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-client-timeout/pom.xml?rev=946218&r1=946217&r2=946218&view=diff
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-client-timeout/pom.xml (original)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-client-timeout/pom.xml Wed May 19 15:22:13 2010
@@ -1,99 +1,99 @@
-<?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.
- -->
-
-<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/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <artifactId>wink-itest</artifactId>
- <groupId>org.apache.wink</groupId>
- <version>1.1-incubating-SNAPSHOT</version>
- </parent>
- <groupId>org.apache.wink</groupId>
- <artifactId>wink-itest-client-timeout</artifactId>
- <packaging>war</packaging>
- <name>Apache Wink client Timeout System Property Tests</name>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <skip>true</skip>
- </configuration>
- <executions>
- <execution>
- <id>test</id>
- <phase>test</phase>
- <goals>
- <goal>test</goal>
- </goals>
- <configuration>
- <skip>true</skip>
- </configuration>
- </execution>
- <execution>
- <id>integration</id>
- <phase>integration-test</phase>
- <goals>
- <goal>test</goal>
- </goals>
- <configuration>
- <skip>false</skip>
- <systemProperties>
- <property>
- <name>wink-test-context-root</name>
- <value>${artifactId}</value>
- </property>
- <property>
- <name>wink-test-hostname</name>
- <value>${wink.server.hostname}</value>
- </property>
- <property>
- <name>wink-test-port</name>
- <value>${wink.server.port}</value>
- </property>
- <property>
- <name>wink-test-work-dir</name>
- <value>${project.build.directory}</value>
- </property>
- <property>
- <name>wink-test-container</name>
- <value>${assemblyId}</value>
- </property>
- <property>
- <name>wink-rest-filter-used</name>
- <value>${wink.rest.filter.used}</value>
- </property>
- <property>
- <name>wink.client.readTimeout</name>
- <value>10000</value>
- </property>
- <property>
- <name>wink.client.connectTimeout</name>
- <value>10000</value>
- </property>
- </systemProperties>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-</project>
+<?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.
+ -->
+
+<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/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>wink-itest</artifactId>
+ <groupId>org.apache.wink</groupId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ </parent>
+ <groupId>org.apache.wink</groupId>
+ <artifactId>wink-itest-client-timeout</artifactId>
+ <packaging>war</packaging>
+ <name>Apache Wink client Timeout System Property Tests</name>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ <executions>
+ <execution>
+ <id>test</id>
+ <phase>test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </execution>
+ <execution>
+ <id>integration</id>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <skip>false</skip>
+ <systemProperties>
+ <property>
+ <name>wink-test-context-root</name>
+ <value>${artifactId}</value>
+ </property>
+ <property>
+ <name>wink-test-hostname</name>
+ <value>${wink.server.hostname}</value>
+ </property>
+ <property>
+ <name>wink-test-port</name>
+ <value>${wink.server.port}</value>
+ </property>
+ <property>
+ <name>wink-test-work-dir</name>
+ <value>${project.build.directory}</value>
+ </property>
+ <property>
+ <name>wink-test-container</name>
+ <value>${assemblyId}</value>
+ </property>
+ <property>
+ <name>wink-rest-filter-used</name>
+ <value>${wink.rest.filter.used}</value>
+ </property>
+ <property>
+ <name>wink.client.readTimeout</name>
+ <value>10000</value>
+ </property>
+ <property>
+ <name>wink.client.connectTimeout</name>
+ <value>10000</value>
+ </property>
+ </systemProperties>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Propchange: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-client-timeout/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-client-timeout/src/main/java/org/apache/wink/itest/client/timeout/TimeoutApplication.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-client-timeout/src/main/java/org/apache/wink/itest/client/timeout/TimeoutApplication.java?rev=946218&r1=946217&r2=946218&view=diff
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-client-timeout/src/main/java/org/apache/wink/itest/client/timeout/TimeoutApplication.java (original)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-client-timeout/src/main/java/org/apache/wink/itest/client/timeout/TimeoutApplication.java Wed May 19 15:22:13 2010
@@ -1,36 +1,36 @@
-/*
- * 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.wink.itest.client.timeout;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import javax.ws.rs.core.Application;
-
-public class TimeoutApplication extends Application {
-
- @Override
- public Set<Class<?>> getClasses() {
- Set<Class<?>> classes = new HashSet<Class<?>>();
- classes.add(TimeoutResource.class);
- return classes;
- }
-
-}
+/*
+ * 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.wink.itest.client.timeout;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.ws.rs.core.Application;
+
+public class TimeoutApplication extends Application {
+
+ @Override
+ public Set<Class<?>> getClasses() {
+ Set<Class<?>> classes = new HashSet<Class<?>>();
+ classes.add(TimeoutResource.class);
+ return classes;
+ }
+
+}
Propchange: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-client-timeout/src/main/java/org/apache/wink/itest/client/timeout/TimeoutApplication.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-client-timeout/src/main/java/org/apache/wink/itest/client/timeout/TimeoutResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-client-timeout/src/main/java/org/apache/wink/itest/client/timeout/TimeoutResource.java?rev=946218&r1=946217&r2=946218&view=diff
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-client-timeout/src/main/java/org/apache/wink/itest/client/timeout/TimeoutResource.java (original)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-client-timeout/src/main/java/org/apache/wink/itest/client/timeout/TimeoutResource.java Wed May 19 15:22:13 2010
@@ -1,36 +1,36 @@
-/*
- * 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.wink.itest.client.timeout;
-
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.QueryParam;
-
-@Path("timeout")
-public class TimeoutResource {
-
- @GET
- public String timeout(@QueryParam("timeout") long timeout) {
- try {
- Thread.sleep(timeout);
- } catch(Exception e) {}
- return "request processed";
- }
-}
+/*
+ * 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.wink.itest.client.timeout;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.QueryParam;
+
+@Path("timeout")
+public class TimeoutResource {
+
+ @GET
+ public String timeout(@QueryParam("timeout") long timeout) {
+ try {
+ Thread.sleep(timeout);
+ } catch(Exception e) {}
+ return "request processed";
+ }
+}
Propchange: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-client-timeout/src/main/java/org/apache/wink/itest/client/timeout/TimeoutResource.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-client-timeout/src/main/webapp/WEB-INF/geronimo-web.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-client-timeout/src/main/webapp/WEB-INF/web.filter.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-client-timeout/src/main/webapp/WEB-INF/web.servlet.xml
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-client-timeout/src/test/java/org/apache/wink/itest/client/timeout/TimeoutApacheHTTPTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-client-timeout/src/test/java/org/apache/wink/itest/client/timeout/TimeoutApacheHTTPTest.java?rev=946218&r1=946217&r2=946218&view=diff
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-client-timeout/src/test/java/org/apache/wink/itest/client/timeout/TimeoutApacheHTTPTest.java (original)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-client-timeout/src/test/java/org/apache/wink/itest/client/timeout/TimeoutApacheHTTPTest.java Wed May 19 15:22:13 2010
@@ -1,46 +1,46 @@
-/*
- * 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.wink.itest.client.timeout;
-
-import org.apache.wink.client.ApacheHttpClientConfig;
-import org.apache.wink.client.RestClient;
-
-public class TimeoutApacheHTTPTest extends TimeoutTest {
-
- @Override
- public RestClient getConnectTimeoutClient() {
- ApacheHttpClientConfig config = new ApacheHttpClientConfig();
- config.connectTimeout(20000);
- return new RestClient(config);
- }
-
- @Override
- public RestClient getDefaultClient() {
- return new RestClient(new ApacheHttpClientConfig());
- }
-
- @Override
- public RestClient getReadTimeoutClient() {
- ApacheHttpClientConfig config = new ApacheHttpClientConfig();
- config.readTimeout(20000);
- return new RestClient(config);
- }
-
-}
+/*
+ * 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.wink.itest.client.timeout;
+
+import org.apache.wink.client.ApacheHttpClientConfig;
+import org.apache.wink.client.RestClient;
+
+public class TimeoutApacheHTTPTest extends TimeoutTest {
+
+ @Override
+ public RestClient getConnectTimeoutClient() {
+ ApacheHttpClientConfig config = new ApacheHttpClientConfig();
+ config.connectTimeout(20000);
+ return new RestClient(config);
+ }
+
+ @Override
+ public RestClient getDefaultClient() {
+ return new RestClient(new ApacheHttpClientConfig());
+ }
+
+ @Override
+ public RestClient getReadTimeoutClient() {
+ ApacheHttpClientConfig config = new ApacheHttpClientConfig();
+ config.readTimeout(20000);
+ return new RestClient(config);
+ }
+
+}
Propchange: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-client-timeout/src/test/java/org/apache/wink/itest/client/timeout/TimeoutApacheHTTPTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-client-timeout/src/test/java/org/apache/wink/itest/client/timeout/TimeoutTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-client-timeout/src/test/java/org/apache/wink/itest/client/timeout/TimeoutTest.java?rev=946218&r1=946217&r2=946218&view=diff
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-client-timeout/src/test/java/org/apache/wink/itest/client/timeout/TimeoutTest.java (original)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-client-timeout/src/test/java/org/apache/wink/itest/client/timeout/TimeoutTest.java Wed May 19 15:22:13 2010
@@ -1,109 +1,109 @@
-/*
- * 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.wink.itest.client.timeout;
-
-import junit.framework.TestCase;
-
-import org.apache.wink.client.ClientConfig;
-import org.apache.wink.client.ClientResponse;
-import org.apache.wink.client.ClientRuntimeException;
-import org.apache.wink.client.Resource;
-import org.apache.wink.client.RestClient;
-import org.apache.wink.test.integration.ServerEnvironmentInfo;
-
-public class TimeoutTest extends TestCase {
-
- public static String getBaseURI() {
- return ServerEnvironmentInfo.getBaseURI() + "/timeout";
- }
-
- /**
- * Test that the wink.client.readTimeout property value of 10000 is read
- */
- public void testReadTimeoutValue() {
- assertEquals(10000, getDefaultClient().getConfig().getReadTimeout());
- }
-
- /**
- * Test that the wink.client.connectTimeout property value of 10000 is read
- */
- public void testConnectTimeoutValue() {
- assertEquals(10000, getDefaultClient().getConfig().getConnectTimeout());
- }
-
- /**
- * Test that the system property for the read timeout can be overwritten
- * programatically
- */
- public void testOverrideReadTimeout() {
- assertEquals(20000, getReadTimeoutClient().getConfig().getReadTimeout());
- }
-
- /**
- * Test that the system property for the connect timeout can be overwritten
- * programmatically
- */
- public void testOverrideConnectTimeout() {
- assertEquals(20000, getConnectTimeoutClient().getConfig().getConnectTimeout());
- }
-
- /**
- * Test that a request is processed if it takes less time than the timeout
- * value
- */
- public void testReadTimeoutNoTimeout() {
- RestClient client = getDefaultClient();
- Resource resource = client.resource(getBaseURI() + "?timeout=5000");
- ClientResponse response = resource.get();
- assertEquals(200, response.getStatusCode());
- assertEquals("request processed", response.getEntity(String.class));
- }
-
- /**
- * Test that the client times out if the request is not processed in less
- * than the readTimeout value
- */
- public void testReadTimeoutTimeout() {
- RestClient client = getDefaultClient();
- Resource resource = client.resource(getBaseURI() + "?timeout=30000");
- try {
- resource.get();
- fail("The client did not timeout after waiting more than 20000 milliseconds for the request.");
- } catch (ClientRuntimeException e) {
- assertTrue(e.getMessage().indexOf("SocketTimeoutException") != -1);
- }
- }
-
- public RestClient getDefaultClient() {
- return new RestClient();
- }
-
- public RestClient getReadTimeoutClient() {
- ClientConfig config = new ClientConfig();
- config.readTimeout(20000);
- return new RestClient(config);
- }
-
- public RestClient getConnectTimeoutClient() {
- ClientConfig config = new ClientConfig();
- config.connectTimeout(20000);
- return new RestClient(config);
- }
-}
+/*
+ * 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.wink.itest.client.timeout;
+
+import junit.framework.TestCase;
+
+import org.apache.wink.client.ClientConfig;
+import org.apache.wink.client.ClientResponse;
+import org.apache.wink.client.ClientRuntimeException;
+import org.apache.wink.client.Resource;
+import org.apache.wink.client.RestClient;
+import org.apache.wink.test.integration.ServerEnvironmentInfo;
+
+public class TimeoutTest extends TestCase {
+
+ public static String getBaseURI() {
+ return ServerEnvironmentInfo.getBaseURI() + "/timeout";
+ }
+
+ /**
+ * Test that the wink.client.readTimeout property value of 10000 is read
+ */
+ public void testReadTimeoutValue() {
+ assertEquals(10000, getDefaultClient().getConfig().getReadTimeout());
+ }
+
+ /**
+ * Test that the wink.client.connectTimeout property value of 10000 is read
+ */
+ public void testConnectTimeoutValue() {
+ assertEquals(10000, getDefaultClient().getConfig().getConnectTimeout());
+ }
+
+ /**
+ * Test that the system property for the read timeout can be overwritten
+ * programatically
+ */
+ public void testOverrideReadTimeout() {
+ assertEquals(20000, getReadTimeoutClient().getConfig().getReadTimeout());
+ }
+
+ /**
+ * Test that the system property for the connect timeout can be overwritten
+ * programmatically
+ */
+ public void testOverrideConnectTimeout() {
+ assertEquals(20000, getConnectTimeoutClient().getConfig().getConnectTimeout());
+ }
+
+ /**
+ * Test that a request is processed if it takes less time than the timeout
+ * value
+ */
+ public void testReadTimeoutNoTimeout() {
+ RestClient client = getDefaultClient();
+ Resource resource = client.resource(getBaseURI() + "?timeout=5000");
+ ClientResponse response = resource.get();
+ assertEquals(200, response.getStatusCode());
+ assertEquals("request processed", response.getEntity(String.class));
+ }
+
+ /**
+ * Test that the client times out if the request is not processed in less
+ * than the readTimeout value
+ */
+ public void testReadTimeoutTimeout() {
+ RestClient client = getDefaultClient();
+ Resource resource = client.resource(getBaseURI() + "?timeout=30000");
+ try {
+ resource.get();
+ fail("The client did not timeout after waiting more than 20000 milliseconds for the request.");
+ } catch (ClientRuntimeException e) {
+ assertTrue(e.getMessage().indexOf("SocketTimeoutException") != -1);
+ }
+ }
+
+ public RestClient getDefaultClient() {
+ return new RestClient();
+ }
+
+ public RestClient getReadTimeoutClient() {
+ ClientConfig config = new ClientConfig();
+ config.readTimeout(20000);
+ return new RestClient(config);
+ }
+
+ public RestClient getConnectTimeoutClient() {
+ ClientConfig config = new ClientConfig();
+ config.connectTimeout(20000);
+ return new RestClient(config);
+ }
+}
Propchange: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-client-timeout/src/test/java/org/apache/wink/itest/client/timeout/TimeoutTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-extra-providers/src/main/java/org/apache/wink/jaxrs/test/jaxb/JAXBResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-extra-providers/src/main/java/org/apache/wink/jaxrs/test/jaxb/JAXBResource.java?rev=946218&r1=946217&r2=946218&view=diff
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-extra-providers/src/main/java/org/apache/wink/jaxrs/test/jaxb/JAXBResource.java (original)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-extra-providers/src/main/java/org/apache/wink/jaxrs/test/jaxb/JAXBResource.java Wed May 19 15:22:13 2010
@@ -1,180 +1,180 @@
-/*******************************************************************************
- * 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.wink.jaxrs.test.jaxb;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.GenericEntity;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import javax.xml.bind.JAXBElement;
-import javax.xml.namespace.QName;
-
-import org.apache.wink.jaxrs.test.jaxb.book.Author;
-import org.apache.wink.jaxrs.test.jaxb.book.Book;
-import org.apache.wink.jaxrs.test.jaxb.person.Person;
-
-@Path("jaxbresource")
-public class JAXBResource {
-
- @Path("booklist")
- @Produces(MediaType.APPLICATION_XML)
- @Consumes(MediaType.APPLICATION_XML)
- @POST
- public List<Book> echoBookList(List<Book> books) {
- List<Book> ret = new ArrayList<Book>();
- Author author = null;
- Author retAuthor = null;
- Book retBook = null;
- for(Book book : books) {
- author = book.getAuthor();
- retAuthor = new Author();
- retAuthor.setFirstName("echo " + author.getFirstName());
- retAuthor.setLastName("echo " + author.getLastName());
- retBook = new Book();
- retBook.setAuthor(retAuthor);
- retBook.setTitle("echo " + book.getTitle());
- ret.add(retBook);
- }
- return ret;
- }
-
- @Path("bookarray")
- @Produces(MediaType.APPLICATION_XML)
- @Consumes(MediaType.APPLICATION_XML)
- @POST
- public Book[] echoBookArray(Book[] books) {
- Book[] ret = new Book[books.length];
- Author author = null;
- Author retAuthor = null;
- Book retBook = null;
- int i = 0;
- for(Book book : books) {
- author = book.getAuthor();
- retAuthor = new Author();
- retAuthor.setFirstName("echo " + author.getFirstName());
- retAuthor.setLastName("echo " + author.getLastName());
- retBook = new Book();
- retBook.setAuthor(retAuthor);
- retBook.setTitle("echo " + book.getTitle());
- ret[i++] = retBook;
- }
- return ret;
- }
-
- @Path("booklistresponse")
- @Produces(MediaType.APPLICATION_XML)
- @Consumes(MediaType.APPLICATION_XML)
- @POST
- public Response echoBookListResponse(List<Book> books) {
- List<Book> ret = echoBookList(books);
- Response response = Response.ok(new GenericEntity<List<Book>>(ret){}, MediaType.APPLICATION_XML).build();
- return response;
- }
-
- @Path("booklistjaxbelement")
- @Produces(MediaType.APPLICATION_XML)
- @Consumes(MediaType.APPLICATION_XML)
- @POST
- public List<JAXBElement<Book>> echoJAXBElementBookList(List<JAXBElement<Book>> bookElements) {
- List<JAXBElement<Book>> ret = new ArrayList<JAXBElement<Book>>();
- Author author = null;
- Author retAuthor = null;
- Book retBook = null;
- for(JAXBElement<Book> bookElement : bookElements) {
- author = bookElement.getValue().getAuthor();
- retAuthor = new Author();
- retAuthor.setFirstName("echo " + author.getFirstName());
- retAuthor.setLastName("echo " + author.getLastName());
- retBook = new Book();
- retBook.setAuthor(retAuthor);
- retBook.setTitle("echo " + bookElement.getValue().getTitle());
- JAXBElement<Book> element = new JAXBElement<Book>(new QName("book"), Book.class, retBook);
- ret.add(element);
- }
- return ret;
- }
-
- @Path("personlist")
- @Produces(MediaType.APPLICATION_XML)
- @Consumes(MediaType.APPLICATION_XML)
- @POST
- public List<Person> echoPersonList(List<Person> people) {
- List<Person> ret = new ArrayList<Person>();
- Person retPerson = null;
- for(Person person : people) {
- retPerson = new Person();
- retPerson.setName("echo " + person.getName());
- retPerson.setDesc("echo " + person.getDesc());
- ret.add(retPerson);
- }
- return ret;
- }
-
- @Path("personlistresponse")
- @Produces(MediaType.APPLICATION_XML)
- @Consumes(MediaType.APPLICATION_XML)
- @POST
- public Response echoPersonListResponse(List<Person> people) {
- List<Person> ret = echoPersonList(people);
- Response response = Response.ok(new GenericEntity<List<Person>>(ret){}, MediaType.APPLICATION_XML).build();
- return response;
- }
-
- @Path("personarray")
- @Produces(MediaType.APPLICATION_XML)
- @Consumes(MediaType.APPLICATION_XML)
- @POST
- public Person[] echoPersonArray(Person[] people) {
- Person[] ret = new Person[people.length];
- Person retPerson = null;
- int i = 0;
- for(Person person : people) {
- retPerson = new Person();
- retPerson.setName("echo " + person.getName());
- retPerson.setDesc("echo " + person.getDesc());
- ret[i++] = retPerson;
- }
- return ret;
- }
-
- @Path("personlistjaxbelement")
- @Produces(MediaType.APPLICATION_XML)
- @Consumes(MediaType.APPLICATION_XML)
- @POST
- public List<JAXBElement<Person>> echoPersonJAXBElementList(List<JAXBElement<Person>> peopleElements) {
- List<JAXBElement<Person>> ret = new ArrayList<JAXBElement<Person>>();
- Person retPerson = null;
- for(JAXBElement<Person> personElement : peopleElements) {
- retPerson = new Person();
- retPerson.setName("echo " + personElement.getValue().getName());
- retPerson.setDesc("echo " + personElement.getValue().getDesc());
- JAXBElement<Person> element = new JAXBElement<Person>(new QName("person"), Person.class, retPerson);
- ret.add(element);
- }
- return ret;
- }
-}
+/*******************************************************************************
+ * 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.wink.jaxrs.test.jaxb;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.GenericEntity;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.xml.bind.JAXBElement;
+import javax.xml.namespace.QName;
+
+import org.apache.wink.jaxrs.test.jaxb.book.Author;
+import org.apache.wink.jaxrs.test.jaxb.book.Book;
+import org.apache.wink.jaxrs.test.jaxb.person.Person;
+
+@Path("jaxbresource")
+public class JAXBResource {
+
+ @Path("booklist")
+ @Produces(MediaType.APPLICATION_XML)
+ @Consumes(MediaType.APPLICATION_XML)
+ @POST
+ public List<Book> echoBookList(List<Book> books) {
+ List<Book> ret = new ArrayList<Book>();
+ Author author = null;
+ Author retAuthor = null;
+ Book retBook = null;
+ for(Book book : books) {
+ author = book.getAuthor();
+ retAuthor = new Author();
+ retAuthor.setFirstName("echo " + author.getFirstName());
+ retAuthor.setLastName("echo " + author.getLastName());
+ retBook = new Book();
+ retBook.setAuthor(retAuthor);
+ retBook.setTitle("echo " + book.getTitle());
+ ret.add(retBook);
+ }
+ return ret;
+ }
+
+ @Path("bookarray")
+ @Produces(MediaType.APPLICATION_XML)
+ @Consumes(MediaType.APPLICATION_XML)
+ @POST
+ public Book[] echoBookArray(Book[] books) {
+ Book[] ret = new Book[books.length];
+ Author author = null;
+ Author retAuthor = null;
+ Book retBook = null;
+ int i = 0;
+ for(Book book : books) {
+ author = book.getAuthor();
+ retAuthor = new Author();
+ retAuthor.setFirstName("echo " + author.getFirstName());
+ retAuthor.setLastName("echo " + author.getLastName());
+ retBook = new Book();
+ retBook.setAuthor(retAuthor);
+ retBook.setTitle("echo " + book.getTitle());
+ ret[i++] = retBook;
+ }
+ return ret;
+ }
+
+ @Path("booklistresponse")
+ @Produces(MediaType.APPLICATION_XML)
+ @Consumes(MediaType.APPLICATION_XML)
+ @POST
+ public Response echoBookListResponse(List<Book> books) {
+ List<Book> ret = echoBookList(books);
+ Response response = Response.ok(new GenericEntity<List<Book>>(ret){}, MediaType.APPLICATION_XML).build();
+ return response;
+ }
+
+ @Path("booklistjaxbelement")
+ @Produces(MediaType.APPLICATION_XML)
+ @Consumes(MediaType.APPLICATION_XML)
+ @POST
+ public List<JAXBElement<Book>> echoJAXBElementBookList(List<JAXBElement<Book>> bookElements) {
+ List<JAXBElement<Book>> ret = new ArrayList<JAXBElement<Book>>();
+ Author author = null;
+ Author retAuthor = null;
+ Book retBook = null;
+ for(JAXBElement<Book> bookElement : bookElements) {
+ author = bookElement.getValue().getAuthor();
+ retAuthor = new Author();
+ retAuthor.setFirstName("echo " + author.getFirstName());
+ retAuthor.setLastName("echo " + author.getLastName());
+ retBook = new Book();
+ retBook.setAuthor(retAuthor);
+ retBook.setTitle("echo " + bookElement.getValue().getTitle());
+ JAXBElement<Book> element = new JAXBElement<Book>(new QName("book"), Book.class, retBook);
+ ret.add(element);
+ }
+ return ret;
+ }
+
+ @Path("personlist")
+ @Produces(MediaType.APPLICATION_XML)
+ @Consumes(MediaType.APPLICATION_XML)
+ @POST
+ public List<Person> echoPersonList(List<Person> people) {
+ List<Person> ret = new ArrayList<Person>();
+ Person retPerson = null;
+ for(Person person : people) {
+ retPerson = new Person();
+ retPerson.setName("echo " + person.getName());
+ retPerson.setDesc("echo " + person.getDesc());
+ ret.add(retPerson);
+ }
+ return ret;
+ }
+
+ @Path("personlistresponse")
+ @Produces(MediaType.APPLICATION_XML)
+ @Consumes(MediaType.APPLICATION_XML)
+ @POST
+ public Response echoPersonListResponse(List<Person> people) {
+ List<Person> ret = echoPersonList(people);
+ Response response = Response.ok(new GenericEntity<List<Person>>(ret){}, MediaType.APPLICATION_XML).build();
+ return response;
+ }
+
+ @Path("personarray")
+ @Produces(MediaType.APPLICATION_XML)
+ @Consumes(MediaType.APPLICATION_XML)
+ @POST
+ public Person[] echoPersonArray(Person[] people) {
+ Person[] ret = new Person[people.length];
+ Person retPerson = null;
+ int i = 0;
+ for(Person person : people) {
+ retPerson = new Person();
+ retPerson.setName("echo " + person.getName());
+ retPerson.setDesc("echo " + person.getDesc());
+ ret[i++] = retPerson;
+ }
+ return ret;
+ }
+
+ @Path("personlistjaxbelement")
+ @Produces(MediaType.APPLICATION_XML)
+ @Consumes(MediaType.APPLICATION_XML)
+ @POST
+ public List<JAXBElement<Person>> echoPersonJAXBElementList(List<JAXBElement<Person>> peopleElements) {
+ List<JAXBElement<Person>> ret = new ArrayList<JAXBElement<Person>>();
+ Person retPerson = null;
+ for(JAXBElement<Person> personElement : peopleElements) {
+ retPerson = new Person();
+ retPerson.setName("echo " + personElement.getValue().getName());
+ retPerson.setDesc("echo " + personElement.getValue().getDesc());
+ JAXBElement<Person> element = new JAXBElement<Person>(new QName("person"), Person.class, retPerson);
+ ret.add(element);
+ }
+ return ret;
+ }
+}
Propchange: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-extra-providers/src/main/java/org/apache/wink/jaxrs/test/jaxb/JAXBResource.java
------------------------------------------------------------------------------
svn:eol-style = native