Example usage for org.springframework.web.context.request RequestContextHolder currentRequestAttributes

List of usage examples for org.springframework.web.context.request RequestContextHolder currentRequestAttributes

Introduction

In this page you can find the example usage for org.springframework.web.context.request RequestContextHolder currentRequestAttributes.

Prototype

public static RequestAttributes currentRequestAttributes() throws IllegalStateException 

Source Link

Document

Return the RequestAttributes currently bound to the thread.

Usage

From source file:org.medici.bia.common.util.HtmlUtils.java

public static List<String> showPeopleRelated(List<String> inputList, Integer personId) {
    if (inputList == null)
        return null;

    ArrayList<String> retValue = new ArrayList<String>(inputList.size());

    StringBuilder anchorBegin = new StringBuilder("<a title=\"");
    anchorBegin.append(inputList.get(0));
    anchorBegin.append("\" class=\"showResult\" id=\"peopleId" + personId + "\" href=\"");
    anchorBegin.append(((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getRequest()
            .getContextPath());/*w w w . j  a  va2 s  .  c  o m*/
    anchorBegin.append("/src/peoplebase/ComparePerson.do?personId=");
    anchorBegin.append(personId);
    anchorBegin.append("\">");
    String hrefEnd = "</a>";

    for (int i = 0; i < inputList.size(); i++) {
        StringBuilder stringBuilder = new StringBuilder(anchorBegin.toString());
        stringBuilder.append(inputList.get(i));
        stringBuilder.append(hrefEnd);
        retValue.add(stringBuilder.toString());
    }

    return retValue;
}

From source file:org.medici.bia.common.util.HtmlUtils.java

public static List<String> showPersonalAnnotationsExplorer(List<String> inputList, Image image) {
    if (inputList == null) {
        return null;
    }//from  w ww.  j a v a  2  s .  c  o m

    ArrayList<String> retValue = new ArrayList<String>(inputList.size());

    StringBuilder anchorBegin = new StringBuilder("<a class=\"searchResult\" href=\"");
    anchorBegin.append(((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getRequest()
            .getContextPath());
    anchorBegin.append("/src/volbase/ShowExplorerVolume.do?volNum=");
    anchorBegin.append(image.getVolNum());
    anchorBegin.append("&volLetExt=");
    if (image.getVolLetExt() != null) {
        anchorBegin.append(image.getVolLetExt());
    }
    anchorBegin.append("&imageOrder=");
    anchorBegin.append(image.getImageOrder());
    anchorBegin.append("&imageType=");
    anchorBegin.append(image.getImageType());
    anchorBegin.append("&imageProgTypeNum=");
    anchorBegin.append(image.getImageProgTypeNum());
    anchorBegin.append("&flashVersion=false");
    anchorBegin.append("\">");
    String hrefEnd = "</a>";

    for (int i = 0; i < inputList.size(); i++) {
        StringBuilder stringBuilder = new StringBuilder(anchorBegin.toString());
        stringBuilder.append(inputList.get(i));
        stringBuilder.append(hrefEnd);
        retValue.add(stringBuilder.toString());
    }

    return retValue;
}

From source file:org.medici.bia.common.util.HtmlUtils.java

/**
 * /*  ww  w .  ja  va 2  s . c  o  m*/
 * @param singleRow
 * @param placeAllId
 * @return
 */
public static List<String> showPlace(List<String> inputList, Integer placeAllId) {
    if (inputList == null)
        return null;

    ArrayList<String> retValue = new ArrayList<String>(inputList.size());

    StringBuilder anchorBegin = new StringBuilder("<a class=\"searchResult\" href=\"");
    anchorBegin.append(((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getRequest()
            .getContextPath());
    anchorBegin.append("/src/geobase/ShowPlace.do?placeAllId=");
    anchorBegin.append(placeAllId);
    anchorBegin.append("\">");
    String hrefEnd = "</a>";

    for (int i = 0; i < inputList.size(); i++) {
        if (i != inputList.size() - 1) {
            StringBuilder stringBuilder = new StringBuilder(anchorBegin.toString());
            stringBuilder.append(inputList.get(i));
            stringBuilder.append(hrefEnd);
            retValue.add(stringBuilder.toString());
        } else {
            StringBuilder topicsRelated = new StringBuilder("<a class=\"tabResult\" href=\"");
            topicsRelated.append(((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes())
                    .getRequest().getContextPath());
            topicsRelated.append("/de/geobase/ShowTopicsPlace.do?placeAllId=");
            topicsRelated.append(placeAllId);
            topicsRelated.append("\">");
            StringBuilder stringBuilder = new StringBuilder(topicsRelated.toString());
            stringBuilder.append(inputList.get(i));
            stringBuilder.append(hrefEnd);
            retValue.add(stringBuilder.toString());
        }
    }

    return retValue;
}

From source file:org.medici.bia.common.util.HtmlUtils.java

/**
 * //from   www. j a  v a2s  .  c  o  m
 * @param singleRow
 * @param placeAllId
 * @return
 */
public static List<String> showPlaceMarkedList(List<String> inputList, Integer placeAllId) {
    if (inputList == null)
        return null;

    ArrayList<String> retValue = new ArrayList<String>(inputList.size());

    StringBuilder anchorBegin = new StringBuilder("<a class=\"searchResult\" href=\"");
    anchorBegin.append(((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getRequest()
            .getContextPath());
    anchorBegin.append("/src/geobase/ShowPlace.do?placeAllId=");
    anchorBegin.append(placeAllId);
    anchorBegin.append("\">");
    String hrefEnd = "</a>";

    for (int i = 0; i < inputList.size(); i++) {
        StringBuilder stringBuilder = new StringBuilder(anchorBegin.toString());
        stringBuilder.append(inputList.get(i));
        stringBuilder.append(hrefEnd);
        retValue.add(stringBuilder.toString());
    }

    return retValue;
}

From source file:org.medici.bia.common.util.HtmlUtils.java

/**
 * /*from www  .  j  ava 2  s .  c  om*/
 * @param placeAllId
 * @param numberOfRecipientDocumentsPlace
 * @param description
 * @return
 */
public static String showRecipientDocumentsPlace(Integer placeAllId, Integer numberOfRecipientDocumentsPlace,
        String description) {
    StringBuilder anchor = new StringBuilder("<a class=\"recipient\" href=\"");
    anchor.append(((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getRequest()
            .getContextPath());
    anchor.append("/src/geobase/ShowRecipientDocumentsPlace.do?placeAllId=");
    anchor.append(placeAllId);
    anchor.append("\">");
    anchor.append(numberOfRecipientDocumentsPlace);
    anchor.append(' ');
    anchor.append(description);
    anchor.append("</a>");

    return anchor.toString();
}

From source file:org.medici.bia.common.util.HtmlUtils.java

/**
 * //from  w w  w . j av  a  2 s .c om
 * @param personId
 */
public static String showRecipientDocumentsRelated(Integer personId, String description) {
    StringBuilder anchor = new StringBuilder("<a class=\"recipient_docs\" href=\"");
    anchor.append(((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getRequest()
            .getContextPath());
    anchor.append("/src/peoplebase/ShowRecipientDocumentsPerson.do?personId=");
    anchor.append(personId);
    anchor.append("\">");
    anchor.append(description);
    anchor.append("</a>");

    return anchor.toString();
}

From source file:org.medici.bia.common.util.HtmlUtils.java

/**
 * //  w ww.j a  v  a2 s .c o m
 * @param personId
 */
public static String showReferringToDocumentsRelated(Integer personId, String description) {
    StringBuilder anchor = new StringBuilder("<a class=\"referred_docs\" href=\"");
    anchor.append(((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getRequest()
            .getContextPath());
    anchor.append("/src/peoplebase/ShowReferringToDocumentsPerson.do?personId=");
    anchor.append(personId);
    anchor.append("\">");
    anchor.append(description);
    anchor.append("</a>");

    return anchor.toString();
}

From source file:org.medici.bia.common.util.HtmlUtils.java

/**
 * This method returns the url relative to the server call to find documents with the same volume, 
 * insert and folio informations.//  ww w  . jav  a 2s.c  om
 * 
 * @param volNum the volume number
 * @param volLetExt the volume extension
 * @param insertNum the insert number
 * @param insertLet the insert extension
 * @param folioNum the folio number
 * @param folioMod the folio extension
 * @param folioRectoVerso the folio recto/verso information
 * @return url to the server call
 */
public static String showSameFolioDocuments(Integer volNum, String volLetExt, String insertNum,
        String insertLet, Integer folioNum, String folioMod, String folioRectoVerso) {

    StringBuilder url = new StringBuilder(
            ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getRequest()
                    .getContextPath());
    url.append("/src/docbase/ShowSameFolioDocuments.do?volNum=").append(volNum);
    url.append("&volLetExt=").append(volLetExt != null ? volLetExt.trim() : "");
    url.append("&insertNum=").append(insertNum != null ? insertNum.trim() : "");
    url.append("&insertLet=").append(insertLet != null ? insertLet.trim() : "");
    url.append("&folioNum=").append(folioNum != null ? folioNum : "");
    url.append("&folioMod=").append(folioMod != null ? folioMod.trim() : "");
    url.append("&folioRectoVerso=").append(folioRectoVerso != null ? folioRectoVerso.trim() : "");

    return url.toString();
}

From source file:org.medici.bia.common.util.HtmlUtils.java

/**
 * /*  w  w  w .ja v  a  2  s. com*/
 * @param inputList
 * @param entryId
 * @return
 */
public static List<String> showSchedone(List<String> inputList, Schedone schedone) {
    if (inputList == null)
        return null;

    ArrayList<String> retValue = new ArrayList<String>(inputList.size());

    StringBuilder anchorBegin = new StringBuilder("<a class=\"searchResult\" href=\"");
    anchorBegin.append(((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getRequest()
            .getContextPath());
    anchorBegin.append("/digitization/ShowSchedone.do?schedoneId=");
    anchorBegin.append(schedone.getSchedoneId());
    anchorBegin.append("\">");
    String hrefEnd = "</a>";

    for (int i = 0; i < inputList.size(); i++) {
        StringBuilder stringBuilder = new StringBuilder(anchorBegin.toString());
        stringBuilder.append(inputList.get(i));
        stringBuilder.append(hrefEnd);
        retValue.add(stringBuilder.toString());
    }

    return retValue;
}

From source file:org.medici.bia.common.util.HtmlUtils.java

/**
 * //from ww w  . j a v a 2 s  .c  o m
 * @param currentSchedone
 * @return
 */
public static String showSchedoneActive(Schedone currentSchedone) {
    StringBuilder anchor = new StringBuilder("<a class=\"searchResult\" href=\"");
    anchor.append(((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getRequest()
            .getContextPath());
    anchor.append("/digitization/ActivateSchedone.json?schedoneId=");
    anchor.append(currentSchedone.getSchedoneId());
    anchor.append("\">Active It</a>");

    return anchor.toString();
}