diff options
Diffstat (limited to 'plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/data/ServletResourceBridge.java')
-rw-r--r-- | plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/data/ServletResourceBridge.java | 132 |
1 files changed, 66 insertions, 66 deletions
diff --git a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/data/ServletResourceBridge.java b/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/data/ServletResourceBridge.java index d1d5cf6a9de..ce159a4a1fd 100644 --- a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/data/ServletResourceBridge.java +++ b/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/data/ServletResourceBridge.java @@ -1,66 +1,66 @@ -/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.manager.servlet.data;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URI;
-import javax.servlet.http.HttpServletRequest;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.exception.OseeExceptions;
-import org.eclipse.osee.framework.resource.management.IResource;
-import org.eclipse.osee.framework.resource.management.IResourceLocator;
-
-/**
- * @author Roberto E. Escobar
- */
-public class ServletResourceBridge implements IResource {
-
- private final HttpServletRequest request;
- private final IResourceLocator locator;
-
- public ServletResourceBridge(HttpServletRequest request, IResourceLocator locator) {
- this.request = request;
- this.locator = locator;
- }
-
- @Override
- public InputStream getContent() throws OseeCoreException {
- InputStream stream = null;
- try {
- stream = request.getInputStream();
- } catch (IOException ex) {
- OseeExceptions.wrapAndThrow(ex);
- }
- return stream;
- }
-
- @Override
- public URI getLocation() {
- return locator.getLocation();
- }
-
- @Override
- public String getName() {
- String path = locator.getLocation().toASCIIString();
- int index = path.lastIndexOf("/");
- if (index != -1 && index + 1 < path.length()) {
- path = path.substring(index + 1, path.length());
- }
- return path;
- }
-
- @Override
- public boolean isCompressed() {
- return HttpRequestDecoder.isDataCompressed(request);
- }
-
-}
+/******************************************************************************* + * Copyright (c) 2004, 2007 Boeing. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Boeing - initial API and implementation + *******************************************************************************/ +package org.eclipse.osee.framework.manager.servlet.data; + +import java.io.IOException; +import java.io.InputStream; +import java.net.URI; +import javax.servlet.http.HttpServletRequest; +import org.eclipse.osee.framework.core.exception.OseeCoreException; +import org.eclipse.osee.framework.core.exception.OseeExceptions; +import org.eclipse.osee.framework.resource.management.IResource; +import org.eclipse.osee.framework.resource.management.IResourceLocator; + +/** + * @author Roberto E. Escobar + */ +public class ServletResourceBridge implements IResource { + + private final HttpServletRequest request; + private final IResourceLocator locator; + + public ServletResourceBridge(HttpServletRequest request, IResourceLocator locator) { + this.request = request; + this.locator = locator; + } + + @Override + public InputStream getContent() throws OseeCoreException { + InputStream stream = null; + try { + stream = request.getInputStream(); + } catch (IOException ex) { + OseeExceptions.wrapAndThrow(ex); + } + return stream; + } + + @Override + public URI getLocation() { + return locator.getLocation(); + } + + @Override + public String getName() { + String path = locator.getLocation().toASCIIString(); + int index = path.lastIndexOf("/"); + if (index != -1 && index + 1 < path.length()) { + path = path.substring(index + 1, path.length()); + } + return path; + } + + @Override + public boolean isCompressed() { + return HttpRequestDecoder.isDataCompressed(request); + } + +} |