解決方案是在您的GWT項目中創建javax.ws.rs.core包,併爲您自己包含接口。這些接口MultivaluedMap:
package javax.ws.rs.core;
import java.util.List;
import java.util.Map;
/**
* A map of key-values pairs. Each key can have zero or more values.
*
*/
public interface MultivaluedMap<K, V> extends Map<K, List<V>> {
/**
* Set the key's value to be a one item list consisting of the supplied value.
* Any existing values will be replaced.
*
* @param key the key
* @param value the single value of the key
*/
void putSingle(K key, V value);
/**
* Add a value to the current list of values for the supplied key.
* @param key the key
* @param value the value to be added.
*/
void add(K key, V value);
/**
* A shortcut to get the first value of the supplied key.
* @param key the key
* @return the first value for the specified key or null if the key is
* not in the map.
*/
V getFirst(K key);
}
PathSegment:
package javax.ws.rs.core;
/**
* Represents a URI path segment and any associated matrix parameters. When an
* instance of this type is injected with {@link javax.ws.rs.PathParam}, the
* value of the annotation identifies which path segment is selected and the
* presence of an {@link javax.ws.rs.Encoded} annotation will result in an
* instance that supplies the path and matrix parameter values in
* URI encoded form.
*
* @see UriInfo#getPathSegments
* @see javax.ws.rs.PathParam
*/
public interface PathSegment
{
/**
* Get the path segment.
* <p/>
*
* @return the path segment
*/
String getPath();
/**
* Get a map of the matrix parameters associated with the path segment.
* The map keys are the names of the matrix parameters with any
* percent-escaped octets decoded.
*
* @return the map of matrix parameters
* @see <a href="http://www.w3.org/DesignIssues/MatrixURIs.html">Matrix URIs</a>
*/
MultivaluedMap<String, String> getMatrixParameters();
}
你需要一個GWT模塊文件(在javax.ws.rs包):
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 1.6//EN"
"http://google-web-toolkit.googlecode.com/svn/releases/1.6/distro-source/core/src/gwt-module.dtd">
<module rename-to="App">
<source path="core"/>
</module>
你」您需要爲您的應用程序GWT模塊添加一個繼承引用:
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 1.6//EN"
"http://google-web-toolkit.googlecode.com/svn/releases/1.6/distro-source/core/src/gwt-module.dtd">
<module rename-to="App">
<inherits name='com.google.gwt.user.User'/>
<inherits name="org.jboss.errai.common.ErraiCommon"/>
<inherits name="org.jboss.errai.ioc.Container"/>
<inherits name="org.jboss.errai.enterprise.Jaxrs"/>
<inherits name="com.redhat.topicindex.rest"/>
<inherits name="javax.ws.rs.core"/>
</module>