5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster/**
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster *
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster * Copyright (c) 2009 Sun Microsystems Inc. All Rights Reserved
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster *
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster * The contents of this file are subject to the terms
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster * of the Common Development and Distribution License
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster * (the License). You may not use this file except in
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster * compliance with the License.
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster *
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster * You can obtain a copy of the License at
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster * https://opensso.dev.java.net/public/CDDLv1.0.html or
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster * opensso/legal/CDDLv1.0.txt
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster * See the License for the specific language governing
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster * permission and limitations under the License.
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster *
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster * When distributing Covered Code, include this CDDL
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster * Header Notice in each file and include the License file
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster * at opensso/legal/CDDLv1.0.txt.
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster * If applicable, add the following below the CDDL Header,
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster * with the fields enclosed by brackets [] replaced by
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster * your own identifying information:
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster * "Portions Copyrighted [year] [name of copyright owner]"
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster *
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster * $Id: URLResourceName.java,v 1.1 2009/11/24 21:42:35 madan_ranganath Exp $
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster *
63fcfdd800e1773bb54462cff066db6a312a99bbJames Phillpotts * Portions Copyrighted 2014 ForgeRock AS
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster */
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Fosterpackage com.sun.identity.shared.whitelist;
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster
63fcfdd800e1773bb54462cff066db6a312a99bbJames Phillpottsimport com.sun.identity.shared.debug.Debug;
63fcfdd800e1773bb54462cff066db6a312a99bbJames Phillpottsimport org.forgerock.openam.shared.resourcename.BaseURLResourceName;
63fcfdd800e1773bb54462cff066db6a312a99bbJames Phillpotts
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Fosterimport java.net.MalformedURLException;
3e9a58c7ab182327c2fdd169ed1d70dcba846fe4Andrew Forrest
63fcfdd800e1773bb54462cff066db6a312a99bbJames Phillpottsimport static com.sun.identity.shared.whitelist.ResourceMatch.*;
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster/**
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster * This plugin extends the functionality provided in
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster * <code>PrefixResourceName</code> to provide special handling to
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster * URL type prefix resource names in <code>canonicalize</code> method
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster * like validating port, assigning default port of 80, if port absent etc.
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster */
63fcfdd800e1773bb54462cff066db6a312a99bbJames Phillpottspublic class URLResourceName extends BaseURLResourceName<ResourceMatch, MalformedURLException> implements ResourceName {
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster /**
63fcfdd800e1773bb54462cff066db6a312a99bbJames Phillpotts * empty no argument constructor.
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster */
63fcfdd800e1773bb54462cff066db6a312a99bbJames Phillpotts public URLResourceName() {
63fcfdd800e1773bb54462cff066db6a312a99bbJames Phillpotts super(Debug.getInstance("patternMatching"), EXACT_MATCH, NO_MATCH, SUB_RESOURCE_MATCH,
63fcfdd800e1773bb54462cff066db6a312a99bbJames Phillpotts SUPER_RESOURCE_MATCH, WILDCARD_MATCH);
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster }
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster
63fcfdd800e1773bb54462cff066db6a312a99bbJames Phillpotts @Override
63fcfdd800e1773bb54462cff066db6a312a99bbJames Phillpotts protected MalformedURLException constructResourceInvalidException(Object[] args) {
63fcfdd800e1773bb54462cff066db6a312a99bbJames Phillpotts return new MalformedURLException("Invalid Port number specified");
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster }
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster}