Errai 3.0.1-SNAPSHOT

org.jboss.errai.enterprise.client.jaxrs
Class AbstractJaxrsProxy

java.lang.Object
  extended by org.jboss.errai.enterprise.client.jaxrs.AbstractJaxrsProxy
All Implemented Interfaces:
RpcStub

public abstract class AbstractJaxrsProxy
extends Object
implements RpcStub

JAX-RS proxies are RpcStubs managed by the shared RemoteServiceProxyFactory. The implementations of this class are generated at compile time.

Author:
Christian Sadilek

Constructor Summary
AbstractJaxrsProxy()
           
 
Method Summary
 String getBaseUrl()
          If not set explicitly, the base URL is the configured default application root path RestClient.
abstract  ErrorCallback<?> getErrorCallback()
          Returns the error callback used by this proxy.
 ClientExceptionMapper getExceptionMapper()
           
abstract  RemoteCallback<?> getRemoteCallback()
          Returns the remote callback used by this proxy.
 List<Integer> getSuccessCodes()
          Returns the list of success codes used by this proxy.
protected  void handleError(Throwable throwable, com.google.gwt.http.client.Request request, com.google.gwt.http.client.Response response)
           
 boolean hasExceptionMapper()
           
protected  void sendRequest(com.google.gwt.http.client.RequestBuilder requestBuilder, String body, ResponseDemarshallingCallback demarshallingCallback)
           
 void setBaseUrl(String baseUrl)
          Sets the base URL of the remote service and overrides the configured default application root path.
 void setBatch(RpcBatch batch)
           
 void setExceptionMapper(ClientExceptionMapper exceptionMapper)
           
 void setQualifiers(Annotation[] annos)
           
 void setSuccessCodes(List<Integer> successCodes)
          Sets a list of HTTP status codes that will be used to determine whether a request was successful or not.
protected  Throwable unmarshallException(com.google.gwt.http.client.Response response)
          Uses the configured ClientExceptionMapper to unmarshal the Response into a Throwable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jboss.errai.common.client.framework.RpcStub
setErrorCallback, setRemoteCallback
 

Constructor Detail

AbstractJaxrsProxy

public AbstractJaxrsProxy()
Method Detail

getRemoteCallback

public abstract RemoteCallback<?> getRemoteCallback()
Returns the remote callback used by this proxy.

Returns:
the remote callback, never null.

getErrorCallback

public abstract ErrorCallback<?> getErrorCallback()
Returns the error callback used by this proxy.

Returns:
the error callback, null if no error callback was provided.

getBaseUrl

public String getBaseUrl()
If not set explicitly, the base URL is the configured default application root path RestClient.

Returns:
the base URL used to contact the remote service

setBaseUrl

public void setBaseUrl(String baseUrl)
Sets the base URL of the remote service and overrides the configured default application root path.

Parameters:
baseUrl - the base URL used to contact the remote service

getSuccessCodes

public List<Integer> getSuccessCodes()
Returns the list of success codes used by this proxy.

Returns:
list of success codes, null if no custom success codes were provided.

setSuccessCodes

public void setSuccessCodes(List<Integer> successCodes)
Sets a list of HTTP status codes that will be used to determine whether a request was successful or not.

Parameters:
codes - list of HTTP status codes

sendRequest

protected void sendRequest(com.google.gwt.http.client.RequestBuilder requestBuilder,
                           String body,
                           ResponseDemarshallingCallback demarshallingCallback)

unmarshallException

protected Throwable unmarshallException(com.google.gwt.http.client.Response response)
Uses the configured ClientExceptionMapper to unmarshal the Response into a Throwable.

Parameters:
response -

handleError

protected void handleError(Throwable throwable,
                           com.google.gwt.http.client.Request request,
                           com.google.gwt.http.client.Response response)

setQualifiers

public void setQualifiers(Annotation[] annos)
Specified by:
setQualifiers in interface RpcStub

setBatch

public void setBatch(RpcBatch batch)
Specified by:
setBatch in interface RpcStub

hasExceptionMapper

public boolean hasExceptionMapper()
Returns:
true if this proxy has a configured exception mapper

getExceptionMapper

public ClientExceptionMapper getExceptionMapper()
Returns:
the exceptionMapper

setExceptionMapper

public void setExceptionMapper(ClientExceptionMapper exceptionMapper)
Parameters:
exceptionMapper - the exceptionMapper to set

Errai 3.0.1-SNAPSHOT

Copyright © 2013-2014 JBoss, a division of Red Hat. All Rights Reserved.