dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #17799
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7225: Added search to all controllers, use with /api/resource/search/{uid, code, name}. Removed Dashboard...
------------------------------------------------------------
revno: 7225
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2012-06-06 18:37:56 +0200
message:
Added search to all controllers, use with /api/resource/search/{uid,code,name}. Removed DashboardContentController, IdentifiableObjectParams, WebLinkPopulator.
removed:
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DashboardContentController.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/IdentifiableObjectParams.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/WebLinkPopulator.java
modified:
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/AbstractCrudController.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ResourceController.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/organisationunit/OrganisationUnitController.java
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/AbstractCrudController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/AbstractCrudController.java 2012-06-06 13:31:45 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/AbstractCrudController.java 2012-06-06 16:37:56 +0000
@@ -104,6 +104,24 @@
return StringUtils.uncapitalize( getEntitySimpleName() );
}
+ // FIXME proper error handling?
+ @RequestMapping( value = "/search/{query}", method = RequestMethod.GET )
+ public String search( @PathVariable String query, @RequestParam Map<String, String> parameters, Model model, HttpServletRequest request ) throws Exception
+ {
+ WebOptions options = new WebOptions( parameters );
+ T entity = manager.search( getEntityClass(), query );
+
+ if ( options.hasLinks() )
+ {
+ WebUtils.generateLinks( entity );
+ }
+
+ model.addAttribute( "model", entity );
+ model.addAttribute( "viewClass", "detailed" );
+
+ return StringUtils.uncapitalize( getEntitySimpleName() );
+ }
+
//--------------------------------------------------------------------------
// POST
//--------------------------------------------------------------------------
=== removed file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DashboardContentController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DashboardContentController.java 2012-05-31 17:02:03 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DashboardContentController.java 1970-01-01 00:00:00 +0000
@@ -1,149 +0,0 @@
-package org.hisp.dhis.api.controller;
-
-/*
- * Copyright (c) 2004-2012, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * * Neither the name of the HISP project nor the names of its contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-import org.hisp.dhis.api.utils.IdentifiableObjectParams;
-import org.hisp.dhis.dashboard.DashboardContent;
-import org.hisp.dhis.dashboard.DashboardContents;
-import org.hisp.dhis.dashboard.DashboardService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.HttpStatus;
-import org.springframework.stereotype.Controller;
-import org.springframework.ui.Model;
-import org.springframework.web.HttpRequestMethodNotSupportedException;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.ResponseStatus;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.InputStream;
-import java.util.ArrayList;
-
-/**
- * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
- */
-@Controller
-@RequestMapping( value = DashboardContentController.RESOURCE_PATH )
-public class DashboardContentController
-{
- public static final String RESOURCE_PATH = "/dashboardContents";
-
- @Autowired
- private DashboardService dashboardService;
-
- //--------------------------------------------------------------------------
- // GET
- //--------------------------------------------------------------------------
-
- @RequestMapping( method = RequestMethod.GET )
- public String getDashboardContents( IdentifiableObjectParams params, Model model, HttpServletRequest request )
- {
- DashboardContents dashboardContents = new DashboardContents();
- dashboardContents.setDashboardContents( new ArrayList<DashboardContent>( dashboardService.getAllDashboardContent() ) );
-
- /*
- if ( params.hasLinks() )
- {
- WebLinkPopulator listener = new WebLinkPopulator( request );
- listener.addLinks( dashboardContents );
- }
- */
-
- model.addAttribute( "model", dashboardContents );
-
- return "dashboardContents";
- }
-
- @RequestMapping( value = "/{uid}", method = RequestMethod.GET )
- public String getDashboardContent( @PathVariable( "uid" ) int id, IdentifiableObjectParams params, Model model, HttpServletRequest request )
- {
- DashboardContent dashboardContent = dashboardService.getDashboardContent( id );
-
- /*
- if ( params.hasLinks() )
- {
- WebLinkPopulator listener = new WebLinkPopulator( request );
- listener.addLinks( dashboardContent );
- }
- */
-
- model.addAttribute( "model", dashboardContent );
- model.addAttribute( "viewClass", "detailed" );
-
- return "dashboardContent";
- }
-
- //--------------------------------------------------------------------------
- // POST
- //--------------------------------------------------------------------------
-
- @RequestMapping( method = RequestMethod.POST, headers = {"Content-Type=application/xml, text/xml"} )
- @ResponseStatus( value = HttpStatus.CREATED )
- public void postDashboardContentXML( HttpServletResponse response, InputStream input ) throws Exception
- {
- throw new HttpRequestMethodNotSupportedException( RequestMethod.POST.toString() );
- }
-
- @RequestMapping( method = RequestMethod.POST, headers = {"Content-Type=application/json"} )
- @ResponseStatus( value = HttpStatus.CREATED )
- public void postDashboardContentJSON( HttpServletResponse response, InputStream input ) throws Exception
- {
- throw new HttpRequestMethodNotSupportedException( RequestMethod.POST.toString() );
- }
-
- //--------------------------------------------------------------------------
- // PUT
- //--------------------------------------------------------------------------
-
- @RequestMapping( value = "/{uid}", method = RequestMethod.PUT, headers = {"Content-Type=application/xml, text/xml"} )
- @ResponseStatus( value = HttpStatus.NO_CONTENT )
- public void putDashboardContentXML( @PathVariable( "uid" ) String uid, InputStream input ) throws Exception
- {
- throw new HttpRequestMethodNotSupportedException( RequestMethod.DELETE.toString() );
- }
-
- @RequestMapping( value = "/{uid}", method = RequestMethod.PUT, headers = {"Content-Type=application/json"} )
- @ResponseStatus( value = HttpStatus.NO_CONTENT )
- public void putDashboardContentJSON( @PathVariable( "uid" ) String uid, InputStream input ) throws Exception
- {
- throw new HttpRequestMethodNotSupportedException( RequestMethod.PUT.toString() );
- }
-
- //--------------------------------------------------------------------------
- // DELETE
- //--------------------------------------------------------------------------
-
- @RequestMapping( value = "/{uid}", method = RequestMethod.DELETE )
- @ResponseStatus( value = HttpStatus.NO_CONTENT )
- public void deleteDashboardContent( @PathVariable( "uid" ) String uid ) throws Exception
- {
- throw new HttpRequestMethodNotSupportedException( RequestMethod.DELETE.toString() );
- }
-}
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ResourceController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ResourceController.java 2012-05-30 09:38:06 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ResourceController.java 2012-06-06 16:37:56 +0000
@@ -27,7 +27,6 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import org.hisp.dhis.api.utils.IdentifiableObjectParams;
import org.hisp.dhis.api.utils.WebUtils;
import org.hisp.dhis.api.webdomain.Resource;
import org.hisp.dhis.api.webdomain.Resources;
@@ -35,8 +34,9 @@
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
-import javax.servlet.http.HttpServletRequest;
+import java.util.Map;
/**
* @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
@@ -52,11 +52,12 @@
//-------------------------------------------------------------------------------------------------------
@RequestMapping( method = RequestMethod.GET )
- public String getResources( IdentifiableObjectParams params, Model model, HttpServletRequest request )
+ public String getResources( @RequestParam Map<String, String> parameters, Model model )
{
+ WebOptions options = new WebOptions( parameters );
Resources resources = new Resources();
- if ( params.hasLinks() )
+ if ( options.hasLinks() )
{
for ( Resource resource : resources.getResources() )
{
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/organisationunit/OrganisationUnitController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/organisationunit/OrganisationUnitController.java 2012-05-28 14:25:12 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/organisationunit/OrganisationUnitController.java 2012-06-06 16:37:56 +0000
@@ -28,16 +28,9 @@
*/
import org.hisp.dhis.api.controller.AbstractCrudController;
-import org.hisp.dhis.api.utils.IdentifiableObjectParams;
-import org.hisp.dhis.api.utils.WebLinkPopulator;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.springframework.stereotype.Controller;
-import org.springframework.ui.Model;
-import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-
-import javax.servlet.http.HttpServletRequest;
/**
* @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
@@ -48,21 +41,4 @@
extends AbstractCrudController<OrganisationUnit>
{
public static final String RESOURCE_PATH = "/organisationUnits";
-
- @RequestMapping( value = "/search/{query}", method = RequestMethod.GET )
- public String searchOrganisationUnit( @PathVariable String query, IdentifiableObjectParams params, Model model,
- HttpServletRequest request )
- {
- OrganisationUnit organisationUnit = manager.search( OrganisationUnit.class, query );
-
- if ( params.hasLinks() )
- {
- new WebLinkPopulator( request ).addLinks( organisationUnit );
- }
-
- model.addAttribute( "model", organisationUnit );
- model.addAttribute( "viewClass", "detailed" );
-
- return "organisationUnit";
- }
}
=== removed file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/IdentifiableObjectParams.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/IdentifiableObjectParams.java 2012-03-22 13:48:16 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/IdentifiableObjectParams.java 1970-01-01 00:00:00 +0000
@@ -1,100 +0,0 @@
-package org.hisp.dhis.api.utils;
-
-/*
- * Copyright (c) 2004-2012, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * * Neither the name of the HISP project nor the names of its contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-import java.util.Date;
-
-/**
- * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
- */
-public class IdentifiableObjectParams
-{
- private boolean links = true;
-
- private Date lastUpdated;
-
- private String nameLike;
-
- private boolean paging = true;
-
- private int page = 1;
-
- public IdentifiableObjectParams()
- {
- }
-
- public boolean hasLinks()
- {
- return links;
- }
-
- public void setLinks( boolean links )
- {
- this.links = links;
- }
-
- public Date getLastUpdated()
- {
- return lastUpdated;
- }
-
- public void setLastUpdated( Date lastUpdated )
- {
- this.lastUpdated = lastUpdated;
- }
-
- public String getNameLike()
- {
- return nameLike;
- }
-
- public void setNameLike( String nameLike )
- {
- this.nameLike = nameLike;
- }
-
- public boolean isPaging()
- {
- return paging;
- }
-
- public void setPaging( boolean paging )
- {
- this.paging = paging;
- }
-
- public int getPage()
- {
- return page;
- }
-
- public void setPage( int page )
- {
- this.page = page;
- }
-}
=== removed file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/WebLinkPopulator.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/WebLinkPopulator.java 2012-05-30 08:29:20 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/WebLinkPopulator.java 1970-01-01 00:00:00 +0000
@@ -1,212 +0,0 @@
-package org.hisp.dhis.api.utils;
-
-/*
- * Copyright (c) 2004-2012, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * * Neither the name of the HISP project nor the names of its contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-import javassist.util.proxy.ProxyObject;
-import org.hisp.dhis.api.webdomain.Resource;
-import org.hisp.dhis.api.webdomain.Resources;
-import org.hisp.dhis.common.BaseCollection;
-import org.hisp.dhis.common.BaseIdentifiableObject;
-import org.hisp.dhis.common.Pager;
-import org.hisp.dhis.dxf2.metadata.ExchangeClasses;
-import org.hisp.dhis.message.MessageConversation;
-import org.hisp.dhis.message.MessageConversations;
-
-import javax.servlet.http.HttpServletRequest;
-import java.util.Collection;
-
-/**
- * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
- */
-public class WebLinkPopulator
-{
- private String rootPath;
-
- public WebLinkPopulator( HttpServletRequest request )
- {
- rootPath = createRootPath( request );
- }
-
- public void addLinks( Object source )
- {
- if ( source instanceof Resources )
- {
- populateResources( (Resources) source );
- }
- else if ( source instanceof MessageConversations )
- {
- populateMessageConversations( (MessageConversations) source, true );
- }
- else if ( source instanceof MessageConversation )
- {
- populateMessageConversation( (MessageConversation) source, true );
- }
-
- if ( source instanceof BaseCollection )
- {
- BaseCollection baseCollection = (BaseCollection) source;
-
- if ( baseCollection.getPager() != null )
- {
- String basePath = getBasePath( source.getClass() );
- Pager pager = baseCollection.getPager();
-
- if ( pager.getPage() < pager.getPageCount() )
- {
- pager.setNextPage( basePath + "?page=" + (pager.getPage() + 1) );
- }
-
- if ( pager.getPage() > 1 )
- {
- if ( (pager.getPage() - 1) == 1 )
- {
- pager.setPrevPage( basePath );
- }
- else
- {
- pager.setPrevPage( basePath + "?page=" + (pager.getPage() - 1) );
- }
-
- }
- }
- }
- }
-
- private void populateMessageConversations( MessageConversations messageConversations, boolean root )
- {
- messageConversations.setLink( getBasePath( messageConversations.getClass() ) );
-
- if ( root )
- {
- for ( MessageConversation messageConversation : messageConversations.getMessageConversations() )
- {
- populateMessageConversation( messageConversation, false );
- }
- }
- }
-
- private void populateMessageConversation( MessageConversation messageConversation, boolean root )
- {
- populateIdentifiableObject( messageConversation );
-
- if ( root )
- {
- handleIdentifiableObjectCollection( messageConversation.getUsers() );
- }
- }
-
- private void populateResources( Resources resources )
- {
- resources.setLink( getBasePath( Resources.class ) );
-
- for ( Resource resource : resources.getResources() )
- {
- resource.setLink( getBasePath( resource.getClazz() ) );
- }
- }
-
- public void handleIdentifiableObjectCollection( Collection<? extends BaseIdentifiableObject> identifiableObjects )
- {
- if ( identifiableObjects != null )
- {
- for ( BaseIdentifiableObject baseIdentifiableObject : identifiableObjects )
- {
- populateIdentifiableObject( baseIdentifiableObject );
- }
- }
- }
-
- private void populateIdentifiableObject( BaseIdentifiableObject baseIdentifiableObject )
- {
- if ( baseIdentifiableObject != null )
- {
- baseIdentifiableObject.setLink( getPathWithUid( baseIdentifiableObject ) );
- }
- }
-
- private String getPathWithUid( BaseIdentifiableObject baseIdentifiableObject )
- {
- return getBasePath( baseIdentifiableObject.getClass() ) + "/" + baseIdentifiableObject.getUid();
- }
-
- private String getBasePath( Class<?> clazz )
- {
- if ( ProxyObject.class.isAssignableFrom( clazz ) )
- {
- clazz = clazz.getSuperclass();
- }
-
- String resourcePath = getPath( clazz );
-
- return rootPath + "/" + resourcePath;
- }
-
- public static String createRootPath( HttpServletRequest request )
- {
- StringBuilder builder = new StringBuilder();
- String xForwardedProto = request.getHeader( "X-Forwarded-Proto" );
- String xForwardedPort = request.getHeader( "X-Forwarded-Port" );
-
- if ( xForwardedProto != null && (xForwardedProto.equalsIgnoreCase( "http" ) || xForwardedProto.equalsIgnoreCase( "https" )) )
- {
- builder.append( xForwardedProto );
- }
- else
- {
- builder.append( request.getScheme() );
- }
-
-
- builder.append( "://" ).append( request.getServerName() );
-
- int port;
-
- try
- {
- port = Integer.parseInt( xForwardedPort );
- } catch ( NumberFormatException e )
- {
- port = request.getServerPort();
- }
-
- if ( port != 80 && port != 443 )
- {
- builder.append( ":" ).append( port );
- }
-
- builder.append( request.getContextPath() );
- builder.append( request.getServletPath() );
-
- return builder.toString();
- }
-
- public static String getPath( Class<?> clazz )
- {
- return ExchangeClasses.getExportMap().get( clazz );
- }
-}