juzu
Class URLBuilder

java.lang.Object
  extended by juzu.URLBuilder

public final class URLBuilder
extends Object

The URLBuilder produces URL for a Juzu application.

Builders can be obtained from a MimeContext object for building controller methods, however the favorite way to obtain a builder is to use a controller companion that provides a type safe way for creating fully configured builders.

Type safe URLBuilder factory method are generated for each view, action or resource controller methods. The signature of an url builder factory is obtained by translating the signature of the controller method and appending the suffix URL after the method name.

    public void MyController {
 

@Action public void myAction(String param) { }

@View public void myRender() { URLBuilder builder = MyController_.myActionURL("hello"); String url = builder.toString(); } }

Author:
Julien Viet

Nested Class Summary
static class URLBuilder.ESCAPE_XML
          Escape XML type literal.
 
Field Summary
static URLBuilder.ESCAPE_XML ESCAPE_XML
          Escape XML type literal instance.
 
Constructor Summary
URLBuilder(juzu.impl.request.spi.MimeBridge bridge, juzu.impl.controller.descriptor.ControllerMethod method)
           
 
Method Summary
 URLBuilder escapeXML(Boolean escapeXML)
           
 juzu.impl.utils.ParameterMap getParameters()
           
 URLBuilder setParameter(String name, String value)
           
 URLBuilder setParameter(String name, String[] value)
           
 URLBuilder setParameters(Map<String,String[]> parameters)
           
<T> URLBuilder
setProperty(PropertyType<T> propertyType, T propertyValue)
          Set or clear a property of the URL.
 String toString()
          Build the string value of this URL.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ESCAPE_XML

public static URLBuilder.ESCAPE_XML ESCAPE_XML
Escape XML type literal instance.

Constructor Detail

URLBuilder

public URLBuilder(juzu.impl.request.spi.MimeBridge bridge,
                  juzu.impl.controller.descriptor.ControllerMethod method)
Method Detail

setParameter

public URLBuilder setParameter(String name,
                               String value)
                        throws NullPointerException
Throws:
NullPointerException

setParameter

public URLBuilder setParameter(String name,
                               String[] value)
                        throws NullPointerException,
                               IllegalArgumentException
Throws:
NullPointerException
IllegalArgumentException

setParameters

public URLBuilder setParameters(Map<String,String[]> parameters)
                         throws NullPointerException,
                                IllegalArgumentException
Throws:
NullPointerException
IllegalArgumentException

getParameters

public juzu.impl.utils.ParameterMap getParameters()

escapeXML

public URLBuilder escapeXML(Boolean escapeXML)

setProperty

public <T> URLBuilder setProperty(PropertyType<T> propertyType,
                                  T propertyValue)
                       throws IllegalArgumentException
Set or clear a property of the URL.

Type Parameters:
T - the property generic type
Parameters:
propertyType - the property type
propertyValue - the property value
Returns:
this URL builder
Throws:
IllegalArgumentException - if the property is not valid

toString

public String toString()
Build the string value of this URL.

Overrides:
toString in class Object
Returns:
the string url


Copyright © 2012 eXo Platform SAS. All Rights Reserved.