Java Code Examples for org.restlet.util.Series#getFirstValue()

The following examples show how to use org.restlet.util.Series#getFirstValue() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PolygeneRestApplication.java    From attic-polygene-java with Apache License 2.0 5 votes vote down vote up
@Override
public synchronized void start()
    throws Exception
{
    setName( polygeneApplication.name() );
    Series<Parameter> parameters = getContext().getParameters();
    String mode = parameters.getFirstValue( "org.apache.polygene.runtime.mode" );
    super.start();
    getLogger().info( "RestApplication successfully started." );
}
 
Example 2
Source File: ServerResource.java    From open-rmbt with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
public String getIP()
{
    final Series<Header> headers = (Series<Header>) getRequest().getAttributes().get("org.restlet.http.headers");
    final String realIp = headers.getFirstValue("X-Real-IP", true);
    if (realIp != null)
        return realIp;
    else
        return getRequest().getClientInfo().getAddress();
}
 
Example 3
Source File: ServerResource.java    From open-rmbt with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
public Reference getURL()
{
    final Series<Header> headers = (Series<Header>) getRequest().getAttributes().get("org.restlet.http.headers");
    final String realURL = headers.getFirstValue("X-Real-URL", true);
    if (realURL != null)
        return new Reference(realURL);
    else
        return getRequest().getOriginalRef();
}
 
Example 4
Source File: ServerResource.java    From open-rmbt with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
public String getIP()
{
    final Series<Header> headers = (Series<Header>) getRequest().getAttributes().get("org.restlet.http.headers");
    final String realIp = headers.getFirstValue("X-Real-IP", true);
    if (realIp != null)
        return realIp;
    else
        return getRequest().getClientInfo().getAddress();
}
 
Example 5
Source File: ServerResource.java    From open-rmbt with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
public Reference getURL()
{
    final Series<Header> headers = (Series<Header>) getRequest().getAttributes().get("org.restlet.http.headers");
    final String realURL = headers.getFirstValue("X-Real-URL", true);
    if (realURL != null)
        return new Reference(realURL);
    else
        return getRequest().getOriginalRef();
}