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

/**
 * //from  w w w .  j  a  v a 2 s  . c om
 * @param inputList
 * @param entryId
 * @return
 */
public static List<String> showDocument(List<String> inputList, Integer entryId) {
    if (inputList == null) {
        return null;
    }

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

    String anchorBegin = "<a class=\"searchResult\" href=\"";
    anchorBegin += ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getRequest()
            .getContextPath();
    anchorBegin += "/src/docbase/ShowDocument.do?entryId=";
    anchorBegin += entryId;
    anchorBegin += "\">";
    String hrefEnd = "</a>";

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

    return retValue;
}

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

/**
 * /*www.  j  ava 2  s  .c  o m*/
 * @param inputList
 * @param entryId
 * @param titleLastRow
 * @return
 */
public static List<String> showDocument(List<String> inputList, Integer entryId, String titleLastRow) {
    if (inputList == null) {
        return null;
    }

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

    String anchorBegin = "<a class=\"searchResult\" href=\"";
    anchorBegin += ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getRequest()
            .getContextPath();
    anchorBegin += "/src/docbase/ShowDocument.do?entryId=";
    anchorBegin += entryId;
    anchorBegin += "\"";
    String anchorBeginEnd = ">";
    String title = "title=\"";
    title += titleLastRow;
    title += "\"";
    String hrefEnd = "</a>";

    for (int i = 0; i < inputList.size(); i++) {
        if (i < inputList.size() - 1)
            retValue.add(anchorBegin + anchorBeginEnd + inputList.get(i) + hrefEnd);
        else
            retValue.add(anchorBegin + title + anchorBeginEnd + inputList.get(i) + hrefEnd);
    }

    return retValue;
}

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

/**
 * /*from   ww  w  .j av  a 2 s.  co m*/
 * @param inputList
 * @param entryId
 * @return
 */
public static List<String> showDocumentExpand(List<String> inputList, Integer entryId) {
    if (inputList == null) {
        return null;
    }

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

    String anchorBegin = "<a class=\"searchResult\" href=\"";
    String anchorBeginText = "<a class=\"searchResult textDoc\" href=\"";
    String anchor = ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getRequest()
            .getContextPath();
    anchor += "/src/docbase/ShowDocument.do?entryId=";
    anchor += entryId;
    anchor += "\">";
    String hrefEnd = "</a>";

    for (int i = 0; i < inputList.size(); i++) {
        if (i < inputList.size() - 1)
            retValue.add(anchorBegin + anchor + inputList.get(i) + hrefEnd);
        else
            retValue.add(anchorBeginText + anchor + inputList.get(i) + hrefEnd);
    }

    return retValue;
}

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

/**
 * // ww w  .  j a  v  a 2 s . com
 * @param entryId
 * @return
 */
public static String showDocumentRelated(Integer entryId) {
    StringBuilder stringBuilder = new StringBuilder("<a class=\"showResult\" href=\"");
    stringBuilder.append(((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes())
            .getRequest().getContextPath());
    stringBuilder.append("/src/docbase/CompareDocument.do?entryId=");
    stringBuilder.append(entryId);
    stringBuilder.append("\">Show Documents Related</a>");

    return stringBuilder.toString();
}

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

/**
 * //  ww w  .  j  a v a 2  s.c o m
 * @param inputList
 * @param entryId
 * @return
 */
public static List<String> showDocumentRelated(List<String> inputList, Integer entryId) {
    if (inputList == null)
        return null;

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

    StringBuilder anchorBegin = new StringBuilder("<a title=\"");
    if (!inputList.get(inputList.size() - 1).contains("NNF"))
        anchorBegin.append(inputList.get(inputList.size() - 1).toString().substring(3,
                inputList.get(inputList.size() - 1).toString().indexOf("</b>")));
    else
        anchorBegin.append("DocId#" + entryId + " - " + inputList.get(inputList.size() - 1).toString()
                .substring(3, inputList.get(inputList.size() - 1).toString().indexOf("</b>")));
    anchorBegin.append("\" class=\"showResult tabTitle\" id=\"docId" + entryId + "\" href=\"");
    anchorBegin.append(((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getRequest()
            .getContextPath());
    anchorBegin.append("/src/docbase/CompareDocument.do?entryId=");
    anchorBegin.append(entryId);
    anchorBegin.append("\">");
    String hrefEnd = "</a>";

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

    return retValue;
}

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

/**
 * /*from www . j av  a 2  s .  c  o  m*/
 * @param inputList
 * @param entryId
 * @param titleLastRow
 * @return
 */
public static List<String> showDocumentRelated(List<String> inputList, Integer entryId,
        String volumeInsertAndFolio, String titleLastRow) {
    if (inputList == null)
        return null;

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

    StringBuilder anchorBegin = new StringBuilder("<a title=\"");
    anchorBegin.append("DocId#" + entryId + " - " + volumeInsertAndFolio);
    anchorBegin.append("\" class=\"showResult tabTitle\" id=\"docId" + entryId + "\" href=\"");
    anchorBegin.append(((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getRequest()
            .getContextPath());
    anchorBegin.append("/src/docbase/CompareDocument.do?entryId=");
    anchorBegin.append(entryId);
    anchorBegin.append("\">");
    StringBuilder anchorBeginLastColumn = new StringBuilder("<a title=\"");
    anchorBeginLastColumn.append(titleLastRow);
    anchorBeginLastColumn.append("\" class=\"showResult\" id=\"docId" + entryId + "\" href=\"");
    anchorBeginLastColumn.append(((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes())
            .getRequest().getContextPath());
    anchorBeginLastColumn.append("/src/docbase/CompareDocument.do?entryId=");
    anchorBeginLastColumn.append(entryId);
    anchorBeginLastColumn.append("\">");
    String hrefEnd = "</a>";

    for (int i = 0; i < inputList.size(); i++) {
        if (i < inputList.size() - 1)
            retValue.add(anchorBegin + inputList.get(i) + hrefEnd);
        else
            retValue.add(anchorBeginLastColumn + inputList.get(i) + hrefEnd);
    }

    return retValue;
}

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

/**
 * //from w ww.  ja  va2  s  . c  om
 * @param placeAllId
 * @param numberOfDocumentsInTopicsPlace
 * @param numberOfTopicsPlace
 * @param description
 * @return
 */
public static String showDocumentsInTopicsPlace(Integer placeAllId, Integer numberOfDocumentsInTopicsPlace,
        Integer numberOfTopicsPlace) {
    StringBuilder anchor = new StringBuilder("<a class=\"topics\" href=\"");
    anchor.append(((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getRequest()
            .getContextPath());
    anchor.append("/src/geobase/ShowTopicsPlace.do?placeAllId=");
    anchor.append(placeAllId);
    anchor.append("\">");
    anchor.append(numberOfDocumentsInTopicsPlace);
    anchor.append(" Documents on ");
    anchor.append(numberOfTopicsPlace);
    anchor.append(" Topics");
    anchor.append("</a>");

    return anchor.toString();
}

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

/**
 * // ww  w . jav a2s  .  com
 * @param summaryId
 * @param description
 * @return
 */
public static String showDocumentsVolume(Integer summaryId, String description) {
    StringBuilder anchor = new StringBuilder("<a id=\"showDocumentsRelated\" href=\"");
    anchor.append(((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getRequest()
            .getContextPath());
    anchor.append("/src/volbase/ShowDocumentsVolume.do?summaryId=");
    anchor.append(summaryId);
    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 . java2 s  .  c o m
 * @param messageId
 * @param text
 * @return
 */
public static String showMessage(Integer messageId, String text) {
    StringBuilder anchor = new StringBuilder("<a class=\"searchResult\" href=\"");
    anchor.append(((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getRequest()
            .getContextPath());
    anchor.append("/community/ShowMessage.do?messageId=");
    anchor.append(messageId);
    anchor.append("\">text</a>");

    return anchor.toString();
}

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

/**
 * //  ww  w .  ja  va  2  s . com
 * @param inputList
 * @param entryId
 * @return
 */
public static List<String> showPeople(List<String> inputList, Integer personId) {
    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/peoplebase/ShowPerson.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;
}