Class ResourceSerializer

java.lang.Object
ro.isdc.wro.extensions.http.handler.ResourceSerializer
All Implemented Interfaces:
com.google.gson.JsonSerializer<Resource>

public class ResourceSerializer extends Object implements com.google.gson.JsonSerializer<Resource>
Serializes Resource to json. It transforms the resources to a jsonElement which also provide a proxyUri which the user can use do download the specific resource. If the resource is external (eg. http://www.site.com/style.css) no proxyUri is provided. Example JSON produced by this serializer: { "type": "CSS", "uri": "/static/css/style.css", "proxyUri": "/wro/wroResources?id=/static/css/style.css" }
Since:
1.4.7
Author:
Ivar Conradi Ă˜sthus
  • Constructor Details

    • ResourceSerializer

      public ResourceSerializer(String requestURI)
  • Method Details

    • serialize

      public com.google.gson.JsonElement serialize(Resource resource, Type type, com.google.gson.JsonSerializationContext context)
      Specified by:
      serialize in interface com.google.gson.JsonSerializer<Resource>