Package ro.isdc.wro.model.resource

Examples of ro.isdc.wro.model.resource.ResourceType


        try {
          compare(new FileInputStream(file), targetFileStream, new ResourcePostProcessor() {
            public void process(final Reader reader, final Writer writer)
                throws IOException {
              // ResourceType doesn't matter here
              ResourceType resourceType = ResourceType.CSS;
              try {
                resourceType = ResourceType.get(FilenameUtils.getExtension(file.getPath()));
              } catch (final IllegalArgumentException e) {
                LOG.warn("unkown resource type for file: {}, assuming resource type is: {}", file.getPath(),
                    resourceType);
View Full Code Here


   * @param resourceElement
   * @param resources
   *          list of parsed resources where the parsed resource is added.
   */
  private void parseResource(final Element resourceElement, final Collection<Resource> resources) {
    ResourceType type = null;
    final String tagName = resourceElement.getTagName();
    final String uri = resourceElement.getTextContent();
    if (TAG_JS.equals(tagName)) {
      type = ResourceType.JS;
    } else if (TAG_CSS.equals(tagName)) {
View Full Code Here

   */
  public ResourceType getResourceType(final HttpServletRequest request) {
    Validate.notNull(request);
    final String uri = request.getRequestURI();
    Validate.notNull(uri);
    ResourceType type = null;
    try {
      type = ResourceType.get(FilenameUtils.getExtension(stripSessionID(uri)));
    } catch (final IllegalArgumentException e) {
      LOG.debug("[FAIL] Cannot identify resourceType for uri: {}", uri);
    }
View Full Code Here

  private CacheKey retrieveCacheKey(final HttpServletRequest request) {
    CacheKey cacheKey = null;
    final String resourceTypeAsString = request.getParameter(PARAM_RESOURCE_TYPE);
    final String groupName = request.getParameter(PARAM_GROUP_NAME);
    try {
      final ResourceType resourceType = ResourceType.get(resourceTypeAsString);
      isTrue(groupName != null);
      if (groupName != null) {
        LOG.debug("groupName={}, resourceType={}", groupName, resourceType);
        cacheKey = new CacheKey(groupName, resourceType);
      }
View Full Code Here

   */
  public CacheKey create(final HttpServletRequest request) {
    notNull(request);
    CacheKey key = null;
    final String groupName = groupExtractor.getGroupName(request);
    final ResourceType resourceType = groupExtractor.getResourceType(request);
    final boolean minimize = isMinimized(request);
    if (groupName != null && resourceType != null) {
      key = new CacheKey(groupName, resourceType, minimize);
    }
    return key;
View Full Code Here

  }
 
  @Test
  public void shouldInvokeLazyProcessor()
      throws Exception {
    final ResourceType expectedResourceType = ResourceType.CSS;
    when(mockProcessorDecorator.isMinimize()).thenReturn(true);
    when(mockProcessorDecorator.getSupportedResourceType()).thenReturn(new SupportedResourceType() {
      public Class<? extends Annotation> annotationType() {
        return SupportedResourceType.class;
      }
View Full Code Here

  }
 
  @Test
  public void testExtractInvalidResourceType() {
    String uri = "/test.js";
    ResourceType type = victim.getResourceType(mockRequestForUri(uri));
    Assert.assertEquals(ResourceType.JS, type);
   
    uri = "/test.css";
    type = victim.getResourceType(mockRequestForUri(uri));
    Assert.assertEquals(ResourceType.CSS, type);
View Full Code Here

TOP

Related Classes of ro.isdc.wro.model.resource.ResourceType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.