/*
 * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
 * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 *
 * $Id: ParamEntityThrowingWebApplicationException.java 72032 2013-06-04 17:54:34Z supol $
 */
package com.sun.ts.tests.jaxrs.ee.rs;

import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.Response.Status;

public class ParamEntityThrowingWebApplicationException extends
		ParamEntityWithFromString {

	public static ParamEntityThrowingWebApplicationException fromString(
			String arg) {
		throw new WebApplicationException(Status.valueOf(parseArg(arg)));
	}

	protected static String parseArg(String arg) {
		arg = arg.replace("%3d", "=").replace("%3D", "=");
		arg = arg.contains("=") ? arg.replaceAll(".*=", "") : arg;
		return arg;
	}
}
