Tag Archive http_accept

Agavi routing specials

3. Mai 2010 Kommentare deaktiviert für Agavi routing specials By webpirat

Um bestimmte Agavi output_types bei speziellen routings zu bedienen kann man die routing.xml wie folgt anpassen.

<!-- cut out leading slash -->
<route name="slasher" pattern="^/" stop="false" imply="true" cut="true" />

<!-- match ajax calls with special http header -->
<route pattern="XMLHttpRequest" source="_SERVER[HTTP_X_REQUESTED_WITH]" stop="false" output_type="ajax" />

<!-- match json calls with special http header -->
<route pattern="application/json" source="_SERVER[HTTP_ACCEPT]" stop="false" output_type="json" />

<!-- cut out special pointer -->
<route name="portal" pattern="^({portal:[a-zA-Z]{3}}/)?" stop="false" imply="true" cut="true">
    <callbacks>
        <callback class="RoutingCallback" />
    </callbacks>
</route>

, , , , , , , , , ,